Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/onloadstart-abort.html

Issue 2507773002: XMLHttpRequest: check if 'loadstart' handler cancelled send(). (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698