summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/xhr/abort-after-stop.window.js
blob: a254648f419242f4939b4561e7720c6085f13b4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// META: title=XMLHttpRequest: abort event should fire when stop() method is used

      var test = async_test();
      window.onload = test.step_func(function() {
        var client = new XMLHttpRequest();
        var abortFired = false;
        var sync = true;
        client.onabort = test.step_func(function (e) {
          assert_false(sync);
          assert_equals(e.type, 'abort');
          assert_equals(client.status, 0);
          abortFired = true;
        });
        client.open("GET", "resources/delay.py?ms=3000", true);
        client.send(null);
        test.step_timeout(() => {
          assert_equals(abortFired, true);
          test.done();
        }, 200);
        window.stop();
        sync = false;
      });