4 <link rel=
"help" href=
"http://www.w3.org/TR/2012/WD-XMLHttpRequest-20121206/#request-error"/>
5 <script src=
"/js-test-resources/js-test.js"></script>
9 description("Test to validate the order in which the events are fired in case of a request error.");
10 window
.jsTestIsAsync
= true;
12 expectedOrder
= "rsdone,upload.onerror,upload.onloadend,onerror,onloadend,";
15 var xhr
= new XMLHttpRequest();
16 xhr
.open("POST", "http://localhost:8000/xmlhttprequest/resources/cross-site-progress-events.cgi", true);
17 xhr
.setRequestHeader("Content-Type", "text/plain");
19 xhr
.onreadystatechange = function () {
20 if (xhr
.readyState
== XMLHttpRequest
.DONE
) {
21 actualOrder
+= "rsdone,";
24 xhr
.upload
.onerror = function (evt
) {
25 actualOrder
+= "upload.onerror,";
27 xhr
.upload
.onloadend = function () {
28 actualOrder
+= "upload.onloadend,";
30 xhr
.onerror = function (evt
) {
31 actualOrder
+= "onerror,";
33 xhr
.onloadend = function () {
34 actualOrder
+= "onloadend,";
35 shouldBeEqualToString('actualOrder', '' + expectedOrder
);