summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/XMLHttpRequest/abort-after-stop.htm
blob: 87e9ebcd853e348c7b27d9b1a10c038bb3d765fd (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
<!doctype html>
<html>
  <head>
    <title>XMLHttpRequest: abort event should fire when stop() method is used</title>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following::dt[3] following::dt[3]/following::dd[1]/p"/>
  </head>
  <body>
    <div id="log"></div>
    <script>
      var test = async_test();
      test.step(function() {
        var client = new XMLHttpRequest();
        var abortFired = false;
        client.onabort = test.step_func(function (e) {
          assert_equals(e.type, 'abort');
          abortFired = true;
        });
        client.open("GET", "resources/delay.py?ms=3000", true);
        client.send(null);
        setTimeout(function(){
          test.step(function(){
            assert_equals(abortFired, true);
            test.done();
          });
        }, 200);
        window.stop();
      });
    </script>
  </body>
</html>