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 the error ProgressEvent when an async request fails.
</p>
8 <p>PASS should appear below:
</p>
10 <script type=
"text/javascript">
11 if (window
.testRunner
) {
12 testRunner
.dumpAsText();
13 testRunner
.waitUntilDone();
18 var consoleElt
= document
.getElementById("console");
19 consoleElt
.appendChild(document
.createTextNode(message
));
22 var xhr
= new XMLHttpRequest();
24 var expected
= " loadstart readyState=DONE error loadend";
27 function logProgressEvent(e
) {
28 results
+= " " + e
.type
;
31 function logUnexpectedProgressEvent(e
) {
32 results
+= " [unexpected ProgressEvent: " + e
.type
+ "]";
36 function completeTest()
38 log(results
== expected
? "PASS" : "FAILED results : '" + results
+ "', expected : '" + expected
+ "'");
39 if (window
.testRunner
)
40 testRunner
.notifyDone();
45 xhr
.onreadystatechange = function(e
) {
46 if (xhr
.readyState
== xhr
.DONE
)
47 results
+= " readyState=DONE";
49 xhr
.onloadstart
= logProgressEvent
;
50 xhr
.onabort
= logUnexpectedProgressEvent
;
51 xhr
.onerror
= logProgressEvent
;
52 xhr
.onload
= logUnexpectedProgressEvent
;
53 xhr
.onloadend = function(e
) {
58 xhr
.open("GET", "resources/infinite-loop.php", true);