Skip to content

Commit f810dce

Browse files
authored
Adds a test case that when the style-src-elem directive is present, it is used for non-attribute styles and not style-src.
1 parent 103970b commit f810dce

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta http-equiv="Content-Security-Policy" content="style-src 'none'; style-src-elem 'self'">
6+
<script src="/resources/testharness.js"></script>
7+
<script src="/resources/testharnessreport.js"></script>
8+
<script>
9+
var t = async_test("Inline style should be applied");
10+
window.addEventListener('securitypolicyviolation', t.unreached_func("Should not have fired a spv event"));
11+
</script>
12+
<link rel="stylesheet" href="/content-security-policy/style-src/resources/allowed.css">
13+
</head>
14+
<body>
15+
<script>
16+
t.step(function() {
17+
assert_equals(document.styleSheets.length, 1);
18+
t.done();
19+
});
20+
</script>
21+
</body>
22+
23+
</html>

0 commit comments

Comments
 (0)