Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /trusted-types/trusted-types-duplicate-names-list.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<meta http-equiv="Content-Security-Policy" content="trusted-types a b c">
</head>
<body>
<script>
test(t => {
trustedTypes.createPolicy("a", {}),
assert_throws_js(TypeError,
_ => trustedTypes.createPolicy("a", {}),
"Duplicate name");
trustedTypes.createPolicy("b", {}),
assert_throws_js(TypeError,
_ => trustedTypes.createPolicy("d", {}),
"Invalid name.");
}, "TrustedTypePolicyFactory and policy list in CSP.");
</script>
</body>