summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-data-url.window.js
blob: cf39b01107f4c58164e80a2708be67809c6251fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// META: title=data: 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 =
      `data:text/html,unload<script>parent.postMessage('fail', '*');</script>`;
  });

  iframe.src =
    `data:text/html,load<script>parent.postMessage('pass', '*')</script>`;
  assert_equals(await waitForMessage(iframe.contentWindow), "pass");
});