access-control-basic-preflight-denied.htm (1162B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Tests async XHR preflight denial due to lack of CORS headers</title> 5 <!--The original test addressed a more specific issue involving caching, 6 but that issue has since been resolved. 7 We maintain this test as a basic test of invalid preflight denial. 8 Please refer to the comment in the following link for more information: 9 https://chromium-review.googlesource.com/c/chromium/src/+/630338#message-0280542b95c9b0f82b121dc373320c04fcaece31 10 --> 11 <script src="/resources/testharness.js"></script> 12 <script src="/resources/testharnessreport.js"></script> 13 <script src="/common/get-host-info.sub.js"></script> 14 </head> 15 <body> 16 <script type="text/javascript"> 17 async_test((test) => { 18 const xhr = new XMLHttpRequest; 19 xhr.onerror = test.step_func_done(() => { 20 assert_equals(xhr.status, 0); 21 }); 22 23 xhr.onload = test.unreached_func("Request succeeded unexpectedly"); 24 25 xhr.open("FOO", get_host_info().HTTP_REMOTE_ORIGIN + 26 "/xhr/resources/access-control-basic-denied.py"); 27 xhr.send(); 28 }); 29 </script> 30 </body> 31 </html>