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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/content-security-policy/script-src/script-src-strict_dynamic_double_policy_report_only.html

Issue 2695813009: Import wpt@503f5b5f78ec4e87d144f78609f363f0ed0ea8db (Closed)
Patch Set: Skip some tests Created 3 years, 10 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
4 <head>
5 <title>A separate Report-Only policy does not influence `strict-dynamic` in the script-src directive.</title>
6 <script src='/resources/testharness.js' nonce='dummy'></script>
7 <script src='/resources/testharnessreport.js' nonce='dummy'></script>
8
9 <!-- CSP served:
10 1) Content-Security-Policy: script-src 'strict-dynamic' 'nonce-dummy'
11 2) Content-Security-Policy-Report-Only: script-src 'none'
12 -->
13 </head>
14
15 <body>
16 <h1>A separate Report-Only policy does not influence `strict-dynamic` in the script-src directive.</h1>
17 <div id='log'></div>
18
19 <script nonce='dummy'>
20 async_test(function(t) {
21 window.addEventListener('message', t.step_func(function(e) {
22 if (e.data === 'appendChild-reportOnly') {
23 t.done();
24 }
25 }));
26 window.addEventListener('securitypolicyviolation', t.step_func(funct ion(violation) {
27 if (violation.blockedURI.split('?')[1] !== 'appendChild-reportOn ly') {
28 return;
29 }
30 assert_equals(violation.effectiveDirective, 'script-src');
31 // Check that the violation comes from the Report-Only policy.
32 assert_equals(violation.originalPolicy, "script-src 'none'");
33 t.done();
34 }));
35 var e = document.createElement('script');
36 e.id = 'appendChild-reportOnly';
37 e.src = 'simpleSourcedScript.js?' + e.id;
38 e.onerror = t.unreached_func('Error should not be triggered.');
39 document.body.appendChild(e);
40 }, 'Script injected via `appendChild` is allowed with `strict-dynamic` + Report-Only `script-src \'none\'` policy.');
41 </script>
42 </body>
43
44 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698