Skip to content

Commit

Permalink
Update HostEnsureCanCompileStrings definition
Browse files Browse the repository at this point in the history
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
  • Loading branch information
lukewarlow committed Apr 15, 2024
1 parent d6a5f09 commit efe1eac
Showing 1 changed file with 39 additions and 8 deletions.
47 changes: 39 additions & 8 deletions source
Expand Up @@ -3009,6 +3009,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li>The <dfn data-x="js-HostEnqueueTimeoutJob" data-x-href="https://tc39.es/ecma262/#sec-hostenqueuetimeoutjob">HostEnqueueTimeoutJob</dfn> abstract operation</li>
<li>The <dfn data-x="js-HostEnsureCanAddPrivateElement" data-x-href="https://tc39.es/ecma262/#sec-hostensurecanaddprivateelement">HostEnsureCanAddPrivateElement</dfn> abstract operation</li>
<li>The <dfn data-x="js-HostEnsureCanCompileStrings" data-x-href="https://tc39.es/ecma262/#sec-hostensurecancompilestrings">HostEnsureCanCompileStrings</dfn> abstract operation</li>
<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>
<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>
<li>The <dfn data-x="js-HostLoadImportedModule" data-x-href="https://tc39.es/proposal-import-attributes/#sec-HostLoadImportedModule">HostLoadImportedModule</dfn> abstract operation</li>
<li>The <dfn data-x="js-HostMakeJobCallback" data-x-href="https://tc39.es/ecma262/#sec-hostmakejobcallback">HostMakeJobCallback</dfn> abstract operation</li>
<li>The <dfn data-x="js-HostPromiseRejectionTracker" data-x-href="https://tc39.es/ecma262/#sec-host-promise-rejection-tracker">HostPromiseRejectionTracker</dfn> abstract operation</li>
Expand Down Expand Up @@ -4606,6 +4608,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<ul class="brief">
<li><dfn data-x="tt-htmlstring" data-x-href="https://w3c.github.io/trusted-types/dist/spec/#typedefdef-htmlstring"><code>HTMLString</code></dfn></li>
<li><dfn data-x="tt-scripturlstring" data-x-href="https://w3c.github.io/trusted-types/dist/spec/#typedefdef-scripturlstring"><code>ScriptURLString</code></dfn></li>
<li><dfn data-x="tt-trustedscript" data-x-href="https://w3c.github.io/trusted-types/dist/spec/#trusted-script"><code>TrustedScript</code></dfn></li>
<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>
</ul>
</dd>
</dl>
Expand Down Expand Up @@ -108718,16 +108722,40 @@ dictionary <dfn dictionary>PromiseRejectionEventInit</dfn> : <span>EventInit</sp
security &mdash; that make implementation of private field semantics challenging, so our
implementation simply rejects those objects.</p>

<h5><dfn data-x="the-hostensurecancompilestrings-implementation">HostEnsureCanCompileStrings</dfn>(<var>realm</var>)</h5>
<h5><dfn
data-x="the-hostensurecancompilestrings-implementation">HostEnsureCanCompileStrings</dfn>(<var>realm</var>,
<var>parameterStrings</var>, <var>bodyString</var>, <var>compilationType</var>,
<var>parameterArgs</var>, <var>bodyArg</var>)</h5>

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

<ol>
<li><p>Perform ? <span
data-x="csp-EnsureCSPDoesNotBlockStringCompilation">EnsureCSPDoesNotBlockStringCompilation</span>(<var>realm</var>).
<ref>CSP</ref></p></li>
data-x="csp-EnsureCSPDoesNotBlockStringCompilation">EnsureCSPDoesNotBlockStringCompilation</span>(<var>realm</var>,
<var>parameterStrings</var>, <var>bodyString</var>, <var>compilationType</var>,
<var>parameterArgs</var>, <var>bodyArg</var>). <ref>CSP</ref></p></li>
</ol>

<h5><dfn
data-x="the-hostgetcodeforeval-implementation">HostGetCodeForEval</dfn>(<var>argument</var>)</h5>

<p>The <cite>Dynamic Code Brand Checks</cite> proposal contains an <span>implementation-defined</span> <span
data-x="js-HostGetCodeForEval">HostGetCodeForEval</span>(<var>argument</var>) abstract operation.
User agents must use the following implementation:
<ref>JSDYNAMICCODEBRANDCHECKS</ref>

<ol>
<li><p>If <var>argument</var> is a <code data-x="tt-trustedscript">TrustedScript</code> object,
then return <var>argument</var>'s <span data-x="tt-trustedscript-data">[[DATA]]</span> internal
slot.</p></li>

<li><p>Otherwise, return ~no-code~.
</ol>

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

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

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

<dt id="refsJSDYNAMICCODEBRANDCHECKS">[JSDYNAMICCODEBRANDCHECKS]</dt>
<dd><cite><a href="https://tc39.es/proposal-dynamic-code-brand-checks/">Dynamic code brand checks</a></cite>. Ecma International.</dd>

<dt id="refsJSIMPORTATTRIBUTES">[JSIMPORTATTRIBUTES]</dt>
<dd><cite><a href="https://tc39.es/proposal-import-attributes/">Import attributes</a></cite>. Ecma International.</dd>

Expand Down

0 comments on commit efe1eac

Please sign in to comment.