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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/content-security-policy/script-src/script-src-strict_dynamic_hashes.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>`strict-dynamic` allows scripts matching hashes present in the policy .</title>
6 <script src='/resources/testharness.js' nonce='dummy'></script>
7 <script src='/resources/testharnessreport.js' nonce='dummy'></script>
8
9 <!-- CSP served: script-src 'strict-dynamic' 'nonce-dummy' 'sha256-yU6Q7nD1T CBB9JvY06iIJ8ONLOPU4g8ml5JCDgXkv+M=' 'sha256-IFt1v6itHgqlrtInbPm/y7qyWcAlDbPgZM+ 92C5EZ5o=' -->
10 </head>
11
12 <body>
13 <h1>`strict-dynamic` allows scripts matching hashes present in the policy.</ h1>
14 <div id='log'></div>
15
16 <script nonce='dummy'>
17 var hashScriptRan = false;
18 window.addEventListener('securitypolicyviolation', function(e) {
19 assert_unreached('No CSP violation report has fired.');
20 });
21 </script>
22
23 <!-- Hash: 'sha256-yU6Q7nD1TCBB9JvY06iIJ8ONLOPU4g8ml5JCDgXkv+M=' -->
24 <script>
25 hashScriptRan = true;
26 </script>
27
28 <script nonce='dummy'>
29 async_test(function(t) {
30 assert_true(hashScriptRan);
31 t.done();
32 }, "Script matching SHA256 hash is allowed with `strict-dynamic`.");
33 </script>
34
35 <!-- Hash: 'sha256-IFt1v6itHgqlrtInbPm/y7qyWcAlDbPgZM+92C5EZ5o=' -->
36 <script>
37 async_test(function(t) {
38 window.addEventListener('message', t.step_func(function(e) {
39 if (e.data === 'hashScript') {
40 t.done();
41 }
42 }));
43 var e = document.createElement('script');
44 e.id = 'hashScript';
45 e.src = 'simpleSourcedScript.js?' + e.id;
46 e.onerror = t.unreached_func('Error should not be triggered.');
47 document.body.appendChild(e);
48 }, 'Script injected via `appendChild` from a script matching SHA256 hash is allowed with `strict-dynamic`.');
49 </script>
50 </body>
51
52 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698