Skip to content

Commit 6fec5ae

Browse files
lukewarlowlozy219
authored andcommitted
Update HostEnsureCanCompileStrings definition
Update the HostEnsureCanCompileStrings definition to match dynamic code brand checks stage 3 proposal. Also update the call to EnsureCSPDoesNotBlockStringCompilation to pass these new arguments through. Also update the timer initialization steps to call EnsureCSPDoesNotBlockStringCompilation directly, and include the new parameters. Also define HostGetCodeForEval implementation. See w3c/webappsec-csp#650 for corresponding CSP PR. Also see whatwg#10202 for context.
1 parent ce92a50 commit 6fec5ae

File tree

1 file changed

+42
-8
lines changed

1 file changed

+42
-8
lines changed

source

+42-8
Original file line numberDiff line numberDiff line change
@@ -3009,7 +3009,6 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
30093009
<li>The <dfn data-x="js-HostEnqueuePromiseJob" data-x-href="https://tc39.es/ecma262/#sec-hostenqueuepromisejob">HostEnqueuePromiseJob</dfn> abstract operation</li>
30103010
<li>The <dfn data-x="js-HostEnqueueTimeoutJob" data-x-href="https://tc39.es/ecma262/#sec-hostenqueuetimeoutjob">HostEnqueueTimeoutJob</dfn> abstract operation</li>
30113011
<li>The <dfn data-x="js-HostEnsureCanAddPrivateElement" data-x-href="https://tc39.es/ecma262/#sec-hostensurecanaddprivateelement">HostEnsureCanAddPrivateElement</dfn> abstract operation</li>
3012-
<li>The <dfn data-x="js-HostEnsureCanCompileStrings" data-x-href="https://tc39.es/ecma262/#sec-hostensurecancompilestrings">HostEnsureCanCompileStrings</dfn> abstract operation</li>
30133012
<li>The <dfn data-x="js-HostLoadImportedModule" data-x-href="https://tc39.es/proposal-import-attributes/#sec-HostLoadImportedModule">HostLoadImportedModule</dfn> abstract operation</li>
30143013
<li>The <dfn data-x="js-HostMakeJobCallback" data-x-href="https://tc39.es/ecma262/#sec-hostmakejobcallback">HostMakeJobCallback</dfn> abstract operation</li>
30153014
<li>The <dfn data-x="js-HostPromiseRejectionTracker" data-x-href="https://tc39.es/ecma262/#sec-host-promise-rejection-tracker">HostPromiseRejectionTracker</dfn> abstract operation</li>
@@ -3072,6 +3071,15 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
30723071
<li><dfn data-x-href="https://tc39.es/ecma262/#table-49">The <var>TypedArray</var> Constructors</dfn> table</li>
30733072
</ul>
30743073

3074+
<p>Users agents that support JavaScript must also implement the <cite>Dynamic Code Brand
3075+
Checks</cite> proposal. The following terms are defined there, and used in this specification:
3076+
<ref>JSDYNAMICCODEBRANDCHECKS</ref></p>
3077+
3078+
<ul class="brief">
3079+
<li>The <dfn data-x="js-HostEnsureCanCompileStrings" data-x-href="https://tc39.es/proposal-dynamic-code-brand-checks/#sec-hostensurecancompilestrings">HostEnsureCanCompileStrings</dfn> abstract operation</li>
3080+
<li>The <dfn data-x="js-HostGetCodeForEval" data-x-href="https://tc39.es/proposal-dynamic-code-brand-checks/#sec-hostgetcodeforeval">HostGetCodeForEval</dfn> abstract operation</li>
3081+
</ul>
3082+
30753083
<p>Users agents that support JavaScript must also implement <cite>ECMAScript
30763084
Internationalization API</cite>. <ref>JSINTL</ref></p>
30773085

@@ -4613,6 +4621,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
46134621
<li><dfn data-x="tt-trustedhtml" data-x-href="https://w3c.github.io/trusted-types/dist/spec/#trustedhtml"><code>TrustedHTML</code></dfn></li>
46144622
<li><dfn data-x="tt-trustedhtml-data" data-x-href="https://w3c.github.io/trusted-types/dist/spec/#trustedhtml-data">data</dfn></li>
46154623
<li><dfn data-x="tt-trustedscript" data-x-href="https://w3c.github.io/trusted-types/dist/spec/#trusted-script"><code>TrustedScript</code></dfn></li>
4624+
<li><dfn data-x="tt-trustedscript-data" data-x-href="https://w3c.github.io/trusted-types/dist/spec/#trustedscript-data"><code>data</code></dfn></li>
46164625
<li><dfn data-x="tt-trustedscripturl" data-x-href="https://w3c.github.io/trusted-types/dist/spec/#trustedscripturl"><code>TrustedScriptURL</code></dfn></li>
46174626
<li><dfn data-x="tt-getcompliantstring" data-x-href="https://w3c.github.io/trusted-types/dist/spec/#get-trusted-type-compliant-string-algorithm">Get Trusted Type compliant string</dfn></li>
46184627
</ul>
@@ -108912,18 +108921,39 @@ dictionary <dfn dictionary>PromiseRejectionEventInit</dfn> : <span>EventInit</sp
108912108921
security &mdash; that make implementation of private field semantics challenging, so our
108913108922
implementation simply rejects those objects.</p>
108914108923

108915-
<h5><dfn data-x="the-hostensurecancompilestrings-implementation">HostEnsureCanCompileStrings</dfn>(<var>realm</var>)</h5>
108924+
<h5><dfn
108925+
data-x="the-hostensurecancompilestrings-implementation">HostEnsureCanCompileStrings</dfn>(<var>realm</var>,
108926+
<var>parameterStrings</var>, <var>bodyString</var>, <var>codeString</var>, <var>compilationType</var>,
108927+
<var>parameterArgs</var>, <var>bodyArg</var>)</h5>
108916108928

108917108929
<p>JavaScript contains an <span>implementation-defined</span> <span
108918-
data-x="js-HostEnsureCanCompileStrings">HostEnsureCanCompileStrings</span>(<var>realm</var>)
108919-
abstract operation. User agents must use the following implementation: <ref>JAVASCRIPT</ref>
108930+
data-x="js-HostEnsureCanCompileStrings">HostEnsureCanCompileStrings</span> abstract operation,
108931+
redefined by the <cite>Dynamic Code Brand Checks</cite> proposal. User agents must use
108932+
the following implementation: <ref>JAVASCRIPT</ref> <ref>JSDYNAMICCODEBRANDCHECKS</ref>
108920108933

108921108934
<ol>
108922108935
<li><p>Perform ? <span
108923-
data-x="csp-EnsureCSPDoesNotBlockStringCompilation">EnsureCSPDoesNotBlockStringCompilation</span>(<var>realm</var>).
108936+
data-x="csp-EnsureCSPDoesNotBlockStringCompilation">EnsureCSPDoesNotBlockStringCompilation</span>(<var>realm</var>,
108937+
<var>parameterStrings</var>, <var>bodyString</var>, <var>codeString</var>,
108938+
<var>compilationType</var>, <var>parameterArgs</var>, <var>bodyArg</var>).
108924108939
<ref>CSP</ref></p></li>
108925108940
</ol>
108926108941

108942+
<h5><dfn
108943+
data-x="the-hostgetcodeforeval-implementation">HostGetCodeForEval</dfn>(<var>argument</var>)</h5>
108944+
108945+
<p>The <cite>Dynamic Code Brand Checks</cite> proposal contains an
108946+
<span>implementation-defined</span> <span
108947+
data-x="js-HostGetCodeForEval">HostGetCodeForEval</span>(<var>argument</var>) abstract operation.
108948+
User agents must use the following implementation: <ref>JSDYNAMICCODEBRANDCHECKS</ref>
108949+
108950+
<ol>
108951+
<li><p>If <var>argument</var> is a <code data-x="tt-trustedscript">TrustedScript</code> object,
108952+
then return <var>argument</var>'s <span data-x="tt-trustedscript-data">data</span>.</p></li>
108953+
108954+
<li><p>Otherwise, return no-code.</p></li>
108955+
</ol>
108956+
108927108957
<h5 id="the-hostpromiserejectiontracker-implementation"><dfn>HostPromiseRejectionTracker</dfn>(<var>promise</var>, <var>operation</var>)</h5>
108928108958

108929108959
<p>JavaScript contains an <span>implementation-defined</span> <span
@@ -113588,9 +113618,10 @@ enum <dfn enum>DOMParserSupportedType</dfn> {
113588113618
<li><p><span>Assert</span>: <var>handler</var> is a string.</p></li>
113589113619

113590113620
<li><p>Perform <span
113591-
data-x="the-hostensurecancompilestrings-implementation">HostEnsureCanCompileStrings</span>(<var>realm</var>).
113592-
If this throws an exception, catch it, <span>report the exception</span>, and abort these
113593-
steps.</p></li>
113621+
data-x="csp-EnsureCSPDoesNotBlockStringCompilation">EnsureCSPDoesNotBlockStringCompilation</span>(<var>realm</var>,
113622+
« », <var>handler</var>, <var>handler</var>, timer, « », <var>handler</var>). If this throws
113623+
an exception, catch it, <span>report the exception</span>, and abort these steps.</p></li>
113624+
<!-- timer is an enum value. -->
113594113625

113595113626
<li><p>Let <var>settings object</var> be <var>global</var>'s <span>relevant settings
113596113627
object</span>.</p></li>
@@ -143192,6 +143223,9 @@ INSERT INTERFACES HERE
143192143223
<dt id="refsJSERRORSTACKS">[JSERRORSTACKS]</dt>
143193143224
<dd>(Non-normative) <cite><a href="https://tc39.es/proposal-error-stacks/">Error Stacks</a></cite>. Ecma International.</dd>
143194143225

143226+
<dt id="refsJSDYNAMICCODEBRANDCHECKS">[JSDYNAMICCODEBRANDCHECKS]</dt>
143227+
<dd><cite><a href="https://tc39.es/proposal-dynamic-code-brand-checks/">Dynamic code brand checks</a></cite>. Ecma International.</dd>
143228+
143195143229
<dt id="refsJSIMPORTATTRIBUTES">[JSIMPORTATTRIBUTES]</dt>
143196143230
<dd><cite><a href="https://tc39.es/proposal-import-attributes/">Import attributes</a></cite>. Ecma International.</dd>
143197143231

0 commit comments

Comments
 (0)