blob: f2ed85bc17e4e1fd02a768606e0f567462c2bbba [file] [log] [blame]
Austin James Ahlstromb3b9c1e2017-08-31 05:17:231<!DOCTYPE html>
2<html>
3 <head>
4 <title>Tests that preflight requests returning invalid 501 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=501");
Austin James Ahlstromb3b9c1e2017-08-31 05:17:2315
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 501 response to preflight should result in error.");
23
24 xhr.send();
25 }, "Request with 501 preflight response");
26 </script>
27 </body>
28</html>