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 abort ProgressEvent when an async request is aborted.
</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 abort loadend";
26 function logProgressEvent(e
) {
27 results
+= " " + e
.type
;
30 function logUnexpectedProgressEvent(e
) {
31 results
+= " [unexpected ProgressEvent: " + e
.type
+ "]";
35 function completeTest()
37 log(results
== expected
? "PASS" : "FAILED results : '" + results
+ "', expected : '" + expected
+ "'");
38 if (window
.testRunner
)
39 testRunner
.notifyDone();
44 xhr
.onreadystatechange = function(e
) {
45 if (xhr
.readyState
== xhr
.DONE
)
46 results
+= " readyState=DONE";
47 else if (xhr
.readyState
> xhr
.OPENED
)
50 xhr
.onloadstart
= logProgressEvent
;
51 xhr
.onabort
= logProgressEvent
;
52 xhr
.onerror
= logUnexpectedProgressEvent
;
53 xhr
.onload
= logUnexpectedProgressEvent
;
54 xhr
.onloadend = function(e
) {
59 xhr
.open("GET", "resources/get.txt", true);