tor-browser

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

file_sync_xhr_event_handling_helper.html (1028B)


      1 <!DOCTYPE HTML>
      2 <html>
      3  <body>
      4    <input>
      5    <script>
      6      const input = document.querySelector("input");
      7      var count = 0;
      8      input.addEventListener("keydown", function() {
      9        ++count;
     10      });
     11      input.addEventListener("keyup", function() {
     12        ++count;
     13        if (count == 6) {
     14          window.opener.receivedAllEvents = true;
     15          window.close();
     16        }
     17      });
     18 
     19      input.focus();
     20 
     21      window.opener.startSlowXHR();
     22 
     23      function triggerKeys() {
     24        // Use loadChromeScript to run the script in the parent process
     25        // so that we can dispatch key event in the parent to test
     26        // InputTaskManager properly
     27        SpecialPowers.loadChromeScript(() => {
     28          /* eslint-env mozilla/chrome-script */
     29          var win = Services.wm.getMostRecentBrowserWindow();
     30          EventUtils.synthesizeKey("a", {}, win);
     31          EventUtils.synthesizeKey("b", {}, win);
     32          EventUtils.synthesizeKey("c", {}, win);
     33        });
     34      }
     35    </script>
     36  </body>
     37 </html>