blob: 62fc4803b4321d643e8105f2473e262ff742812c [file] [log] [blame]
Austin James Ahlstrom052112c2017-08-31 02:25:071<!DOCTYPE html>
2<html>
3 <head>
4 <title>Tests that preflight requests returning invalid 301 status code result in error.</title>
5 <script src="/resources/testharness.js"></script>
6 <script src="/resources/testharnessreport.js"></script>
7 <script src="/common/get-host-info.sub.js"></script>
8 </head>
9 <body>
10 <script type="text/javascript">
11 async_test((test) => {
12 const xhr = new XMLHttpRequest;
13
Philip Jägenstedt2cb86af2018-01-06 16:35:2714 xhr.open("GET", get_host_info().HTTP_REMOTE_ORIGIN + "/xhr/resources/access-control-preflight-request-invalid-status.py?code=301");
Austin James Ahlstrom052112c2017-08-31 02:25:0715
16 xhr.setRequestHeader("x-pass", "pass");
17
18 xhr.onerror = test.step_func_done(function() {
19 assert_equals(xhr.status, 0);
20 });
21
22 xhr.onload = test.unreached_func("Invalid 301 response to preflight should result in error.");
23
24 xhr.send();
25 }, "Request with 301 preflight response");
26 </script>
27 </body>
28</html>