tor-browser

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

opened-window.html (878B)


      1 <!DOCTYPE html>
      2 <script src="/resources/testharness.js"></script>
      3 
      4 <body onload="run()">
      5  <a id="link" href="?post-nav">link</a>
      6 </body>
      7 
      8 <script>
      9  'use strict';
     10  const post_nav_page = location.search.substring(1) === "post-nav";
     11 
     12  function sendActivationStateToOpener(msg_type) {
     13    window.opener.postMessage(JSON.stringify({
     14        "type": msg_type,
     15        "isActive": navigator.userActivation.isActive,
     16        "hasBeenActive": navigator.userActivation.hasBeenActive
     17    }), "*");
     18  }
     19 
     20  document.getElementById("link").addEventListener("click", () => {
     21    assert_false(post_nav_page, "No click in the post-navigation page");
     22    sendActivationStateToOpener("link-clicked");
     23  });
     24 
     25  function run() {
     26    if (!post_nav_page) {
     27      sendActivationStateToOpener("window-opened");
     28    } else {
     29      sendActivationStateToOpener("window-navigated");
     30    }
     31  }
     32 </script>