Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

  • This test has a WPT meta file that expects 1 subtest issues.
  • This WPT test may be referenced by the following Test IDs:
    • /html/webappapis/dynamic-markup-insertion/opening-the-input-stream/bailout-side-effects-ignore-opens-during-unload.window.html - WPT Dashboard Interop Dashboard
// META: script=resources/document-open-side-effects.js
for (const ev of ["unload", "beforeunload", "pagehide"]) {
async_test(t => {
const iframe = document.body.appendChild(document.createElement("iframe"));
t.add_cleanup(() => iframe.remove());
iframe.src = "/common/blank.html";
iframe.onload = t.step_func(() => {
iframe.contentWindow.addEventListener(ev, t.step_func_done(() => {
const origURL = iframe.contentDocument.URL;
assertDocumentIsReadyForSideEffectsTest(iframe.contentDocument, `ignore-opens-during-unload counter is greater than 0 during ${ev} event`);
assert_equals(iframe.contentDocument.open(), iframe.contentDocument);
assertOpenHasNoSideEffects(iframe.contentDocument, origURL, `ignore-opens-during-unload counter is greater than 0 during ${ev} event`);
}));
iframe.src = "about:blank";
});
}, `document.open bailout should not have any side effects (ignore-opens-during-unload is greater than 0 during ${ev} event)`);
}