OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <body> |
| 3 <pre id='console'></pre> |
| 4 <script type="text/javascript"> |
| 5 function log(message) |
| 6 { |
| 7 document.getElementById('console').appendChild(document.createTextNode(messa
ge + "\n")); |
| 8 } |
| 9 |
| 10 if (window.testRunner) { |
| 11 testRunner.dumpAsText(); |
| 12 testRunner.waitUntilDone(); |
| 13 } |
| 14 |
| 15 (function() { |
| 16 var xhr = new XMLHttpRequest; |
| 17 var error = false; |
| 18 var errorCalled = false; |
| 19 |
| 20 function testSuccess() { |
| 21 if (!error) |
| 22 log("PASS: Timeout override did not reactivate timer after failure")
; |
| 23 } |
| 24 |
| 25 function performAssertions() { |
| 26 if (!errorCalled) |
| 27 log("FAIL: error event not dispatched"); |
| 28 else |
| 29 testSuccess(); |
| 30 if (window.testRunner) |
| 31 testRunner.notifyDone(); |
| 32 } |
| 33 |
| 34 xhr.onerror = function() { |
| 35 xhr.timeout = 1; |
| 36 errorCalled = true; |
| 37 }; |
| 38 |
| 39 xhr.ontimeout = function() { |
| 40 error = true; |
| 41 log("FAIL: Timeout override reactivated the timer"); |
| 42 } |
| 43 |
| 44 xhr.open("GET", "http://localhost:8000/xmlhttprequest/resources/access-contr
ol-basic-denied.cgi"); |
| 45 xhr.timeout = 100; |
| 46 xhr.send(); |
| 47 |
| 48 setTimeout(performAssertions, 200); |
| 49 })(); |
| 50 </script> |
| 51 </body> |
| 52 </html> |
OLD | NEW |