OLD | NEW |
1 <script src="../js/resources/js-test-pre.js"></script> | 1 <script src="../js/resources/js-test-pre.js"></script> |
2 <script> | 2 <script> |
3 window.jsTestIsAsync = true; | 3 window.jsTestIsAsync = true; |
4 description('Clearing transient observers after observation node is GCed should
not cause a crash.'); | 4 description('Clearing transient observers after observation node is GCed should
not cause a crash.'); |
5 | 5 |
6 function callback(mutations) { | 6 function callback(mutations) { |
7 window.mutations = mutations; | 7 window.mutations = mutations; |
8 } | 8 } |
9 var observer = new WebKitMutationObserver(callback); | 9 var observer = new WebKitMutationObserver(callback); |
10 | 10 |
11 var div = document.createElement('div'); | 11 var div = document.createElement('div'); |
12 var span = div.appendChild(document.createElement('span')); | 12 var span = div.appendChild(document.createElement('span')); |
13 observer.observe(div, {attributes: true, subtree: true}); | 13 observer.observe(div, {attributes: true, subtree: true}); |
14 div.removeChild(span); | 14 div.removeChild(span); |
15 div = null; | 15 div = null; |
16 gc(); | 16 gc(); |
17 span.setAttribute('foo', 'bar'); | 17 span.setAttribute('foo', 'bar'); |
18 setTimeout(function() { | 18 setTimeout(function() { |
19 shouldBe('mutations.length', '1'); | 19 shouldBe('mutations.length', '1'); |
20 finishJSTest(); | 20 finishJSTest(); |
21 }, 0); | 21 }, 0); |
22 </script> | 22 </script> |
23 <script src="../js/resources/js-test-post.js"></script> | 23 <script src="../js/resources/js-test-post.js"></script> |
OLD | NEW |