summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/trusted-types/trusted-types-duplicate-names-list.html
blob: afb2f5f7c4b7f6ddfe8da004750017e6c7f01f9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!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>