Skip to content

Commit

Permalink
Move check for unknown type assertion to 'create a module script'.
Browse files Browse the repository at this point in the history
  • Loading branch information
dandclark committed Oct 5, 2020
1 parent 6ed4474 commit c225d56
Showing 1 changed file with 31 additions and 20 deletions.
51 changes: 31 additions & 20 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -89661,6 +89661,21 @@ document.querySelector("button").addEventListener("click", bound);
<li><p>If <var>url</var> is failure, then asynchronously complete this algorithm with null, and
return.</p></li>

<li>
<p>If <var>moduleRequest</var>.[[Assertions]] has a <span>Record</span> <var>entry</var> such
that <var>entry</var>.[[Key]] is <code data-x="">"type"</code> then asynchronously complete this
algorithm with null, and return.</p>

<div class="note">
<p>Currently no non-JS module types are supported, so we conservatively fail if any type
assertion is provided. When support is added for other module types, the <code
data-x="">"type"</code> assertion will be used to check that the type of the fetched module
matches the type expected by the importer.</p>

<p>Assertions with unknown keys are ignored.</p>
</div>
</li>

<li><p><span>Fetch a single module script</span> given <var>url</var>, <var>settings
object</var>, "<code data-x="">script</code>", <var>options</var>, <var>settings object</var>,
"<code data-x="">client</code>", <var>moduleRequest</var>, and with the
Expand Down Expand Up @@ -90046,21 +90061,6 @@ document.querySelector("button").addEventListener("click", bound);
complete with either null (on failure) or a <span>module script</span> (on success).</p>

<ol>
<li>
<p>If <var>moduleRequest</var> was given and <var>moduleRequest</var>.[[Assertions]] has a
<span>Record</span> <var>entry</var> such that <var>entry</var>.[[Key]] is <code
data-x="">"type"</code>, then asynchronously complete this algorithm with null, and return.</p>

<div class="note">
<p>Currently no non-JS module types are supported, so we conservatively fail
if any type is specified. When support is added for other module types, the <code
data-x="">"type"</code> assertion will be used to check that the type of the fetched module
matches the type expected by the importer.</p>

<p>Assertions with unknown keys are ignored.</p>
</div>
</li>

<li><p>Let <var>moduleMap</var> be <var>module map settings object</var>'s <span
data-x="concept-settings-object-module-map">module map</span>.</p></li>

Expand Down Expand Up @@ -90317,7 +90317,9 @@ document.querySelector("button").addEventListener("click", bound);
URL</span> and <var>requested.[[Specifier]]</var>.</p></li>

<li>
<p>If <var>url</var> is failure, then:</p>
<p>If <var>url</var> is failure, or if <var>requested</var>.[[Assertions]] has a
<span>Record</span> <var>entry</var> such that <var>entry</var>.[[Key]] is <code
data-x="">"type"</code> then:</p>

<ol>
<li><p>Let <var>error</var> be a new <code>TypeError</code> exception.</p></li>
Expand All @@ -90330,10 +90332,19 @@ document.querySelector("button").addEventListener("click", bound);
</li>
</ol>

<p class="note">This step is essentially validating all of the requested module specifiers. We
treat a module with unresolvable module specifiers the same as one that cannot be parsed; in
both cases, a syntactic issue makes it impossible to ever contemplate linking the module
later.</p>
<div class="note">
<p>This step is essentially validating all of the requested module specifiers and type
assertions. We treat a module with unresolvable module specifiers or an unsupported type
assertion the same as one that cannot be parsed; in both cases, a syntactic issue makes
it impossible to ever contemplate linking the module later.</p>

<p>Currently no non-JS module types are supported, so we conservatively fail if any type
assertion is provided. When support is added for other module types, the <code
data-x="">"type"</code> assertion will be used to check that the type of the fetched module
matches the type expected by the importer.</p>

<p>Assertions with unknown keys are ignored.</p>
</div>
</li>

<li><p>Set <var>script</var>'s <span data-x="concept-script-record">record</span> to
Expand Down

0 comments on commit c225d56

Please sign in to comment.