summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/content-security-policy/unsafe-hashes/style_attribute_denied_wrong_hash.html
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--testing/web-platform/tests/content-security-policy/unsafe-hashes/style_attribute_denied_wrong_hash.html29
1 files changed, 29 insertions, 0 deletions
diff --git a/testing/web-platform/tests/content-security-policy/unsafe-hashes/style_attribute_denied_wrong_hash.html b/testing/web-platform/tests/content-security-policy/unsafe-hashes/style_attribute_denied_wrong_hash.html
new file mode 100644
index 0000000000..be27637224
--- /dev/null
+++ b/testing/web-platform/tests/content-security-policy/unsafe-hashes/style_attribute_denied_wrong_hash.html
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML>
+<html>
+
+<head>
+ <meta http-equiv="Content-Security-Policy" content="img-src *;
+ style-src 'unsafe-hashes' 'sha256-UI8QfroYhb0WX073XBuM+RTPntpjZfkyFLsMw5vQfd0=';">
+ <!--
+ 'sha256-S0VSqEOmzmyOifPfat2sJ7ELOgkldAEbaXlvi5iMqjc=' ==> 'background: green'
+ -->
+ <title>Event handlers should be allowed if a matching hash and 'unsafe-hashes' are present</title>
+ <script src='/resources/testharness.js'></script>
+ <script src='/resources/testharnessreport.js'></script>
+</head>
+
+<body>
+ <div id='log'></div>
+ <script>
+ var t1 = async_test("Test that the inline style attribute is blocked");
+
+ window.addEventListener('securitypolicyviolation', t1.step_func_done(function(e) {
+ assert_equals(e.violatedDirective, 'style-src-attr');
+ assert_equals(e.blockedURI, 'inline');
+ }));
+
+ </script>
+ <img src='../support/pass.png' id='test' style='background: green'>
+</body>
+
+</html>