| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <script> |
| async_test(function (t) { |
| window.expectSuccess = t.unreached_func("Handler should not execute."); |
| window.addEventListener('load', t.step_func(function () { |
| document.querySelector('#pass').click(); |
| })); |
| document.addEventListener('securitypolicyviolation', t.step_func_done(function (e) { |
| assert_equals(e.target, document.querySelector('#pass')); |
| })); |
| }, 'Inline event handlers whitelisted by the policy should not fire, as \'unsafe-hash-attributes\' is not present.'); |
| </script> |
| |
| <meta http-equiv="Content-Security-Policy" content="script-src 'sha256-nhtYaXCssBJTThiDLYewspQYue9tisulEwJ3nTJKcMI='"> |
| </head> |
| <body> |
| <button id="pass" onclick="expectFailure(this)"></button> |
| <button id="fail" onclick="expectFailure(this)"></button> |
| </body> |
| </html> |