4 <script src=
"../../../resources/js-test.js"></script>
6 description("Moving pending scripts between detached and non-detached documents should not crash.");
8 window
.jsTestIsAsync
= true;
10 if (window
.testRunner
) {
11 testRunner
.dumpAsText()
12 testRunner
.waitUntilDone();
18 iframe
= document
.createElement('iframe');
19 iframe
.src
= 'resources/script-element-moved-to-detached-document-crash-frames.html';
20 iframe
.onload
= runTest
;
21 document
.getElementById('store_div').appendChild(iframe
);
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
);
36 // Move the script element to various documents:
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 transfers.
47 window
.onload
= start
;
51 <div id=
"store_div"></div>