summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/content-security-policy/unsafe-hashes/script_event_handlers_denied_wrong_hash.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /testing/web-platform/tests/content-security-policy/unsafe-hashes/script_event_handlers_denied_wrong_hash.html
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/content-security-policy/unsafe-hashes/script_event_handlers_denied_wrong_hash.html')
-rw-r--r--testing/web-platform/tests/content-security-policy/unsafe-hashes/script_event_handlers_denied_wrong_hash.html25
1 files changed, 25 insertions, 0 deletions
diff --git a/testing/web-platform/tests/content-security-policy/unsafe-hashes/script_event_handlers_denied_wrong_hash.html b/testing/web-platform/tests/content-security-policy/unsafe-hashes/script_event_handlers_denied_wrong_hash.html
new file mode 100644
index 0000000000..2de6a48eb2
--- /dev/null
+++ b/testing/web-platform/tests/content-security-policy/unsafe-hashes/script_event_handlers_denied_wrong_hash.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML>
+<html>
+
+<head>
+ <meta http-equiv="Content-Security-Policy" content="script-src 'unsafe-hashes' 'nonce-abc' 'sha256-thisdoesnotmatch'; img-src *;">
+ <title>Event handlers should be not allowed if a matching hash is not present</title>
+ <script src='/resources/testharness.js' nonce='abc'></script>
+ <script src='/resources/testharnessreport.js' nonce='abc'></script>
+</head>
+
+<body>
+ <div id='log'></div>
+ <script nonce='abc'>
+ var t1 = async_test("Test that the inline event handler is not allowed to run");
+
+ window.addEventListener('securitypolicyviolation', t1.step_func_done(function(e) {
+ assert_equals(e.violatedDirective, 'script-src-attr');
+ assert_equals(e.blockedURI, 'inline');
+ }));
+ </script>
+ <img src='../support/pass.png'
+ onload='t1.unreached_func("Should not have executed handler");'>
+</body>
+
+</html>