| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <div>Tests for a crash due to modifying the DOM during mutation events due to an
adoptNode call. If this page doesn't crash and DOMSubtreeModified is fire, this
test succeeds.</div> | |
| 3 <div id="result"></div> | |
| 4 <div id="node-to-adopt"></div> | |
| 5 <iframe></iframe> | |
| 6 <script> | |
| 7 if (window.testRunner) | |
| 8 testRunner.dumpAsText(); | |
| 9 | |
| 10 var nodeToAdopt = document.getElementById('node-to-adopt'); | |
| 11 | |
| 12 var mutationHandler = function() { | |
| 13 document.getElementById('result').innerHTML = "DOMSubtreeModified fired"; | |
| 14 document.body.removeEventListener('DOMSubtreeModified', mutationHandler, tru
e); | |
| 15 document.body.appendChild(nodeToAdopt); | |
| 16 }; | |
| 17 document.body.addEventListener('DOMSubtreeModified', mutationHandler, true); | |
| 18 | |
| 19 var iframe = document.querySelector('iframe'); | |
| 20 var iframeDoc = iframe.contentDocument; | |
| 21 iframeDoc.adoptNode(nodeToAdopt); | |
| 22 // The crash happens when the iframe's document is getting detached. | |
| 23 document.body.removeChild(iframe); | |
| 24 </script> | |
| OLD | NEW |