diff options
Diffstat (limited to 'testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/bailout-exception-vs-return-xml.window.js')
-rw-r--r-- | testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/bailout-exception-vs-return-xml.window.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/bailout-exception-vs-return-xml.window.js b/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/bailout-exception-vs-return-xml.window.js new file mode 100644 index 0000000000..45a67f925b --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/bailout-exception-vs-return-xml.window.js @@ -0,0 +1,26 @@ +async_test(t => { + const iframe = document.body.appendChild(document.createElement("iframe")); + t.add_cleanup(() => { iframe.remove(); }); + self.testSynchronousScript = t.step_func_done(() => { + assert_throws_dom("InvalidStateError", iframe.contentWindow.DOMException, () => { + iframe.contentDocument.open(); + }, "opening an XML document should throw"); + }); + iframe.src = "resources/bailout-order-xml-with-synchronous-script-frame.xhtml"; +}, "document.open should throw an InvalidStateError with XML document even when there is an active parser executing script"); + +for (const ev of ["beforeunload", "pagehide", "unload"]) { + async_test(t => { + const iframe = document.body.appendChild(document.createElement("iframe")); + t.add_cleanup(() => { iframe.remove(); }); + iframe.addEventListener("load", t.step_func(() => { + iframe.contentWindow.addEventListener(ev, t.step_func_done(() => { + assert_throws_dom("InvalidStateError", iframe.contentWindow.DOMException, () => { + iframe.contentDocument.open(); + }, "opening an XML document should throw"); + })); + iframe.src = "about:blank"; + }), { once: true }); + iframe.src = "/common/dummy.xhtml"; + }, `document.open should throw an InvalidStateError with XML document even when the ignore-opens-during-unload counter is greater than 0 (during ${ev} event)`); +} |