tor-browser

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

test_close_onpagehide_by_window_close.html (730B)


      1 <!doctype html>
      2 <title>Test for closing window in pagehide event callback caused by window.close()</title>
      3 <script src="/tests/SimpleTest/SimpleTest.js"></script>
      4 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
      5 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1432396">Mozilla Bug 1432396</a>
      6 <p id="display"></p>
      7 <script>
      8 SimpleTest.waitForExplicitFinish();
      9 
     10 const w = window.open("file_close_onpagehide1.html");
     11 window.addEventListener("message", e => {
     12  is(e.data, "initial", "The initial page loaded");
     13  w.onpagehide = () => {
     14    w.close();
     15    info("try to close the popped up window in onpagehide");
     16    SimpleTest.finish();
     17  };
     18  w.close();
     19 }, { once: true });
     20 </script>