blob: 4f4998c4285222bf4bdf41c3e0c1c27e913d2149 [file] [log] [blame]
Anne van Kesteren647eae02017-03-10 14:41:191<!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>
Adam Ricee6116f92018-08-28 08:00:066<script src=/common/utils.js></script>
Anne van Kesteren647eae02017-03-10 14:41:197<div id=log></div>
8<script>
9async_test(t => {
10 const client = new XMLHttpRequest
11 client.open("GET", "resources/redirect.py?delay=500&location=delay.py") // 500 + 500 = 1000
Adam Ricee6116f92018-08-28 08:00:0612 client.timeout = 750
Anne van Kesteren647eae02017-03-10 14:41:1913 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
20async_test(t => {
Adam Ricee6116f92018-08-28 08:00:0621 // Use a unique ID to prevent caching of the preflight making the test flaky.
22 const uuid = token();
Anne van Kesteren647eae02017-03-10 14:41:1923 const client = new XMLHttpRequest
Adam Ricee6116f92018-08-28 08:00:0624 client.open("YO", get_host_info().HTTP_REMOTE_ORIGIN + "/xhr/resources/delay.py?uuid=" + uuid)
25 client.timeout = 750
Anne van Kesteren647eae02017-03-10 14:41:1926 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>