tor-browser

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

test_bug1706090.html (1592B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <meta charset="utf-8">
      5  <title>Bug 1706090</title>
      6  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      7  <link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
      8  <script>
      9  SimpleTest.waitForExplicitFinish();
     10 
     11  var bc = new BroadcastChannel("bug1706090");
     12  var pageshowCount = 0;
     13  bc.onmessage = function(event) {
     14    if (event.data.type == "pageshow") {
     15      ++pageshowCount;
     16      if (pageshowCount == 1) {
     17        is(event.data.persisted, false, "Shouldn't have persisted the initial load.");
     18        bc.postMessage("sameOrigin");
     19      } else if (pageshowCount == 2) {
     20        bc.postMessage("back");
     21      } else if (pageshowCount == 3) {
     22        is(event.data.persisted, false, "Shouldn't have persisted same origin load.");
     23        bc.postMessage("crossOrigin");
     24      } else if (pageshowCount == 4) {
     25        is(event.data.persisted, true, "Should have persisted cross origin load.");
     26        bc.postMessage("sameSite");
     27      } else if (pageshowCount == 5) {
     28        is(event.data.persisted, false, "Shouldn't have persisted same site load.");
     29        bc.postMessage("close");
     30      }
     31    } else if (event.data == "closed") {
     32      bc.close();
     33      SimpleTest.finish();
     34    }
     35  };
     36 
     37  function runTest() {
     38    SpecialPowers.pushPrefEnv({set: [["docshell.shistory.bfcache.allow_unload_listeners", true]]}, () => {
     39      window.open("file_bug1706090.html", "", "noopener");
     40    });
     41  }
     42  </script>
     43 </head>
     44 <body onload="runTest()">
     45 <p id="display"></p>
     46 <div id="content" style="display: none"></div>
     47 <pre id="test"></pre>
     48 </body>
     49 </html>