Skip to content

Commit a52101f

Browse files
committed
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
1 parent d6a5f09 commit a52101f

1 file changed

Lines changed: 39 additions & 8 deletions

File tree

source

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3009,6 +3009,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
30093009
<li>The <dfn data-x="js-HostEnqueueTimeoutJob" data-x-href="https://tc39.es/ecma262/#sec-hostenqueuetimeoutjob">HostEnqueueTimeoutJob</dfn> abstract operation</li>
30103010
<li>The <dfn data-x="js-HostEnsureCanAddPrivateElement" data-x-href="https://tc39.es/ecma262/#sec-hostensurecanaddprivateelement">HostEnsureCanAddPrivateElement</dfn> abstract operation</li>
30113011
<li>The <dfn data-x="js-HostEnsureCanCompileStrings" data-x-href="https://tc39.es/ecma262/#sec-hostensurecancompilestrings">HostEnsureCanCompileStrings</dfn> abstract operation</li>
3012+
<li>The <dfn data-x="tt-HostEnsureCanCompileStrings" data-x-href="https://tc39.es/proposal-dynamic-code-brand-checks/#sec-hostensurecancompilestrings">HostEnsureCanCompileStrings</dfn> abstract operation</li>
3013+
<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>
30123014
<li>The <dfn data-x="js-HostLoadImportedModule" data-x-href="https://tc39.es/proposal-import-attributes/#sec-HostLoadImportedModule">HostLoadImportedModule</dfn> abstract operation</li>
30133015
<li>The <dfn data-x="js-HostMakeJobCallback" data-x-href="https://tc39.es/ecma262/#sec-hostmakejobcallback">HostMakeJobCallback</dfn> abstract operation</li>
30143016
<li>The <dfn data-x="js-HostPromiseRejectionTracker" data-x-href="https://tc39.es/ecma262/#sec-host-promise-rejection-tracker">HostPromiseRejectionTracker</dfn> abstract operation</li>
@@ -4606,6 +4608,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
46064608
<ul class="brief">
46074609
<li><dfn data-x="tt-htmlstring" data-x-href="https://w3c.github.io/trusted-types/dist/spec/#typedefdef-htmlstring"><code>HTMLString</code></dfn></li>
46084610
<li><dfn data-x="tt-scripturlstring" data-x-href="https://w3c.github.io/trusted-types/dist/spec/#typedefdef-scripturlstring"><code>ScriptURLString</code></dfn></li>
4611+
<li><dfn data-x="tt-trustedscript" data-x-href="https://w3c.github.io/trusted-types/dist/spec/#trusted-script"><code>TrustedScript</code></dfn></li>
4612+
<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>
46094613
</ul>
46104614
</dd>
46114615
</dl>
@@ -108718,16 +108722,40 @@ dictionary <dfn dictionary>PromiseRejectionEventInit</dfn> : <span>EventInit</sp
108718108722
security &mdash; that make implementation of private field semantics challenging, so our
108719108723
implementation simply rejects those objects.</p>
108720108724

108721-
<h5><dfn data-x="the-hostensurecancompilestrings-implementation">HostEnsureCanCompileStrings</dfn>(<var>realm</var>)</h5>
108725+
<h5><dfn
108726+
data-x="the-hostensurecancompilestrings-implementation">HostEnsureCanCompileStrings</dfn>(<var>realm</var>,
108727+
<var>parameterStrings</var>, <var>bodyString</var>, <var>compilationType</var>,
108728+
<var>parameterArgs</var>, <var>bodyArg</var>)</h5>
108722108729

108723108730
<p>JavaScript contains an <span>implementation-defined</span> <span
108724-
data-x="js-HostEnsureCanCompileStrings">HostEnsureCanCompileStrings</span>(<var>realm</var>)
108725-
abstract operation. User agents must use the following implementation: <ref>JAVASCRIPT</ref>
108731+
data-x="js-HostEnsureCanCompileStrings">HostEnsureCanCompileStrings</span> abstract operation,
108732+
which the <cite>Dynamic Code Brand Checks</cite> proposal defines as follows, <span
108733+
data-x="tt-HostEnsureCanCompileStrings">HostEnsureCanCompileStrings</span>(<var>realm</var>,
108734+
<var>parameterStrings</var>, <var>bodyString</var>, <var>compilationType</var>,
108735+
<var>parameterArgs</var>, <var>bodyArg</var>). User agents must use the following implementation:
108736+
<ref>JAVASCRIPT</ref><ref>JSDYNAMICCODEBRANDCHECKS</ref>
108726108737

108727108738
<ol>
108728108739
<li><p>Perform ? <span
108729-
data-x="csp-EnsureCSPDoesNotBlockStringCompilation">EnsureCSPDoesNotBlockStringCompilation</span>(<var>realm</var>).
108730-
<ref>CSP</ref></p></li>
108740+
data-x="csp-EnsureCSPDoesNotBlockStringCompilation">EnsureCSPDoesNotBlockStringCompilation</span>(<var>realm</var>,
108741+
<var>parameterStrings</var>, <var>bodyString</var>, <var>compilationType</var>,
108742+
<var>parameterArgs</var>, <var>bodyArg</var>). <ref>CSP</ref></p></li>
108743+
</ol>
108744+
108745+
<h5><dfn
108746+
data-x="the-hostgetcodeforeval-implementation">HostGetCodeForEval</dfn>(<var>argument</var>)</h5>
108747+
108748+
<p>The <cite>Dynamic Code Brand Checks</cite> proposal contains an
108749+
<span>implementation-defined</span> <span
108750+
data-x="js-HostGetCodeForEval">HostGetCodeForEval</span>(<var>argument</var>) abstract operation.
108751+
User agents must use the following implementation: <ref>JSDYNAMICCODEBRANDCHECKS</ref>
108752+
108753+
<ol>
108754+
<li><p>If <var>argument</var> is a <code data-x="tt-trustedscript">TrustedScript</code> object,
108755+
then return <var>argument</var>'s <span data-x="tt-trustedscript-data">[[DATA]]</span> internal
108756+
slot.</p></li>
108757+
108758+
<li><p>Otherwise, return ~no-code~.</p></li>
108731108759
</ol>
108732108760

108733108761
<h5 id="the-hostpromiserejectiontracker-implementation"><dfn>HostPromiseRejectionTracker</dfn>(<var>promise</var>, <var>operation</var>)</h5>
@@ -113005,9 +113033,9 @@ enum <dfn enum>DOMParserSupportedType</dfn> {
113005113033
<li><p><span>Assert</span>: <var>handler</var> is a string.</p></li>
113006113034

113007113035
<li><p>Perform <span
113008-
data-x="the-hostensurecancompilestrings-implementation">HostEnsureCanCompileStrings</span>(<var>realm</var>).
113009-
If this throws an exception, catch it, <span>report the exception</span>, and abort these
113010-
steps.</p></li>
113036+
data-x="csp-EnsureCSPDoesNotBlockStringCompilation">EnsureCSPDoesNotBlockStringCompilation</span>(<var>realm</var>,
113037+
« », <var>handler</var>, ~timer~, « », <var>handler</var>). If this throws an exception,
113038+
catch it, <span>report the exception</span>, and abort these steps.</p></li>
113011113039

113012113040
<li><p>Let <var>settings object</var> be <var>global</var>'s <span>relevant settings
113013113041
object</span>.</p></li>
@@ -142564,6 +142592,9 @@ INSERT INTERFACES HERE
142564142592
<dt id="refsJSERRORSTACKS">[JSERRORSTACKS]</dt>
142565142593
<dd>(Non-normative) <cite><a href="https://tc39.es/proposal-error-stacks/">Error Stacks</a></cite>. Ecma International.</dd>
142566142594

142595+
<dt id="refsJSDYNAMICCODEBRANDCHECKS">[JSDYNAMICCODEBRANDCHECKS]</dt>
142596+
<dd><cite><a href="https://tc39.es/proposal-dynamic-code-brand-checks/">Dynamic code brand checks</a></cite>. Ecma International.</dd>
142597+
142567142598
<dt id="refsJSIMPORTATTRIBUTES">[JSIMPORTATTRIBUTES]</dt>
142568142599
<dd><cite><a href="https://tc39.es/proposal-import-attributes/">Import attributes</a></cite>. Ecma International.</dd>
142569142600

0 commit comments

Comments
 (0)