tor-browser

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

bailout-side-effects-ignore-opens-during-unload.window.js (1017B)


      1 // META: script=resources/document-open-side-effects.js
      2 
      3 for (const ev of ["unload", "beforeunload", "pagehide"]) {
      4  async_test(t => {
      5    const iframe = document.body.appendChild(document.createElement("iframe"));
      6    t.add_cleanup(() => iframe.remove());
      7    iframe.src = "/common/blank.html";
      8    iframe.onload = t.step_func(() => {
      9      iframe.contentWindow.addEventListener(ev, t.step_func_done(() => {
     10        const origURL = iframe.contentDocument.URL;
     11        assertDocumentIsReadyForSideEffectsTest(iframe.contentDocument, `ignore-opens-during-unload counter is greater than 0 during ${ev} event`);
     12        assert_equals(iframe.contentDocument.open(), iframe.contentDocument);
     13        assertOpenHasNoSideEffects(iframe.contentDocument, origURL, `ignore-opens-during-unload counter is greater than 0 during ${ev} event`);
     14      }));
     15      iframe.src = "about:blank";
     16    });
     17  }, `document.open bailout should not have any side effects (ignore-opens-during-unload is greater than 0 during ${ev} event)`);
     18 }