diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index b67ef8735182..b1fa91ce452e 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -286735,6 +286735,16 @@ {} ] ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/aborted-parser-async-frame.html": [ + [ + {} + ] + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/aborted-parser-frame.html": [ + [ + {} + ] + ], "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/encoding-frame.html": [ [ {} @@ -351749,6 +351759,12 @@ {} ] ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.js": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.html", + {} + ] + ], "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-01.xhtml": [ [ "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-01.xhtml", @@ -590156,6 +590172,10 @@ "ea3ff6e58680da8c3f08e7f26ebc738d82703801", "testharness" ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.js": [ + "0ef6dab1d5e2364a0a75513469e339c20b14c674", + "testharness" + ], "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-01.xhtml": [ "cb059c7c17320c0e63e9453d3a0486a8a94b060a", "testharness" @@ -590192,6 +590212,14 @@ "b4cdd98c6eb9a3946b49a6876c62c7e35501f413", "testharness" ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/aborted-parser-async-frame.html": [ + "38be68cf85bbe4cef461963768fe1390733d67db", + "support" + ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/aborted-parser-frame.html": [ + "4cb26a783d232652a580e511e439b8bfaac04dfe", + "support" + ], "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/encoding-frame.html": [ "1d8ae9f75fe05343c1858caad637c9f7602c9f28", "support" diff --git a/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.js b/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.js new file mode 100644 index 000000000000..1d94de8a7c9f --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.js @@ -0,0 +1,28 @@ +// document.open() bails out early if there is an **active parser** with +// non-zero script nesting level. window.stop() aborts the current parser and +// makes it no longer active, and should allow document.open() to work. +// For more details, see https://bugzilla.mozilla.org/show_bug.cgi?id=1475000. + +window.handlers = {}; + +async_test(t => { + const frame = document.body.appendChild(document.createElement("iframe")); + frame.src = "resources/aborted-parser-frame.html"; + window.handlers.afterOpen = t.step_func_done(() => { + const openCalled = frame.contentDocument.childNodes.length === 0; + frame.remove(); + assert_true(openCalled, "child document should be empty"); + }); +}, "document.open() after parser is aborted"); + +// Note: This test should pass even if window.close() is not there, as +// document.open() is not executed synchronously in an inline script. +async_test(t => { + const frame = document.body.appendChild(document.createElement("iframe")); + frame.src = "resources/aborted-parser-async-frame.html"; + window.handlers.afterOpenAsync = t.step_func_done(() => { + const openCalled = frame.contentDocument.childNodes.length === 0; + frame.remove(); + assert_true(openCalled, "child document should be empty"); + }); +}, "async document.open() after parser is aborted"); diff --git a/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/aborted-parser-async-frame.html b/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/aborted-parser-async-frame.html new file mode 100644 index 000000000000..d5535630be05 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/aborted-parser-async-frame.html @@ -0,0 +1,9 @@ + +
Text
+ diff --git a/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/aborted-parser-frame.html b/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/aborted-parser-frame.html new file mode 100644 index 000000000000..d9ec23590bf9 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/aborted-parser-frame.html @@ -0,0 +1,7 @@ + +Text
+