| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 | |
| 3 <script src="../../../resources/js-test.js"></script> | |
| 4 | |
| 5 <script> | |
| 6 description('MutationObserver wrappers should survive GC for passing into the ca
llback even if JS has lost references.'); | |
| 7 | |
| 8 jsTestIsAsync = true; | |
| 9 | |
| 10 function addObserver(node, fn) { | |
| 11 var observer = new MutationObserver(fn); | |
| 12 observer.testProperty = true; | |
| 13 observer.observe(node, {attributes:true}); | |
| 14 } | |
| 15 | |
| 16 window.addEventListener("load", function() { | |
| 17 addObserver(document.body, function(records, observer) { | |
| 18 window.observer = observer; | |
| 19 shouldBe('observer.testProperty', 'true'); | |
| 20 finishJSTest(); | |
| 21 }); | |
| 22 | |
| 23 gc(); | |
| 24 | |
| 25 document.body.setAttribute('touch', 'the node'); | |
| 26 }); | |
| 27 </script> | |
| 28 | |
| OLD | NEW |