bailout-side-effects-xml.window.js (785B)
1 // META: script=resources/document-open-side-effects.js 2 3 async_test(t => { 4 const iframe = document.body.appendChild(document.createElement("iframe")); 5 t.add_cleanup(() => iframe.remove()); 6 iframe.src = "/common/dummy.xhtml"; 7 iframe.onload = t.step_func_done(() => { 8 const origURL = iframe.contentDocument.URL; 9 assertDocumentIsReadyForSideEffectsTest(iframe.contentDocument, "XML document"); 10 assert_throws_dom( 11 "InvalidStateError", 12 iframe.contentWindow.DOMException, 13 () => { 14 iframe.contentDocument.open(); 15 }, 16 "document.open() should throw on XML documents" 17 ); 18 assertOpenHasNoSideEffects(iframe.contentDocument, origURL, "XML document"); 19 }); 20 }, "document.open bailout should not have any side effects (XML document)");