summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/xhr/abort-after-stop.window.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/xhr/abort-after-stop.window.js')
-rw-r--r--testing/web-platform/tests/xhr/abort-after-stop.window.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/testing/web-platform/tests/xhr/abort-after-stop.window.js b/testing/web-platform/tests/xhr/abort-after-stop.window.js
new file mode 100644
index 0000000000..a254648f41
--- /dev/null
+++ b/testing/web-platform/tests/xhr/abort-after-stop.window.js
@@ -0,0 +1,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;
+ });