Skip to content

Commit

Permalink
Fix import() inside setTimeout()/setInterval() strings
Browse files Browse the repository at this point in the history
Closes #3116. Before this change, the "new script"-ness of setTimeout()
and setInterval()'s string compilation was making any import() calls
inside the compiled source behave unexpectedly. After this, they behave
like eval().
  • Loading branch information
domenic committed Dec 15, 2017
1 parent a6aac54 commit 81d77cf
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -91051,6 +91051,8 @@ document.body.appendChild(frame)</pre>
<li><p>Let <var>callerRealm</var> be the <span>current Realm Record</span>, and
<var>calleeRealm</var> be <var>method context</var>'s <span>JavaScript realm</span>.</p></li>

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

<li>

<p>Let <var>task</var> be a <span data-x="concept-task">task</span> that runs the
Expand Down Expand Up @@ -91085,20 +91087,39 @@ document.body.appendChild(frame)</pre>
<ol>
<li><p>Perform <span
data-x="the-hostensurecancompilestrings-implementation">HostEnsureCanCompileStrings</span>(<var>callerRealm</var>,
<var>calleeRealm</var>). If this throws an exception, catch it, and <span>report the
exception</span>.</p></li>
<var>calleeRealm</var>). If this throws an exception, catch it, <span>report the
exception</span>, and abort these steps.</p></li>

<li><p>Let <var>script source</var> be the first method argument.</p></li>

<li><p>Let <var>settings object</var> be <var>method context</var>'s <span>environment
settings object</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>base URL</var> be <var>active script</var>'s <span
data-x="concept-script-base-url">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>active
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>", and <span
data-x="concept-script-fetch-options-credentials">credentials mode</span> is <var>active
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>.</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
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>
</li>

<li><p>Let <var>script</var> be the result of <span>creating a classic script</span> given
<var>script source</var>, <var>settings object</var>, <var>base URL</var>, and the
<span>default classic script fetch options</span>.</p></li>
<var>script source</var>, <var>settings object</var>, <var>base URL</var>, and <var>fetch
options</var>.</p></li>

<li><p><span data-x="run a classic script">Run the classic script</span>
<var>script</var>.</p></li>
Expand Down

0 comments on commit 81d77cf

Please sign in to comment.