OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <meta http-equiv="Content-Security-Policy" content="connect-src http://127.0.0.1
:8000"> |
| 5 <script src="/js-test-resources/js-test.js"></script> |
| 6 </head> |
| 7 <body> |
| 8 <script> |
| 9 description("Verify that a CSP connect-src directive blocks redirects."); |
| 10 window.jsTestIsAsync = true; |
| 11 |
| 12 shouldBeTrue('navigator.sendBeacon("resources/redir.php?url=http://127.0.0.1:808
0/navigation/resources/save-beacon.php%3Fname%3Dcsp-redirect-blocked", "ping");'
); |
| 13 |
| 14 function checkForBeacon() { |
| 15 var xhr = new XMLHttpRequest(); |
| 16 xhr.open("GET", "http://127.0.0.1:8000/navigation/resources/check-beacon.php
?name=csp-redirect-blocked&retries=100", true); |
| 17 xhr.onload = function () { |
| 18 var lines = xhr.responseText.split("\n"); |
| 19 for (var i in lines) |
| 20 testPassed(lines[i]); |
| 21 finishJSTest(); |
| 22 }; |
| 23 xhr.onerror = function () { |
| 24 testFailed("Unable to fetch beacon status"); |
| 25 finishJSTest(); |
| 26 }; |
| 27 xhr.send(); |
| 28 } |
| 29 setTimeout(checkForBeacon, 1000); |
| 30 </script> |
| 31 </body> |
| 32 </html> |
OLD | NEW |