summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-javascript-url.window.js
blob: abbcb888a0add3a707159c44cf21e48bc3a9e748 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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");
});