tor-browser

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

unload.window.js (1013B)


      1 // In an earlier version of the HTML Standard, document open steps had "unload
      2 // document" as a step. Test that this no longer happens.
      3 
      4 async_test(t => {
      5  const frame = document.body.appendChild(document.createElement("iframe"));
      6  t.add_cleanup(() => frame.remove());
      7  frame.src = "/common/blank.html";
      8  frame.onload = t.step_func(() => {
      9    frame.contentWindow.onpagehide = t.unreached_func("onpagehide got called");
     10    frame.contentDocument.onvisibilitychange = t.unreached_func("onvisibilitychange got called");
     11    frame.contentWindow.onunload = t.unreached_func("onunload got called");
     12    frame.contentDocument.open();
     13    t.step_timeout(t.step_func_done(() => {
     14      // If none of the three events have been fired by this point, we consider
     15      // the test a success. `frame.remove()` above will allow the `load` event
     16      // to be fired on the top-level Window, thus unblocking testharness.
     17    }), 500);
     18  });
     19 }, "document.open(): Do not fire pagehide, visibilitychange, or unload events");