summaryrefslogtreecommitdiffstats
path: root/dom/xhr/tests/file_sync_xhr_event_handling_helper.html
blob: d1235328f69d38e3b9672d1ee8737b1ce6514eb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE HTML>
<html>
  <body>
    <input>
    <script>
      const input = document.querySelector("input");
      var count = 0;
      input.addEventListener("keydown", function() {
        ++count;
      });
      input.addEventListener("keyup", function() {
        ++count;
        if (count == 6) {
          window.opener.receivedAllEvents = true;
          window.close();
        }
      });

      input.focus();

      window.opener.startSlowXHR();

      function triggerKeys() {
        // Use loadChromeScript to run the script in the parent process
        // so that we can dispatch key event in the parent to test
        // InputTaskManager properly
        SpecialPowers.loadChromeScript(() => {
          /* eslint-env mozilla/chrome-script */
          var win = Services.wm.getMostRecentBrowserWindow();
          EventUtils.synthesizeKey("a", {}, win);
          EventUtils.synthesizeKey("b", {}, win);
          EventUtils.synthesizeKey("c", {}, win);
        });
      }
    </script>
  </body>
</html>