summaryrefslogtreecommitdiffstats
path: root/dom/xhr/tests/file_sync_xhr_nested_helper.html
blob: 9b25a4453bab14a767d2fed2758298ecb7b4dcfa (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
<!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 */
            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>