Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / NodeIterator / NodeIterator-dont-overcollect.html
blob96fe55a72d4b4bb46c6bc779903bb03290ec671f
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../../../resources/js-test.js"></script>
5 <script>
6 var callbackWasTriggered = false;
8 var callback = function(node) {
9 callbackWasTriggered = true;
10 return NodeFilter.FILTER_ACCEPT;
12 var nodeIterator = document.createNodeIterator(document, NodeFilter.SHOW_ELEMENT, callback, false);
14 var callbackObservation = internals.observeGC(callback);
15 callback = null;
16 var nodeFilterObservation = internals.observeGC(nodeIterator.filter);
17 var nodeIteratorObservation = internals.observeGC(nodeIterator);
19 gc();
20 shouldBeFalse('nodeFilterObservation.wasCollected');
21 shouldBeFalse('callbackObservation.wasCollected');
23 nodeIterator.nextNode();
24 shouldBeTrue('callbackWasTriggered');
26 nodeIterator = null;
27 gc();
28 shouldBeTrue('nodeIteratorObservation.wasCollected');
29 shouldBeTrue('nodeFilterObservation.wasCollected');
30 shouldBeTrue('callbackObservation.wasCollected');
31 </script>
32 </body>
33 </html>