OLD | NEW |
1 <HTML> | 1 <HTML> |
2 <head> | 2 <head> |
3 <title>Test case for bug 40952</title> | 3 <title>Test case for bug 40952</title> |
4 </head> | 4 </head> |
5 <body> | 5 <body> |
6 <p> Test case for <a href="https://bugs.webkit.org/show_bug.cgi?id=40952"> bug 4
0952</a>: Onloadend event is not supported in XMLHttpRequest</p> | 6 <p> Test case for <a href="https://bugs.webkit.org/show_bug.cgi?id=40952"> bug 4
0952</a>: Onloadend event is not supported in XMLHttpRequest</p> |
7 <p> Verify that a loadend ProgressEvent is dispatched after the load or abort Pr
ogressEvent when a synchronous upload request completes normally or is aborted.<
/p> | 7 <p> Verify that a loadend ProgressEvent is dispatched after load ProgressEvent w
hen a synchronous upload request completes normally.<br/> |
| 8 Verify that a loadend ProgressEvent is not dispatched after abort() is called on
completed request.</p> |
8 <p>PASS PASS should appear below:</p> | 9 <p>PASS PASS should appear below:</p> |
9 <p id=console></p> | 10 <p id=console></p> |
10 <script type="text/javascript"> | 11 <script type="text/javascript"> |
11 if (window.testRunner) { | 12 if (window.testRunner) { |
12 testRunner.dumpAsText(); | 13 testRunner.dumpAsText(); |
13 testRunner.waitUntilDone(); | 14 testRunner.waitUntilDone(); |
14 } | 15 } |
15 | 16 |
16 function log(message) | 17 function log(message) |
17 { | 18 { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 xhr.send("data"); | 53 xhr.send("data"); |
53 | 54 |
54 completeTest(" load loadend"); | 55 completeTest(" load loadend"); |
55 } | 56 } |
56 | 57 |
57 function testAbort() | 58 function testAbort() |
58 { | 59 { |
59 results = ""; | 60 results = ""; |
60 | 61 |
61 xhr.onloadstart = logUnexpectedProgressEvent; | 62 xhr.onloadstart = logUnexpectedProgressEvent; |
62 xhr.onabort = logProgressEvent; | 63 xhr.onabort = logUnexpectedProgressEvent; |
63 xhr.onerror = logUnexpectedProgressEvent; | 64 xhr.onerror = logUnexpectedProgressEvent; |
64 xhr.onload = logUnexpectedProgressEvent; | 65 xhr.onload = logUnexpectedProgressEvent; |
65 xhr.onloadend = logProgressEvent; | 66 xhr.onloadend = logProgressEvent; |
66 xhr.onreadystatechange = function(e) { | 67 xhr.onreadystatechange = function(e) { |
67 if (xhr.readyState == xhr.DONE) | 68 if (xhr.readyState == xhr.DONE) |
68 xhr.abort(); | 69 xhr.abort(); |
69 } | 70 } |
70 | 71 |
71 xhr.open("POST", "resources/get.txt", false); | 72 xhr.open("POST", "resources/get.txt", false); |
72 try { | 73 try { |
73 xhr.send(); | 74 xhr.send(); |
74 } | 75 } |
75 catch (e) { | 76 catch (e) { |
76 if (e.code != e.NETWORK_ERR) | 77 if (e.code != e.NETWORK_ERR) |
77 results += " " + e; | 78 results += " " + e; |
78 } | 79 } |
79 | 80 |
80 completeTest(" abort loadend"); | 81 completeTest(""); |
81 } | 82 } |
82 | 83 |
83 testNormal(); | 84 testNormal(); |
84 testAbort(); | 85 testAbort(); |
85 | 86 |
86 </script> | 87 </script> |
87 </body> | 88 </body> |
OLD | NEW |