Index: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/onloadstart-abort.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/onloadstart-abort.html b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/onloadstart-abort.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e9bea9c234a1c03ba1d6b40c9226a4f099a2cc2e |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/onloadstart-abort.html |
@@ -0,0 +1,61 @@ |
+<!doctype html> |
+<html> |
+<head> |
+<title>XMLHttpRequest: calling abort() during onloadstart should not fail</title> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+</head> |
+<body> |
+<script> |
+var testAsync = async_test("Aborting during onloadstart"); |
+testAsync.step(() => { |
+ var xhr = new XMLHttpRequest(); |
+ xhr.open("POST", "resources/delay.php?iteration=1&delay=1000"); |
+ xhr.onloadstart = testAsync.step_func(() => { |
+ assert_equals(xhr.readyState, XMLHttpRequest.OPENED); |
+ xhr.abort(); |
+ }); |
+ xhr.onload = testAsync.step_func(() => { |
+ assert_unreached("The aborted send() shouldn't go ahead, and complete."); |
+ }); |
+ xhr.onabort = testAsync.step_func(() => { |
+ testAsync.done(); |
+ }); |
+ xhr.send(); |
+}); |
+ |
+var testAsyncUpload = async_test("Aborting during upload.onloadstart"); |
+testAsyncUpload.step(() => { |
+ var xhr = new XMLHttpRequest(); |
+ xhr.open("POST", "resources/delay.php?iteration=1&delay=1000"); |
+ xhr.upload.onloadstart = testAsyncUpload.step_func(() => { |
+ assert_equals(xhr.readyState, XMLHttpRequest.OPENED); |
+ xhr.abort(); |
+ }); |
+ xhr.onload = testAsyncUpload.step_func(() => { |
+ assert_unreached("The aborted send() shouldn't go ahead, and complete."); |
+ }); |
+ xhr.onabort = testAsyncUpload.step_func(() => { |
+ testAsyncUpload.done(); |
+ }); |
+ xhr.send("Uploaded"); |
+}); |
+ |
+var testAsyncResend = async_test("Resending during onloadstart"); |
+testAsyncResend.step(() => { |
+ var xhr = new XMLHttpRequest(); |
+ xhr.open("POST", "resources/delay.php?iteration=1&delay=1000"); |
+ xhr.onloadstart = testAsyncResend.step_func(() => { |
+ assert_equals(xhr.readyState, XMLHttpRequest.OPENED); |
+ xhr.open("POST", "resources/delay.php?iteration=1&delay=1000"); |
+ xhr.send(); |
+ }); |
+ xhr.onload = testAsyncResend.step_func(() => { |
+ assert_equals(xhr.readyState, XMLHttpRequest.DONE); |
+ testAsyncResend.done(); |
+ }); |
+ xhr.send(); |
+}); |
+</script> |
+</body> |
+</html> |