OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE HTML> | |
2 <html> | |
3 | |
4 <head> | |
5 <title>External scripts with matching SRI hash should be allowed.</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 'nonce-dummy' 'sha256-wIc3KtqOuTFEu6t17sIBuOswgk V406VJvhSk79Gw6U0=' --> | |
10 </head> | |
11 | |
12 <body> | |
13 <h1>External scripts with matching SRI hash should be allowed.</h1> | |
14 <div id='log'></div> | |
15 | |
16 <script nonce='dummy'> | |
17 window.addEventListener('securitypolicyviolation', function(e) { | |
18 assert_unreached('No CSP violation report has fired.'); | |
19 }); | |
20 | |
21 var externalRan = false; | |
22 </script> | |
23 | |
24 <script src='externalScript.js' | |
25 integrity="sha256-wIc3KtqOuTFEu6t17sIBuOswgkV406VJvhSk79Gw6U0="></script > | |
26 <script nonce='dummy'> | |
27 test(function() { | |
28 assert_true(externalRan, 'External script ran.'); | |
29 }, 'External script in a script tag with matching SRI hash should run.') ; | |
30 </script> | |
31 | |
32 <script nonce='dummy'> | |
33 externalRan = false; | |
34 async_test(function(t) { | |
35 var e = document.createElement('script'); | |
36 e.id = 'appendChild'; | |
37 e.src = 'externalScript.js'; | |
38 e.setAttribute( | |
39 'integrity', | |
40 'sha256-wIc3KtqOuTFEu6t17sIBuOswgkV406VJvhSk79Gw6U0='); | |
41 e.onload = t.step_func_done(function(e) { | |
42 assert_true(externalRan, 'External script ran.'); | |
43 }); | |
44 e.onerror = t.unreached_func('Error should not be triggered.'); | |
45 document.body.appendChild(e); | |
46 | |
47 }, "Dynamically-inserted external script with matching SRI hash should r un."); | |
48 </script> | |
Mike West
2017/04/06 10:26:35
While I think this test doesn't actually run into
Marc Treib
2017/04/06 12:26:30
Thanks! With my (lack of) JS skills, it would've p
Marc Treib
2017/04/06 16:21:41
Done now, PTAL!
| |
49 | |
50 </body> | |
51 | |
52 </html> | |
OLD | NEW |