OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <link rel="help" href="http://www.w3.org/TR/2012/WD-XMLHttpRequest-20121206/#req
uest-error"/> |
| 5 <script src="../resources/js-test-pre.js"></script> |
| 6 </head> |
| 7 <body> |
| 8 <script> |
| 9 description("Test to validate the order in which the events are fired in case of
a request error."); |
| 10 window.jsTestIsAsync = true; |
| 11 |
| 12 expectedOrder = "rsdone,upload.onerror,upload.onloadend,onerror,onloadend,"; |
| 13 actualOrder = ""; |
| 14 |
| 15 var xhr = new XMLHttpRequest(); |
| 16 xhr.open("POST", "http://localhost:8000/xmlhttprequest/resources/cross-site-prog
ress-events.cgi", true); |
| 17 xhr.setRequestHeader("Content-Type", "text/plain"); |
| 18 |
| 19 xhr.onreadystatechange = function () { |
| 20 if (xhr.readyState == XMLHttpRequest.DONE) { |
| 21 actualOrder += "rsdone,"; |
| 22 } |
| 23 }; |
| 24 xhr.upload.onerror = function (evt) { |
| 25 actualOrder += "upload.onerror,"; |
| 26 }; |
| 27 xhr.upload.onloadend = function () { |
| 28 actualOrder += "upload.onloadend,"; |
| 29 }; |
| 30 xhr.onerror = function (evt) { |
| 31 actualOrder += "onerror,"; |
| 32 }; |
| 33 xhr.onloadend = function () { |
| 34 actualOrder += "onloadend,"; |
| 35 shouldBeEqualToString('actualOrder', '' + expectedOrder); |
| 36 finishJSTest(); |
| 37 }; |
| 38 |
| 39 xhr.send("test"); |
| 40 |
| 41 </script> |
| 42 <script src="../resources/js-test-post.js"></script> |
| 43 </body> |
| 44 </html> |
OLD | NEW |