Index: LayoutTests/http/tests/xmlhttprequest/upload-request-error-event-order.html |
diff --git a/LayoutTests/http/tests/xmlhttprequest/upload-request-error-event-order.html b/LayoutTests/http/tests/xmlhttprequest/upload-request-error-event-order.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3e11b5a9bf1da31b640f0f53239320bf16a64944 |
--- /dev/null |
+++ b/LayoutTests/http/tests/xmlhttprequest/upload-request-error-event-order.html |
@@ -0,0 +1,44 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<link rel="help" href="http://www.w3.org/TR/2012/WD-XMLHttpRequest-20121206/#request-error"/> |
+<script src="../resources/js-test-pre.js"></script> |
+</head> |
+<body> |
+<script> |
+description("Test to validate the order in which the events are fired in case of a request error."); |
+window.jsTestIsAsync = true; |
+ |
+expectedOrder = "rsdone,upload.onerror,upload.onloadend,onerror,onloadend,"; |
+actualOrder = ""; |
+ |
+var xhr = new XMLHttpRequest(); |
+xhr.open("POST", "http://localhost:8000/xmlhttprequest/resources/cross-site-progress-events.cgi", true); |
+xhr.setRequestHeader("Content-Type", "text/plain"); |
+ |
+xhr.onreadystatechange = function () { |
+ if (xhr.readyState == XMLHttpRequest.DONE) { |
+ actualOrder += "rsdone,"; |
+ } |
+}; |
+xhr.upload.onerror = function (evt) { |
+ actualOrder += "upload.onerror,"; |
+}; |
+xhr.upload.onloadend = function () { |
+ actualOrder += "upload.onloadend,"; |
+}; |
+xhr.onerror = function (evt) { |
+ actualOrder += "onerror,"; |
+}; |
+xhr.onloadend = function () { |
+ actualOrder += "onloadend,"; |
+ shouldBeEqualToString('actualOrder', '' + expectedOrder); |
+ finishJSTest(); |
+}; |
+ |
+xhr.send("test"); |
+ |
+</script> |
+<script src="../resources/js-test-post.js"></script> |
+</body> |
+</html> |