| <!DOCTYPE html> |
| <html> |
| <head> |
| <title>XMLHttpRequest: make timeouts bigger than default timeout</title> |
| <script src="/js-test-resources/testharness.js"></script> |
| <script src="/js-test-resources/testharnessreport.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"> |
| |
| promise_test((test) => { |
| return new Promise((resolve, reject) => { |
| var xhr = new XMLHttpRequest(); |
| var startTime = new Date(); |
| xhr.open('GET', "/misc/resources/delayed-log.php?delay=10000000", true); |
| |
| xhr.timeout = 70000; |
| |
| xhr.onabort = () => { reject("onabort is called"); } |
| xhr.onload = () => { reject("onload is called"); }; |
| xhr.onerror = () => { reject("onerror is called"); }; |
| xhr.onloadend = () => { reject("onloadend is called but ontimeout was not"); }; |
| |
| xhr.ontimeout = () => { |
| var elapsed = new Date() - startTime; |
| if (elapsed < 65000) { |
| reject("elapsed time should be greater than timeout value, got " + elapsed); |
| return; |
| } |
| resolve(); |
| }; |
| |
| xhr.send(null); |
| }); |
| }, "Setting a timeout greater than network default"); |
| |
| </script> |
| </body> |
| </html> |
| |