timeout-multiple-fetches.html (1183B)
1 <!doctype html> 2 <title>XMLHttpRequest: timeout, redirects, and CORS preflights</title> 3 <script src=/resources/testharness.js></script> 4 <script src=/resources/testharnessreport.js></script> 5 <script src=/common/get-host-info.sub.js></script> 6 <script src=/common/utils.js></script> 7 <div id=log></div> 8 <script> 9 async_test(t => { 10 const client = new XMLHttpRequest 11 client.open("GET", "resources/redirect.py?delay=500&location=delay.py") // 500 + 500 = 1000 12 client.timeout = 750 13 client.send() 14 client.ontimeout = t.step_func_done(() => { 15 assert_equals(client.readyState, 4) 16 }) 17 client.onload = t.unreached_func("load event fired") 18 }, "Redirects should not reset the timer") 19 20 async_test(t => { 21 // Use a unique ID to prevent caching of the preflight making the test flaky. 22 const uuid = token(); 23 const client = new XMLHttpRequest 24 client.open("YO", get_host_info().HTTP_REMOTE_ORIGIN + "/xhr/resources/delay.py?uuid=" + uuid) 25 client.timeout = 750 26 client.send() 27 client.ontimeout = t.step_func_done(() => { 28 assert_equals(client.readyState, 4) 29 }) 30 client.onload = t.unreached_func("load event fired") 31 }, "CORS preflights should not reset the timer") 32 </script>