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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!doctype html>
2 <html>
3 <head>
4 <title>XMLHttpRequest: calling abort() during onloadstart should not fail</title >
5 <script src="../resources/testharness.js"></script>
6 <script src="../resources/testharnessreport.js"></script>
7 </head>
8 <body>
9 <script>
10 var testAsync = async_test("Aborting during onloadstart");
11 testAsync.step(() => {
12 var xhr = new XMLHttpRequest();
13 xhr.open("POST", "resources/delay.php?iteration=1&delay=1000");
14 xhr.onloadstart = testAsync.step_func(() => {
15 assert_equals(xhr.readyState, XMLHttpRequest.OPENED);
16 xhr.abort();
17 });
18 xhr.onload = testAsync.step_func(() => {
19 assert_unreached("The aborted send() shouldn't go ahead, and complete.") ;
20 });
21 xhr.onabort = testAsync.step_func(() => {
22 testAsync.done();
23 });
24 xhr.send();
25 });
26
27 var testAsyncUpload = async_test("Aborting during upload.onloadstart");
28 testAsyncUpload.step(() => {
29 var xhr = new XMLHttpRequest();
30 xhr.open("POST", "resources/delay.php?iteration=1&delay=1000");
31 xhr.upload.onloadstart = testAsyncUpload.step_func(() => {
32 assert_equals(xhr.readyState, XMLHttpRequest.OPENED);
33 xhr.abort();
34 });
35 xhr.onload = testAsyncUpload.step_func(() => {
36 assert_unreached("The aborted send() shouldn't go ahead, and complete.") ;
37 });
38 xhr.onabort = testAsyncUpload.step_func(() => {
39 testAsyncUpload.done();
40 });
41 xhr.send("Uploaded");
42 });
43
44 var testAsyncResend = async_test("Resending during onloadstart");
45 testAsyncResend.step(() => {
46 var xhr = new XMLHttpRequest();
47 xhr.open("POST", "resources/delay.php?iteration=1&delay=1000");
48 xhr.onloadstart = testAsyncResend.step_func(() => {
49 assert_equals(xhr.readyState, XMLHttpRequest.OPENED);
50 xhr.open("POST", "resources/delay.php?iteration=1&delay=1000");
51 xhr.send();
52 });
53 xhr.onload = testAsyncResend.step_func(() => {
54 assert_equals(xhr.readyState, XMLHttpRequest.DONE);
55 testAsyncResend.done();
56 });
57 xhr.send();
58 });
59 </script>
60 </body>
61 </html>
OLDNEW
« 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