OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../../resources/js-test.js"></script> |
| 5 <script> |
| 6 description("Moving pending scripts between detached and non-detached documents
should not crash."); |
| 7 |
| 8 window.jsTestIsAsync = true; |
| 9 |
| 10 if (window.testRunner) { |
| 11 testRunner.dumpAsText() |
| 12 testRunner.waitUntilDone(); |
| 13 } |
| 14 |
| 15 var iframe; |
| 16 |
| 17 function start() { |
| 18 iframe = document.createElement('iframe'); |
| 19 iframe.src = 'resources/script-element-moved-to-detached-document-crash-fram
es.html'; |
| 20 iframe.onload = runTest; |
| 21 document.getElementById('store_div').appendChild(iframe); |
| 22 } |
| 23 |
| 24 function runTest() { |
| 25 var iframeDocument = iframe.contentWindow.document; |
| 26 var option = document.createElement('option'); |
| 27 var element2 = iframeDocument.getElementById('element2'); |
| 28 var element3 = iframeDocument.getElementById('element3'); |
| 29 var emptyScript = document.createElement('script'); |
| 30 emptyScript.src = null; |
| 31 document.documentElement.appendChild(emptyScript); |
| 32 element3.ownerDocument.adoptNode(option); |
| 33 var element2Document = element2.contentWindow.document; |
| 34 element2.parentNode.removeChild(element2); |
| 35 |
| 36 // Move the script element to various documents: |
| 37 |
| 38 // Add it to the document. |
| 39 option.appendChild(emptyScript); |
| 40 // Add it to element2 inside the iframe, which is a detached frame element. |
| 41 element2Document.lastChild.appendChild(emptyScript); |
| 42 // Move back to document again. |
| 43 document.body.appendChild(emptyScript); |
| 44 // Pass if no asserts triggered by the above script element document transfe
rs. |
| 45 finishJSTest(); |
| 46 } |
| 47 window.onload = start; |
| 48 </script> |
| 49 </head> |
| 50 <body> |
| 51 <div id="store_div"></div> |
| 52 </body> |
| 53 </html> |
OLD | NEW |