<!doctype html>
<html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
async_test(t => {
const url = 'http://localhost:8000/xmlhttprequest/resources/access-control-allow-with-delay.php';
const xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.setRequestHeader('foo', 'bar');
xhr.timeout = 1500;
xhr.ontimeout = t.step_func_done(() => {
assert_equals(xhr.readyState, 4);
});
xhr.onload = t.unreached_func('load event fired');
xhr.send();
}, 'CORS preflight and the actual request should use the same timer');
</script>