connect-src-syncxmlhttprequest-allowed.sub.html (1032B)
1 <!DOCTYPE html> 2 <html> 3 4 <head> 5 <!-- Programmatically converted from a WebKit Reftest, please forgive resulting idiosyncracies.--> 6 <meta http-equiv="Content-Security-Policy" content="connect-src 'self' http://{{host}}:{{ports[http][0]}}; script-src 'self' 'unsafe-inline';"> 7 <title>connect-src-syncxmlhttprequest-allowed</title> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src='../support/logTest.sub.js?logs=["Pass"]'></script> 11 <script src="../support/alertAssert.sub.js?alerts=[]"></script> 12 </head> 13 14 <body> 15 <script> 16 window.addEventListener('securitypolicyviolation', function(e) { 17 log("Fail"); 18 }); 19 20 try { 21 var xhr = new XMLHttpRequest; 22 xhr.open("GET", "http://{{host}}:{{ports[http][0]}}/xmlhttprequest/resources/get.txt", false); 23 log("Pass"); 24 } catch (e) { 25 log("Fail"); 26 } 27 28 </script> 29 <div id="log"></div> 30 </body> 31 32 </html>