tor-browser

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

activeelement-after-calling-window-focus-outer-same.sub.html (970B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>Focus test outer document</title>
      4 <iframe allow="focus-without-user-activation" src="https://{{hosts[][www]}}:{{ports[https][0]}}/focus/support/activeelement-after-calling-window-focus-middle.sub.html"></iframe>
      5 <script>
      6 let outerlog = "outerlog:";
      7 
      8 let iframe = document.querySelector("iframe");
      9 window.onmessage = function(e) {
     10  if (e.data == "ready") {
     11    opener.postMessage(e.data, "*");
     12  } else if (e.data == "start") {
     13    window.onfocus = function() {
     14      outerlog += "windowfocus,";
     15    };
     16  } else if (e.data == "focusinnerinput" || e.data == "focusinner" || e.data == "focusmiddle" || e.data == "getlog") {
     17    iframe.contentWindow.postMessage(e.data, "*");
     18  } else if (e.data == "focusouter") {
     19    window.focus();
     20    outerlog += document.activeElement.tagName + ",";
     21  } else {
     22    opener.postMessage(outerlog + e.data, "*");
     23  }
     24 };
     25 
     26 window.onblur = function() {
     27  outerlog += "windowblur,";
     28 };
     29 </script>