Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<script src="/resources/testharness.js" ></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="trusted-types * 'aLLow-dUPLIcates'">
<body>
<script>
// CSP3 is defined in terms of RFC 5234 grammars, which states that terminal
// symbols are case-insensitive. So 'allow-duplicates' should be parsed the
// same as 'ALLOW-DUPLICATES'.
//
// Ref:
// - https://www.w3.org/TR/CSP3/#framework-infrastructure
// - https://www.rfc-editor.org/rfc/rfc5234#section-2.3
// - See also: https://github.com/w3c/webappsec-csp/issues/236
test(t => {
window.trustedTypes.createPolicy('SomeName', { createHTML: s => s } );
}, "Can create policy with name 'SomeName'");
test(t => {
window.trustedTypes.createPolicy('SomeName', { createHTML: s => s } );
}, "Can create a second policy with name 'SomeName'");
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<script src="/resources/testharness.js" ></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="trusted-types 'nONe'">
<body>
<script>
// CSP3 is defined in terms of RFC 5234 grammars, which states that terminal
// symbols are case-insensitive. So 'none' should be parsed the
// same as 'NONE'.
//
// Ref:
// - https://www.w3.org/TR/CSP3/#framework-infrastructure
// - https://www.rfc-editor.org/rfc/rfc5234#section-2.3
// - See also: https://github.com/w3c/webappsec-csp/issues/236
test(t => {
assert_throws_js(TypeError, _ => {
window.trustedTypes.createPolicy('SomeName', { createHTML: s => s } );
});
}, "Cannot create a policy when CSP lists 'none'");
</script>