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 19, 2018
1 parent 5355e33 commit 8c99a14
Showing 1 changed file with 32 additions and 38 deletions.
70 changes: 32 additions & 38 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -88574,57 +88574,51 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
case, <var>referencingScriptOrModule</var> is non-null.</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>base URL</var> 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>base URL</var> and <var>specifier</var>.</p></li>

<li>
<p>If <var>url</var> is failure, then:</p>
<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>Fetch a module script graph</span> given <var>url</var>, <var>settings
object</var>, "<code data-x="">script</code>", and <var>fetch 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>settings object</var>,
"<code data-x="">script</code>", and <var>fetch 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 8c99a14

Please sign in to comment.