<!DOCTYPE html>
<title>NodeFilter UseCounters</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
test(function() {
var NodeFilterIsFunction = 1059; // From UseCounter.h
assert_false(internals.isUseCounted(document, NodeFilterIsFunction));
var filterCalled = false;
var filter = function() {
filter.called = true;
};
var iterator = document.createNodeIterator(document, NodeFilter.SHOW_ALL, filter);
iterator.nextNode();
assert_true(filter.called);
assert_true(internals.isUseCounted(document, NodeFilterIsFunction));
}, 'NodeFilter UseCounter for callback function');
test(function() {
var NodeFilterIsObject = 1060; // From UseCounter.h
assert_false(internals.isUseCounted(document, NodeFilterIsObject));
var filter = {
acceptNode: function() {
filter.called = true;
}
};
var iterator = document.createNodeIterator(document, NodeFilter.SHOW_ALL, filter);
iterator.nextNode();
assert_true(filter.called);
assert_true(internals.isUseCounted(document, NodeFilterIsObject));
}, 'NodeFilter UseCounter for callback function');
</script>