OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <div>Test passes if it does not crash</div> | 2 <div>Test passes if it does not crash</div> |
3 <script src="../../../resources/gc.js"></script> | 3 <script src="../../../resources/gc.js"></script> |
4 <script> | 4 <script> |
5 if (window.testRunner) { | 5 if (window.testRunner) { |
6 testRunner.waitUntilDone(); | 6 testRunner.waitUntilDone(); |
7 testRunner.dumpAsText(); | 7 testRunner.dumpAsText(); |
| 8 } |
| 9 var observer, div; |
| 10 |
| 11 function initializeObserver() { |
| 12 observer = new MutationObserver( |
| 13 function() {console.log('Should not appear')}); |
| 14 div = document.createElement('div'); |
| 15 observer.observe(div, {attributes: true}); |
| 16 div.id = 'foo'; |
8 } | 17 } |
9 var observer = new MutationObserver(function() {console.log('Should not appear')
}); | 18 |
10 var div = document.createElement('div'); | 19 // Do initialization work in an inner function to avoid references to objects |
11 observer.observe(div, {attributes: true}); | 20 // remaining live on this function's stack frame (http://crbug.com/595672/). |
12 div.id = 'foo'; | 21 initializeObserver(); |
13 div = null; | 22 div = null; |
14 observer = null; | 23 observer = null; |
15 gc(); | 24 gc(); |
16 setTimeout(function() { testRunner.notifyDone(); }, 0); | 25 setTimeout(function() { testRunner.notifyDone(); }, 0); |
17 </script> | 26 </script> |
OLD | NEW |