Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Side by Side Diff: LayoutTests/http/tests/security/contentSecurityPolicy/connect-src-beacon-redirect-to-blocked.html

Issue 232053005: Implement navigator.sendBeacon() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Revert CSP checking on redirects Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698