connect-src-beacon-allowed.sub.html (1371B)
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-beacon-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 <!-- enforcing policy: 13 connect-src 'self' http://{{host}}:{{ports[http][0]}}; script-src 'self' 'unsafe-inline'; 14 --> 15 </head> 16 17 <body> 18 <script> 19 window.addEventListener('securitypolicyviolation', function(e) { 20 log("FAIL"); 21 }); 22 23 if (typeof navigator.sendBeacon != 'function') { 24 t_log.set_status(t_log.NOTRUN, "No navigator.sendBeacon, cannot run test."); 25 t_log.phase = t_log.phases.HAS_RESULT; 26 t_log.done(); 27 } else { 28 try { 29 var es = navigator.sendBeacon("http://{{host}}:{{ports[http][0]}}/cors/resources/status.py"); 30 log("Pass"); 31 } catch (e) { 32 log("Fail"); 33 } 34 } 35 </script> 36 <div id="log"></div> 37 </body> 38 39 </html>