diff options
Diffstat (limited to 'testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-javascript-url.window.js')
-rw-r--r-- | testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-javascript-url.window.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-javascript-url.window.js b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-javascript-url.window.js new file mode 100644 index 0000000000..abbcb888a0 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-javascript-url.window.js @@ -0,0 +1,15 @@ +// META: title=javascript: URL navigation started from unload handler must be ignored +// META: script=../resources/helpers.js + +promise_test(async () => { + const iframe = await addIframe(); + + iframe.contentWindow.addEventListener("unload", () => { + iframe.contentWindow.location.href = + `javascript:"unload<script>parent.postMessage('fail', '*');</script>"`; + }); + + iframe.src = + `javascript:"load<script>parent.postMessage('pass', '*')</script>"`; + assert_equals(await waitForMessage(iframe.contentWindow), "pass"); +}); |