Skip to content

Commit

Permalink
Do not run FinishDynamicImport steps in parallel
Browse files Browse the repository at this point in the history
These steps do a variety of things that only make sense back on the main thread.
The intention here was that fetching not block the main thread. However, that is
already the case even without going in parallel, given the "async algorithm"
framework of the script-fetching algorithms. (That framework is admittedly a bit
unclear; see whatwg/infra#181.)
  • Loading branch information
domenic committed Nov 20, 2018
1 parent b921d02 commit adf732f
Showing 1 changed file with 37 additions and 43 deletions.
80 changes: 37 additions & 43 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -88519,63 +88519,57 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
<li><p>Let <var>referencing script</var> be
<var>referencingScriptOrModule</var>.[[HostDefined]].</p></li>

<li><p>Let <var>url</var> be the result of <span data-x="resolve a module specifier">resolving a
module specifier</span> given <var>referencing script</var>'s <span
data-x="concept-script-base-url">base URL</span> and <var>specifier</var>.</p></li>

<li>
<p>Run the following steps <span>in parallel</span>:</p>
<p>If <var>url</var> is failure, then:</p>

<ol>
<li><p>Let <var>url</var> be the result of <span data-x="resolve a module specifier">resolving a
module specifier</span> given <var>referencing script</var>'s <span
data-x="concept-script-base-url">base URL</span> and <var>specifier</var>.</p></li>
<li><p>Let <var>completion</var> be Completion { [[Type]]: throw, [[Value]]: a new
<code>TypeError</code>, [[Target]]: empty }.</p></li>

<li>
<p>If <var>url</var> is failure, then:</p>
<li><p>Perform <span>FinishDynamicImport</span>(<var>referencingScriptOrModule</var>,
<var>specifier</var>, <var>promiseCapability</var>, <var>completion</var>).</p></li>

<ol>
<li><p>Let <var>completion</var> be Completion { [[Type]]: throw, [[Value]]: a new
<code>TypeError</code>, [[Target]]: empty }.</p></li>

<li><p>Perform <span>FinishDynamicImport</span>(<var>referencingScriptOrModule</var>,
<var>specifier</var>, <var>promiseCapability</var>, <var>completion</var>).</p></li>

<li><p>Return.</p></li>
</ol>
</li>
<li><p>Return.</p></li>
</ol>
</li>

<li><p>Let <var>options</var> be the <span>descendant script fetch options</span> for
<var>referencing script</var>'s <span data-x="concept-script-script-fetch-options">fetch
options</span>.</p></li>
<li><p>Let <var>options</var> be the <span>descendant script fetch options</span> for
<var>referencing script</var>'s <span data-x="concept-script-script-fetch-options">fetch
options</span>.</p></li>

<li><p><span>Fetch a module script graph</span> given <var>url</var>, <var>referencing
script</var>'s <span>settings object</span>, "<code data-x="">script</code>", and
<var>options</var>. Wait until the algorithm asynchronously completes with
<var>result</var>.</p></li>
<li><p><span>Fetch a module script graph</span> given <var>url</var>, <var>referencing
script</var>'s <span>settings object</span>, "<code data-x="">script</code>", and
<var>options</var>. Wait until the algorithm asynchronously completes with
<var>result</var>.</p></li>

<li>
<p>If <var>result</var> is null, then:</p>
<li>
<p>If <var>result</var> is null, then:</p>

<ol>
<li><p>Let <var>completion</var> be Completion { [[Type]]: throw, [[Value]]: a new
<code>TypeError</code>, [[Target]]: empty }.</p></li>
<ol>
<li><p>Let <var>completion</var> be Completion { [[Type]]: throw, [[Value]]: a new
<code>TypeError</code>, [[Target]]: empty }.</p></li>

<li><p>Perform <span>FinishDynamicImport</span>(<var>referencingScriptOrModule</var>,
<var>specifier</var>, <var>promiseCapability</var>, <var>completion</var>).</p></li>
<li><p>Perform <span>FinishDynamicImport</span>(<var>referencingScriptOrModule</var>,
<var>specifier</var>, <var>promiseCapability</var>, <var>completion</var>).</p></li>

<li><p>Return.</p></li>
</ol>
</li>
<li><p>Return.</p></li>
</ol>
</li>

<li><p><span data-x="run a module script">Run the module script</span> <var>result</var>, with
the rethrow errors boolean set to true.</p></li>
<li><p><span data-x="run a module script">Run the module script</span> <var>result</var>, with
the rethrow errors boolean set to true.</p></li>

<li><p>If running the module script throws an exception, then perform
<span>FinishDynamicImport</span>(<var>referencingScriptOrModule</var>, <var>specifier</var>,
<var>promiseCapability</var>, the thrown exception completion).</p></li>
<li><p>If running the module script throws an exception, then perform
<span>FinishDynamicImport</span>(<var>referencingScriptOrModule</var>, <var>specifier</var>,
<var>promiseCapability</var>, the thrown exception completion).</p></li>

<li><p>Otherwise, perform
<span>FinishDynamicImport</span>(<var>referencingScriptOrModule</var>, <var>specifier</var>,
<var>promiseCapability</var>, <span>NormalCompletion</span>(undefined)).</p></li>
</ol>
</li>
<li><p>Otherwise, perform
<span>FinishDynamicImport</span>(<var>referencingScriptOrModule</var>, <var>specifier</var>,
<var>promiseCapability</var>, <span>NormalCompletion</span>(undefined)).</p></li>

<li><p>Return undefined.</p></li>
</ol>
Expand Down

0 comments on commit adf732f

Please sign in to comment.