tor-browser

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

file_docshell_gotoindex.html (1414B)


      1 <html>
      2  <head>
      3    <script>
      4    function loaded() {
      5      if (location.search == "") {
      6        if (opener.loadedInitialPage) {
      7          opener.ok(true, "got back to the initial page.");
      8          opener.setTimeout("SimpleTest.finish();");
      9          window.close();
     10          return;
     11        }
     12        opener.loadedInitialPage = true;
     13        opener.info("Loaded initial page.");
     14        // Load another page (which is this same document, but different URL.)
     15        location.href = location.href + "?anotherPage";
     16      } else {
     17        opener.info("Loaded the second page.");
     18        location.hash = "1";
     19        window.onhashchange = function() {
     20          opener.info("hash: " + location.hash);
     21          location.hash = "2";
     22          window.onhashchange = function() {
     23            opener.info("hash: " + location.hash);
     24            var docShell = SpecialPowers.wrap(window).docShell;
     25            var webNavigation =
     26                SpecialPowers.do_QueryInterface(docShell, "nsIWebNavigation");
     27            webNavigation.gotoIndex(history.length - 2);
     28            window.onhashchange = function() {
     29              opener.info("hash: " + location.hash);
     30              webNavigation.gotoIndex(history.length - 4);
     31            }
     32          }
     33        }
     34      }
     35    }
     36    </script>
     37  </head>
     38  <body onpageshow="setTimeout(loaded)">
     39    <a href="#1" name="1">1</a>
     40    <a href="#2" name="2">2</a>
     41  </body>
     42 </html>