blob: b3ef1c8c3bd9f6daaee2e1b09e03244bfe25cf9d [file] [log] [blame]
<!DOCTYPE html>
<script src="../../../resources/js-test.js"></script>
<script>
description('MutationObserver wrappers should survive GC for passing into the callback even if JS has lost references and the only remaining observations are transient.');
jsTestIsAsync = true;
function addObserver(node, fn) {
var observer = new MutationObserver(fn);
observer.testProperty = true;
observer.observe(node, {attributes:true, subtree: true});
}
onload = function() {
var root = document.createElement('div');
var child = root.appendChild(document.createElement('span'));
addObserver(root, function(records, observer) {
window.observer = observer;
shouldBe('observer.testProperty', 'true');
finishJSTest();
});
root.removeChild(child);
child.setAttribute('foo', 'bar');
root = null;
gc();
};
</script>