timeout-sync.htm (1077B)
1 <!doctype html> 2 <html> 3 <head> 4 <title>XMLHttpRequest: timeout not allowed for sync requests</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <link rel="help" href="https://xhr.spec.whatwg.org/#the-timeout-attribute" data-tested-assertations="following::ol/li[1]" /> 8 <link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="following::ol/li[10]" /> 9 </head> 10 <body> 11 <div id="log"></div> 12 <script> 13 test(function() { 14 var client = new XMLHttpRequest() 15 client.open('GET', 'folder.txt', false) 16 assert_throws_dom("InvalidAccessError", function() { client.timeout = 1000 }) 17 }, 'setting timeout attribute on sync request') 18 test(function() { 19 var client = new XMLHttpRequest() 20 client.timeout = 1000 21 assert_throws_dom("InvalidAccessError", function() { client.open('GET', 'folder.txt', false) }) 22 }, 'open() with async false when timeout is set') 23 </script> 24 </body> 25 </html>