4 <script src=
"../../../resources/js-test.js"></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
);
16 var nodeFilterObservation
= internals
.observeGC(nodeIterator
.filter
);
17 var nodeIteratorObservation
= internals
.observeGC(nodeIterator
);
20 shouldBeFalse('nodeFilterObservation.wasCollected');
21 shouldBeFalse('callbackObservation.wasCollected');
23 nodeIterator
.nextNode();
24 shouldBeTrue('callbackWasTriggered');
28 shouldBeTrue('nodeIteratorObservation.wasCollected');
29 shouldBeTrue('nodeFilterObservation.wasCollected');
30 shouldBeTrue('callbackObservation.wasCollected');