tor-browser

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

test_bug1300461.html (1983B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=
      5 -->
      6 <head>
      7  <title>Test for Bug 1300461</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     10 </head>
     11 <body onload="runTest()">
     12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1300461">Mozilla Bug 1300461</a>
     13 <p id="display"></p>
     14 <div id="content" style="display: none">
     15 
     16 </div>
     17 <pre id="test">
     18  <script type="application/javascript">
     19 
     20    let chromeScript = null;
     21    if (SpecialPowers.Services.appinfo.sessionHistoryInParent) {
     22      chromeScript = SpecialPowers.loadChromeScript(() => {
     23        /* eslint-env mozilla/chrome-script */
     24        function doSend(message, fn) {
     25          try {
     26            sendAsyncMessage(message, {success: true, value: fn()});
     27          } catch(_) {
     28            sendAsyncMessage(message, {success: false});
     29          }
     30        }
     31 
     32        addMessageListener("requestedIndex", (id) => {
     33          doSend("requestedIndex", () => {
     34            let shistory = BrowsingContext.get(id).top.sessionHistory;
     35            return shistory.requestedIndex;
     36          })
     37        });
     38      });
     39    }
     40 
     41    async function getSHRequestedIndex(browsingContextId) {
     42      let p = chromeScript.promiseOneMessage("requestedIndex");
     43      chromeScript.sendAsyncMessage("requestedIndex", browsingContextId);
     44      let result = await p;
     45      ok(result.success, "Got requested index from parent");
     46      return result.value;
     47    }
     48 
     49    var testCount = 0;
     50 
     51    SimpleTest.waitForExplicitFinish();
     52 
     53    var testWindow;
     54    function runTest() {
     55      testWindow = window.open("file_bug1300461.html", "", "width=360,height=480");
     56      testWindow.onunload = function() { }; // to prevent bfcache
     57    }
     58 
     59    function finishTest() {
     60      if (chromeScript) {
     61        chromeScript.destroy();
     62      }
     63      testWindow.close();
     64      SimpleTest.finish();
     65    }
     66 
     67  </script>
     68 </pre>
     69 </body>
     70 </html>