| Austin James Ahlstrom | 052112c | 2017-08-31 02:25:07 | [diff] [blame] | 1 | <!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ägenstedt | 2cb86af | 2018-01-06 16:35:27 | [diff] [blame] | 14 | xhr.open("GET", get_host_info().HTTP_REMOTE_ORIGIN + "/xhr/resources/access-control-preflight-request-invalid-status.py?code=301"); |
| Austin James Ahlstrom | 052112c | 2017-08-31 02:25:07 | [diff] [blame] | 15 | |
| 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> |