tor-browser

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

navigation-unload-data-url.window.js (534B)


      1 // META: title=data: 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      `data:text/html,unload<script>parent.postMessage('fail', '*');</script>`;
     10  });
     11 
     12  iframe.src =
     13    `data:text/html,load<script>parent.postMessage('pass', '*')</script>`;
     14  assert_equals(await waitForMessage(iframe.contentWindow), "pass");
     15 });