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

Side by Side Diff: LayoutTests/http/tests/security/contentSecurityPolicy/worker-without-own-csp.html

Issue 1128813003: Give shared workers their own content security policies (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <meta http-equiv="Content-Security-Policy" content="connect-src 'none'"/> 4 <meta http-equiv="Content-Security-Policy" content="connect-src 'none'"/>
5 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharness.js"></script>
6 <script src="/resources/testharnessreport.js"></script> 6 <script src="/resources/testharnessreport.js"></script>
7 </head> 7 </head>
8 <body> 8 <body>
9 <script> 9 <script>
10 // If the worker does not get served with a CSP header, than it should 10 // If the worker does not get served with a CSP header, than it should
11 // have no CSP, not the CSP of the responsible document. 11 // have no CSP, not the CSP of the responsible document.
12
12 async_test(function () { 13 async_test(function () {
13 var worker = new Worker('http://127.0.0.1:8000/security/contentSecurityPol icy/resources/worker.php?type=make-xhr'); 14 var worker = new Worker('http://127.0.0.1:8000/security/contentSecurityPol icy/resources/worker.php?type=make-xhr');
14 worker.onmessage = this.step_func(function (event) { 15 worker.onmessage = this.step_func(function (event) {
15 assert_equals("xhr allowed", event.data); 16 assert_equals("xhr allowed", event.data);
16 this.done(); 17 this.done();
17 }); 18 });
18 }, "Worker should not inherit document's CSP"); 19 }, "Worker should not inherit document's CSP");
20
21 async_test(function () {
22 var worker = new SharedWorker('http://127.0.0.1:8000/security/contentSecur ityPolicy/resources/worker.php?type=shared-make-xhr');
23 worker.port.onmessage = this.step_func(function (event) {
24 assert_equals("xhr allowed", event.data);
25 this.done();
26 });
27 worker.port.start();
28 }, "Shared worker should not inherit document's CSP");
19 </script> 29 </script>
20 </body> 30 </body>
21 </html> 31 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698