javascript_src_allowed-window_open.html (923B)
1 <!DOCTYPE HTML> 2 <html> 3 4 <head> 5 <meta http-equiv="Content-Security-Policy" content="script-src 'unsafe-hashes' 'nonce-abc' 6 'sha256-IIiAJ8UuliU8o1qAv6CV4P3R8DeTf/v3MrsCwXW171Y=';"> 7 <!-- 8 'sha256-IIiAJ8UuliU8o1qAv6CV4P3R8DeTf/v3MrsCwXW171Y=' ==> 'javascript:opener.postMessage('pass', '*')' 9 --> 10 <script src='/resources/testharness.js' nonce='abc'></script> 11 <script src='/resources/testharnessreport.js' nonce='abc'></script> 12 </head> 13 14 <body> 15 <div id='log'></div> 16 <script nonce='abc'> 17 var t1 = async_test("Test that the javascript: src is allowed to run"); 18 19 window.onmessage = t1.step_func_done(function(e) { 20 assert_equals(e.data, "pass"); 21 }); 22 23 window.addEventListener('securitypolicyviolation', t1.unreached_func("Should have not raised any event")); 24 25 window.open("javascript:opener.postMessage('pass', '*')"); 26 </script> 27 </body> 28 29 </html>