access-control-preflight-async-not-supported.htm (1038B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Async PUT request denied at preflight</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 <script src="/common/utils.js"></script> 9 </head> 10 <body> 11 <script type="text/javascript"> 12 const uuid = token(); 13 const url = get_host_info().HTTP_REMOTE_ORIGIN + 14 "/xhr/resources/access-control-preflight-denied.py?token=" + uuid; 15 16 async_test((test) => { 17 let xhr = new XMLHttpRequest; 18 xhr.open("GET", url + "&command=reset", false); 19 xhr.send(); 20 21 xhr = new XMLHttpRequest; 22 xhr.open("PUT", url, true); 23 24 xhr.onload = test.unreached_func("Cross-domain access allowed unexpectedly."); 25 26 xhr.onerror = test.step_func_done(() => { 27 xhr = new XMLHttpRequest; 28 xhr.open("GET", url + "&command=complete", false); 29 xhr.send(); 30 assert_equals(xhr.responseText, "Request successfully blocked."); 31 }); 32 33 xhr.send(); 34 }); 35 </script> 36 </body> 37 </html>