| 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 a load or abort Prog
ressEvent when a synchronous request completes normally or is aborted respective
ly.</p> | 7 <p> Verify that a loadend ProgressEvent is dispatched after a load ProgressEvent
when a synchronous request completes normally.<br/> |
| 8 Verify that a loadend ProgressEvent is not dispatched after abort() is called wh
en a synchronous request completes normally.</p> |
| 8 <p>PASS PASS PASS should appear below:</p> | 9 <p>PASS 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 75 } |
| 75 | 76 |
| 76 completeTest(""); | 77 completeTest(""); |
| 77 } | 78 } |
| 78 | 79 |
| 79 function testAbort() | 80 function testAbort() |
| 80 { | 81 { |
| 81 results = ""; | 82 results = ""; |
| 82 | 83 |
| 83 xhr.onloadstart = logUnexpectedProgressEvent; | 84 xhr.onloadstart = logUnexpectedProgressEvent; |
| 84 xhr.onabort = logProgressEvent; | 85 xhr.onabort = logUnexpectedProgressEvent; |
| 85 xhr.onerror = logUnexpectedProgressEvent; | 86 xhr.onerror = logUnexpectedProgressEvent; |
| 86 xhr.onload = logUnexpectedProgressEvent; | 87 xhr.onload = logUnexpectedProgressEvent; |
| 87 xhr.onloadend = logProgressEvent; | 88 xhr.onloadend = logProgressEvent; |
| 88 xhr.onreadystatechange = function(e) { | 89 xhr.onreadystatechange = function(e) { |
| 89 if (xhr.readyState == xhr.DONE) | 90 if (xhr.readyState == xhr.DONE) |
| 90 xhr.abort(); | 91 xhr.abort(); |
| 91 } | 92 } |
| 92 | 93 |
| 93 xhr.open("GET", "resources/get.txt", false); | 94 xhr.open("GET", "resources/get.txt", false); |
| 94 try { | 95 try { |
| 95 xhr.send(); | 96 xhr.send(); |
| 96 } | 97 } |
| 97 catch (e) { | 98 catch (e) { |
| 98 if (e.code != e.NETWORK_ERR) | 99 if (e.code != e.NETWORK_ERR) |
| 99 results += " " + e; | 100 results += " " + e; |
| 100 } | 101 } |
| 101 | 102 |
| 102 completeTest(" abort loadend"); | 103 completeTest(""); |
| 103 } | 104 } |
| 104 | 105 |
| 105 testNormal(); | 106 testNormal(); |
| 106 testError(); | 107 testError(); |
| 107 testAbort(); | 108 testAbort(); |
| 108 | 109 |
| 109 </script> | 110 </script> |
| 110 </body> | 111 </body> |
| OLD | NEW |