Skip to content

Commit

Permalink
Fix setTimeout() when there's no active script
Browse files Browse the repository at this point in the history
Closes #9633.
  • Loading branch information
domenic committed Sep 24, 2023
1 parent d6ce12a commit 8d997ba
Showing 1 changed file with 30 additions and 26 deletions.
56 changes: 30 additions & 26 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -109411,9 +109411,6 @@ enum <dfn enum>DOMParserSupportedType</dfn> {

<li><p>Let <var>initiating script</var> be the <span>active script</span>.</p></li>

<li><p><span>Assert</span>: <var>initiating script</var> is not null, since this algorithm is
always called from some script.</p></li>

<li>
<p>Let <var>task</var> be a <span data-x="concept-task">task</span> that runs the following
substeps:</p>
Expand Down Expand Up @@ -109442,32 +109439,39 @@ enum <dfn enum>DOMParserSupportedType</dfn> {
<li><p>Let <var>settings object</var> be <var>global</var>'s <span>relevant settings
object</span>.</p></li>

<li><p>Let <var>base URL</var> be <var>initiating script</var>'s <span
data-x="concept-script-base-url">base URL</span>.</p></li>
<li><p>Let <var>fetch options</var> be the <span>default classic script fetch
options</span>.</p></li>

<li><p><span>Assert</span>: <var>base URL</var> is not null, as <var>initiating script</var>
is a <span>classic script</span> or a <span>JavaScript module script</span>.</p></li>
<li><p>Let <var>base URL</var> be <var>settings object</var>'s <span>API base
URL</span>.</p></li>

<li>
<p>Let <var>fetch options</var> be a <span>script fetch options</span> whose <span
data-x="concept-script-fetch-options-nonce">cryptographic nonce</span> is <var>initiating
script</var>'s <span data-x="concept-script-script-fetch-options">fetch options</span>'s
<span data-x="concept-script-fetch-options-nonce">cryptographic nonce</span>, <span
data-x="concept-script-fetch-options-integrity">integrity metadata</span> is the empty
string, <span data-x="concept-script-fetch-options-parser">parser metadata</span> is "<code
data-x="">not-parser-inserted</code>", <span
data-x="concept-script-fetch-options-credentials">credentials mode</span> is
<var>initiating script</var>'s <span data-x="concept-script-script-fetch-options">fetch
options</span>'s <span data-x="concept-script-fetch-options-credentials">credentials
mode</span>, <span data-x="concept-script-fetch-options-referrer-policy">referrer
policy</span> is <var>initiating script</var>'s <span
data-x="concept-script-script-fetch-options">fetch options</span>'s <span
data-x="concept-script-fetch-options-referrer-policy">referrer policy</span>, and <span
data-x="concept-script-fetch-options-fetch-priority">fetch priority</span> is "<code
data-x="">auto</code>".</p>

<p class="note">The effect of these options ensures that the string compilation done by
<code data-x="dom-setTimeout">setTimeout()</code> and <code
<p>If <var>initiating script</var> is not null, then:</p>

<ol>
<li><p>Set <var>fetch options</var> to a <span>script fetch options</span> whose <span
data-x="concept-script-fetch-options-nonce">cryptographic nonce</span> is <var>initiating
script</var>'s <span data-x="concept-script-script-fetch-options">fetch options</span>'s
<span data-x="concept-script-fetch-options-nonce">cryptographic nonce</span>, <span
data-x="concept-script-fetch-options-integrity">integrity metadata</span> is the empty
string, <span data-x="concept-script-fetch-options-parser">parser metadata</span> is
"<code data-x="">not-parser-inserted</code>", <span
data-x="concept-script-fetch-options-credentials">credentials mode</span> is
<var>initiating script</var>'s <span data-x="concept-script-script-fetch-options">fetch
options</span>'s <span data-x="concept-script-fetch-options-credentials">credentials
mode</span>, <span data-x="concept-script-fetch-options-referrer-policy">referrer
policy</span> is <var>initiating script</var>'s <span
data-x="concept-script-script-fetch-options">fetch options</span>'s <span
data-x="concept-script-fetch-options-referrer-policy">referrer policy</span>, and <span
data-x="concept-script-fetch-options-fetch-priority">fetch priority</span> is "<code
data-x="">auto</code>".</p></li>

<li><p>Set <var>base URL</var> to <var>initiating script</var>'s <span
data-x="concept-script-base-url">base URL</span>.</p></li>
</ol>

<p class="note">The effect of these steps ensures that the string compilation done by <code
data-x="dom-setTimeout">setTimeout()</code> and <code
data-x="dom-setInterval">setInterval()</code> behaves equivalently to that done by
<code>eval()</code>. That is, <span>module script</span> fetches via <code>import()</code>
will behave the same in both contexts.</p>
Expand Down

0 comments on commit 8d997ba

Please sign in to comment.