3 <title>Test case for bug
40952</title>
6 <p> Test case for
<a href=
"https://bugs.webkit.org/show_bug.cgi?id=40952"> bug
40952</a>: Onloadend event is not supported in XMLHttpRequest
</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 when a synchronous request completes normally.
</p>
9 <p>PASS PASS PASS should appear below:
</p>
11 <script type=
"text/javascript">
12 if (window
.testRunner
) {
13 testRunner
.dumpAsText();
14 testRunner
.waitUntilDone();
19 var consoleElt
= document
.getElementById("console");
20 consoleElt
.appendChild(document
.createTextNode(message
+ " "));
23 var xhr
= new XMLHttpRequest();
26 function logProgressEvent(e
) {
27 results
+= " " + e
.type
;
30 function logUnexpectedProgressEvent(e
) {
31 results
+= " [unexpected ProgressEvent: " + e
.type
+ "]";
35 function completeTest(expected
)
37 log(results
== expected
? "PASS" : "FAILED results : '" + results
+ "', expected : '" + expected
+ "'");
38 if (window
.testRunner
)
39 testRunner
.notifyDone();
46 xhr
.onloadstart
= logUnexpectedProgressEvent
;
47 xhr
.onabort
= logUnexpectedProgressEvent
;
48 xhr
.onerror
= logUnexpectedProgressEvent
;
49 xhr
.onload
= logProgressEvent
;
50 xhr
.onloadend
= logProgressEvent
;
52 xhr
.open("GET", "resources/get.txt", false);
55 completeTest(" load loadend");
62 xhr
.onloadstart
= logUnexpectedProgressEvent
;
63 xhr
.onabort
= logUnexpectedProgressEvent
;
64 xhr
.onerror
= logUnexpectedProgressEvent
;
65 xhr
.onload
= logUnexpectedProgressEvent
;
66 xhr
.onloadend
= logUnexpectedProgressEvent
;
68 xhr
.open("GET", "resources/infinite-loop.php", false);
73 if (e
.code
!= e
.NETWORK_ERR
)
84 xhr
.onloadstart
= logUnexpectedProgressEvent
;
85 xhr
.onabort
= logUnexpectedProgressEvent
;
86 xhr
.onerror
= logUnexpectedProgressEvent
;
87 xhr
.onload
= logUnexpectedProgressEvent
;
88 xhr
.onloadend
= logProgressEvent
;
89 xhr
.onreadystatechange = function(e
) {
90 if (xhr
.readyState
== xhr
.DONE
)
94 xhr
.open("GET", "resources/get.txt", false);
99 if (e
.code
!= e
.NETWORK_ERR
)