Skip to content

Commit 54cdd77

Browse files
committed
Always disallow creating multiple default policies.
1 parent 3a9de45 commit 54cdd77

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

dist/spec/index.html

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@
12141214
</style>
12151215
<meta content="Bikeshed version 0dd2bba6dfda6c3168490a3a3044dd1d0b1ef8e0" name="generator">
12161216
<link href="https://w3c.github.io/webappsec-trusted-types/dist/spec/" rel="canonical">
1217-
<meta content="59ce043cf237a8efa16bc9d991692ba679cdb11a" name="document-revision">
1217+
<meta content="3a9de45677cb0879b0bc2385f8de2a3da3682203" name="document-revision">
12181218
<style>/* style-md-lists */
12191219

12201220
/* This is a weird hack for me not yet following the commonmark spec
@@ -2351,6 +2351,9 @@ <h3 class="heading settled" data-level="3.1" id="create-trusted-type-policy-algo
23512351
creation be blocked by Content Security Policy?</a> algorithm with <var>global</var>, <var>policyName</var> and <var>factory</var>’s <code>[[CreatedPolicyNames]]</code> slot value.</p>
23522352
<li data-md>
23532353
<p>If <var>allowedByCSP</var> is <code>"Blocked"</code>, throw a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#exceptiondef-typeerror" id="ref-for-exceptiondef-typeerror">TypeError</a></code> and abort further steps.</p>
2354+
<li data-md>
2355+
<p>If <var>policyName</var> is <code>default</code> and the <var>factory</var>’s <code>[[DefaultPolicy]]</code> slot
2356+
value is not empty, throw a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#exceptiondef-typeerror" id="ref-for-exceptiondef-typeerror①">TypeError</a></code> and abort further steps.</p>
23542357
<li data-md>
23552358
<p>Let <var>policy</var> be a new <code class="idl"><a data-link-type="idl" href="#trustedtypepolicy" id="ref-for-trustedtypepolicy①⓪">TrustedTypePolicy</a></code> object.</p>
23562359
<li data-md>
@@ -2399,7 +2402,7 @@ <h3 class="heading settled" data-level="3.2" id="create-a-trusted-type-algorithm
23992402
<li data-md>
24002403
<p>Let <var>function</var> be the value of the property in <var>options</var> named <var>functionName</var>.</p>
24012404
<li data-md>
2402-
<p>If <var>function</var> is <code>null</code>, throw a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#exceptiondef-typeerror" id="ref-for-exceptiondef-typeerror">TypeError</a></code>.</p>
2405+
<p>If <var>function</var> is <code>null</code>, throw a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#exceptiondef-typeerror" id="ref-for-exceptiondef-typeerror">TypeError</a></code>.</p>
24032406
<li data-md>
24042407
<p>Let <var>policyValue</var> be the result of invoking <var>function</var> with <var>value</var> as a first argument, items of <var>arguments</var> as subsequent arguments,
24052408
and <a href="https://tc39.es/ecma262/#sec-method">callback **this** value</a> set to <code>null</code>.</p>
@@ -2448,7 +2451,7 @@ <h3 class="heading settled" data-level="3.3" id="get-trusted-type-compliant-stri
24482451
<p>If <var>disposition</var> is <code>“Allowed”</code>, return stringified <var>input</var> and abort futher steps.</p>
24492452
<p class="note" role="note"><span>Note:</span> This step assures that the default policy rejection will be reported, but ignored in a report-only mode.</p>
24502453
<li data-md>
2451-
<p>Throw a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#exceptiondef-typeerror" id="ref-for-exceptiondef-typeerror">TypeError</a></code> and abort further steps.</p>
2454+
<p>Throw a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#exceptiondef-typeerror" id="ref-for-exceptiondef-typeerror">TypeError</a></code> and abort further steps.</p>
24522455
</ol>
24532456
<li data-md>
24542457
<p class="assertion">Assert: <var>convertedInput</var> has type <var>expectedType</var>.</p>
@@ -3911,9 +3914,9 @@ <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="c
39113914
<aside class="dfn-panel" data-for="term-for-exceptiondef-typeerror">
39123915
<a href="https://heycam.github.io/webidl/#exceptiondef-typeerror">https://heycam.github.io/webidl/#exceptiondef-typeerror</a><b>Referenced in:</b>
39133916
<ul>
3914-
<li><a href="#ref-for-exceptiondef-typeerror">3.1. Create a Trusted Type Policy</a>
3915-
<li><a href="#ref-for-exceptiondef-typeerror">3.2. Create a Trusted Type</a>
3916-
<li><a href="#ref-for-exceptiondef-typeerror">3.3. Get Trusted Type compliant string</a>
3917+
<li><a href="#ref-for-exceptiondef-typeerror">3.1. Create a Trusted Type Policy</a> <a href="#ref-for-exceptiondef-typeerror①">(2)</a>
3918+
<li><a href="#ref-for-exceptiondef-typeerror">3.2. Create a Trusted Type</a>
3919+
<li><a href="#ref-for-exceptiondef-typeerror">3.3. Get Trusted Type compliant string</a>
39173920
</ul>
39183921
</aside>
39193922
<aside class="dfn-panel" data-for="term-for-idl-USVString">

spec/index.bs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,8 @@ a string (|policyName|), {{TrustedTypePolicyOptions}} dictionary (|options|), an
857857
creation be blocked by Content Security Policy?$] algorithm with |global|,
858858
|policyName| and |factory|'s `[[CreatedPolicyNames]]` slot value.
859859
1. If |allowedByCSP| is `"Blocked"`, throw a {{TypeError}} and abort further steps.
860+
1. If |policyName| is `default` and the |factory|'s `[[DefaultPolicy]]` slot
861+
value is not empty, throw a {{TypeError}} and abort further steps.
860862
1. Let |policy| be a new {{TrustedTypePolicy}} object.
861863
1. Set |policy|'s `name` property value to |policyName|.
862864
1. Let |policyOptions| be a new {{TrustedTypePolicyOptions}} object.

0 commit comments

Comments
 (0)