Skip to content

Commit

Permalink
Mostly-editorial fixes after conversation with neis
Browse files Browse the repository at this point in the history
- Properly propagate the *error*, not the *parse error*, during fetching
- "Parse error" is not accurate anymore; it became "pre-instantiation error"
- Can assert a stronger condition in HostResolveImportedModule
  • Loading branch information
domenic committed Jun 19, 2017
1 parent 04196a7 commit 5db819e
Showing 1 changed file with 30 additions and 22 deletions.
52 changes: 30 additions & 22 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -85868,13 +85868,20 @@ interface <dfn>NavigatorOnLine</dfn> {

</dd>

<dt>A <dfn data-x="concept-module-script-parse-error">parse error</dfn></dt>
<dt>A <dfn data-x="concept-module-script-pre-instantiation-error">pre-instantiation
error</dfn></dt>

<dd>

<p>A JavaScript value, which has meaning only if the <span
data-x="concept-module-script-module-record">module record</span> is null.</p>

<p class="note">This stores errors that will prevent the module from successfully instantiating,
such as parse errors or errors in its dependencies. A <span>module script</span> can also <span
data-x="concept-module-script-is-errored">be errored</span> due to errors recorded by the
JavaScript specification as part of its <span
data-x="concept-module-script-module-record">module record</span>.</p>

</dd>

<dt>A <dfn data-x="concept-module-script-credentials-mode">credentials mode</dfn></dt>
Expand Down Expand Up @@ -85913,13 +85920,13 @@ interface <dfn>NavigatorOnLine</dfn> {

<p>When a <span>module script</span> <span data-x="concept-module-script-is-errored">is
errored</span>, we say that its <dfn data-x="concept-module-script-error">error</dfn> is either
its <span data-x="concept-module-script-parse-error">parse error</span>, when its <span
data-x="concept-module-script-module-record">module record</span> is null, or its <span
data-x="concept-module-script-module-record">module record</span>'s [[ErrorCompletion]] field's
[[Value]] field, otherwise.</p>
its <span data-x="concept-module-script-pre-instantiation-error">pre-instantiation error</span>,
when its <span data-x="concept-module-script-module-record">module record</span> is null, or its
<span data-x="concept-module-script-module-record">module record</span>'s [[ErrorCompletion]]
field's [[Value]] field, otherwise.</p>

<p>To <dfn data-x="concept-module-script-set-parse-error">set the parse error</dfn> of a
<span>module script</span> <var>script</var>:</p>
<p>To <dfn data-x="concept-module-script-set-pre-instantiation-error">set the pre-instantiation
error</dfn> of a <span>module script</span> <var>script</var>:</p>

<ol>
<li><p>If <var>script</var>'s <span data-x="concept-module-script-module-record">module
Expand All @@ -85928,8 +85935,9 @@ interface <dfn>NavigatorOnLine</dfn> {
<li><p>Set <var>script</var>'s <span data-x="concept-module-script-module-record">module
record</span> to null.</p></li>

<li><p>Set <var>script</var>'s <span data-x="concept-module-script-parse-error">parse
error</span> to <var>error</var>.</p></li>
<li><p>Set <var>script</var>'s <span
data-x="concept-module-script-pre-instantiation-error">pre-instantiation error</span> to
<var>error</var>.</p></li>
</ol>

<p>We say that a <span>module script</span> <dfn
Expand Down Expand Up @@ -86548,17 +86556,17 @@ interface <dfn>NavigatorOnLine</dfn> {
these steps.</p></li>

<li><p>If <var>result</var> <span data-x="concept-module-script-is-errored">is errored</span>,
then <span data-x="concept-module-script-set-parse-error">set the parse error</span> for
<var>module script</var> to <var>result</var>'s <span
data-x="concept-module-script-parse-error">parse error</span>. Asynchronously complete this
algorithm with <var>module script</var>, aborting these steps.</p></li>
then <span data-x="concept-module-script-set-pre-instantiation-error">set the pre-instantiation
error</span> for <var>module script</var> to <var>result</var>'s <span
data-x="concept-module-script-error">error</span>. Asynchronously complete this algorithm with
<var>module script</var>, aborting these steps.</p></li>
</ol>

<div class="note">
<p>It is important to wait for all invocations to complete, and then iterate the results in
order, so that any fetching or parse errors are deterministically surfaced to the developer.
Otherwise, a module script graph with multiple errors would surface a nondeterministically
chosen error, making debugging quite difficult.</p>
order, so that any fetching or pre-instantiation errors are deterministically surfaced to the
developer. Otherwise, a module script graph with multiple errors would surface a
nondeterministically chosen error, making debugging quite difficult.</p>

<p>As an unobservable optimization, implementations can quit early if an invocation returns
null or an <span data-x="concept-module-script-is-errored">errored</span> <span>module
Expand Down Expand Up @@ -86676,8 +86684,8 @@ interface <dfn>NavigatorOnLine</dfn> {
<p>If <var>result</var> is a <span>List</span> of errors, then:</p>

<ol>
<li><p><span data-x="concept-module-script-set-parse-error">Set the parse error</span> of
<var>script</var> to <var>errors</var>[0].</p></li>
<li><p><span data-x="concept-module-script-set-pre-instantiation-error">Set the
pre-instantiation error</span> of <var>script</var> to <var>errors</var>[0].</p></li>

<li><p>Return <var>script</var>.</p></li>
</ol>
Expand All @@ -86697,8 +86705,8 @@ interface <dfn>NavigatorOnLine</dfn> {
<ol>
<li><p>Let <var>error</var> be a new <code>TypeError</code> exception.</p></li>

<li><p><span data-x="concept-module-script-set-parse-error">Set the parse error</span> of
<var>script</var> to <var>error</var>.</p></li>
<li><p><span data-x="concept-module-script-set-pre-instantiation-error">Set the
pre-instantiation error</span> of <var>script</var> to <var>error</var>.</p></li>

<li><p>Return <var>script</var>.</p></li>
</ol>
Expand Down Expand Up @@ -87689,8 +87697,8 @@ import "https://example.com/foo/../module2.js";</pre>
<li><p>Assert: <var>resolved module script</var> is a <span>module script</span> (i.e., is not
null or "<code data-x="">fetching</code>").</p></li>

<li><p>Assert: <var>resolved module script</var>'s <span
data-x="concept-module-script-module-record">module record</span> is not null.</p>
<li><p>Assert: <var>resolved module script</var> is not <span
data-x="concept-module-script-is-errored">errored</span>.</p>

<li><p>Return <var>resolved module script</var>'s <span
data-x="concept-module-script-module-record">module record</span>.</p></li>
Expand Down

0 comments on commit 5db819e

Please sign in to comment.