summaryrefslogtreecommitdiffstats
path: root/dom/xhr/tests/file_sync_xhr_nested_helper.html
blob: 9f69344535ed9629692d0c914a8e6aca94dd153c (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
<!DOCTYPE HTML>
<html>
  <body>
    <input />
    <script>
      const input = document.querySelector("input");
      input.addEventListener("keydown", function() {
        window.opener.receivedInput();
        window.close();
      });

      function startSlowXHR() {
        setTimeout(function() {
          input.focus();
          SpecialPowers.loadChromeScript(() => {
            /* eslint-env mozilla/chrome-script */
            const { EventUtils } = ChromeUtils.import(
              "resource://specialpowers/SpecialPowersEventUtils.jsm"
            );
            var win = Services.wm.getMostRecentBrowserWindow();
            EventUtils.synthesizeKey("a", {}, win);
          });

          var xhr = new XMLHttpRequest();
          xhr.open("GET", "slow.sjs", false);
          xhr.send(null);
          window.opener.childXHRFinished = true;
        }, 0);
      }

    </script>
  </body>
</html>