tor-browser

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

file_bug1300461_back.html (1467B)


      1 <!DOCTYPE html>
      2 <html lang="en">
      3  <head>
      4    <meta http-equiv="content-type" content="text/html; charset=utf-8">
      5    <title>Bug 1300461</title>
      6  </head>
      7  <!-- The empty unload handler is to prevent bfcache. -->
      8  <body onload="test();" onunload="">
      9    <script>
     10      let Ci = SpecialPowers.Ci;
     11      let webNav = SpecialPowers.wrap(window)
     12                                .docShell
     13                                .QueryInterface(Ci.nsIWebNavigation);
     14      let shistory = webNav.sessionHistory;
     15      async function test() {
     16        if (opener) {
     17          opener.info("file_bug1300461_back.html");
     18          opener.is(shistory.count, 2, "check history length");
     19          opener.is(shistory.index, 1, "check history index");
     20          if (!SpecialPowers.Services.appinfo.sessionHistoryInParent) {
     21            opener.is(shistory.legacySHistory.requestedIndex, -1, "check requestedIndex");
     22          } else {
     23            let index = await opener.getSHRequestedIndex(SpecialPowers.wrap(window).browsingContext.id);
     24            opener.is(index, -1, "check requestedIndex");
     25          }
     26 
     27          opener.ok(webNav.canGoBackIgnoringUserInteraction, "check canGoBackIgnoringUserInteraction");
     28          if (opener.testCount == 1) {
     29            opener.info("replaceState to redirect.html");
     30            window.history.replaceState({}, "", "file_bug1300461_redirect.html");
     31          }
     32          window.history.back();
     33        }
     34      }
     35    </script>
     36  </body>
     37 </html>