tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

navigation-unload-javascript-url.window.js (536B)


      1 // META: title=javascript: URL navigation started from unload handler must be ignored
      2 // META: script=../resources/helpers.js
      3 
      4 promise_test(async () => {
      5  const iframe = await addIframe();
      6 
      7  iframe.contentWindow.addEventListener("unload", () => {
      8    iframe.contentWindow.location.href =
      9      `javascript:"unload<script>parent.postMessage('fail', '*');</script>"`;
     10  });
     11 
     12  iframe.src =
     13    `javascript:"load<script>parent.postMessage('pass', '*')</script>"`;
     14  assert_equals(await waitForMessage(iframe.contentWindow), "pass");
     15 });