access-control-preflight-request-invalid-status-400.htm (911B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Tests that preflight requests returning invalid 400 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 14 xhr.open("GET", get_host_info().HTTP_REMOTE_ORIGIN + "/xhr/resources/access-control-preflight-request-invalid-status.py?code=400"); 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 400 response to preflight should result in error."); 23 24 xhr.send(); 25 }, "Request with 400 preflight response"); 26 </script> 27 </body> 28 </html>