Index: LayoutTests/http/tests/xmlhttprequest/ontimeout-event-override-after-failure.html |
diff --git a/LayoutTests/http/tests/xmlhttprequest/ontimeout-event-override-after-failure.html b/LayoutTests/http/tests/xmlhttprequest/ontimeout-event-override-after-failure.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..cdb704f2293b360cf23e13cd343555be8fdc86e9 |
--- /dev/null |
+++ b/LayoutTests/http/tests/xmlhttprequest/ontimeout-event-override-after-failure.html |
@@ -0,0 +1,52 @@ |
+<html> |
+<body> |
+<pre id='console'></pre> |
+<script type="text/javascript"> |
+function log(message) |
+{ |
+ document.getElementById('console').appendChild(document.createTextNode(message + "\n")); |
+} |
+ |
+if (window.testRunner) { |
+ testRunner.dumpAsText(); |
+ testRunner.waitUntilDone(); |
+} |
+ |
+(function() { |
+ var xhr = new XMLHttpRequest; |
+ var error = false; |
+ var errorCalled = false; |
+ |
+ function testSuccess() { |
+ if (!error) |
+ log("PASS: Timeout override did not reactivate timer after failure"); |
+ } |
+ |
+ function performAssertions() { |
+ if (!errorCalled) |
+ log("FAIL: error event not dispatched"); |
+ else |
+ testSuccess(); |
+ if (window.testRunner) |
+ testRunner.notifyDone(); |
+ } |
+ |
+ xhr.onerror = function() { |
+ xhr.timeout = 1; |
+ errorCalled = true; |
+ }; |
+ |
+ xhr.ontimeout = function() { |
+ error = true; |
+ log("FAIL: Timeout override reactivated the timer"); |
+ } |
+ |
+ xhr.open("GET", "http://localhost:8000/xmlhttprequest/resources/access-control-basic-denied.cgi"); |
+ xhr.timeout = 100; |
+ xhr.send(); |
+ |
+ setTimeout(performAssertions, 200); |
+})(); |
+</script> |
+</body> |
+</html> |