Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON module support #4407

Merged
merged 11 commits into from
May 17, 2019
Prev Previous commit
Next Next commit
Improving formatting, fixing typos
  • Loading branch information
littledan authored and domenic committed May 7, 2019
commit eab8fe525f25df136e164bcd91236f512fc7d424
30 changes: 19 additions & 11 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -86680,11 +86680,22 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {

<dt>A <dfn data-dfn-for="script" data-export="" data-x="concept-script-record">record</dfn></dt>

<dd><p>Either a <span>Script Record</span>, for <span data-x="classic script">classic
scripts</span>; a <span>Source Text Module Record</span>, for <span data-x="JavaScript module
script">JavaScript module scripts</span>; a <span>Synthetic Module Record</span> for <span
data-x="JSON module script">JSON module scripts</span>; or null. In all but the last case, it
represents a parsed script; null represents a failure parsing.</p></dd>
<dd>
<p>One of the following:</p>

<ul>
<li><p><span>Script Record</span>, for <span data-x="classic script">classic
scripts</span></p></li>

<li><p>a <span>Source Text Module Record</span>, for <span data-x="JavaScript module
script">JavaScript module scripts</span></p></li>

<li><p><span>Synthetic Module Record</span>, for <span data-x="JSON module script">JSON module
scripts</span></p></li>

<li><p>null, representing a parsing failure.</p></li>
</ul>
</dd>

<dt>A <dfn data-dfn-for="script" data-export="" data-x="concept-script-parse-error">parse
error</dfn></dt>
Expand Down Expand Up @@ -86737,17 +86748,17 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {
item">items</span>.</p>

<p>This specification defines multiple types of module scripts. None of these have additional
<span data-x="struct item">items</span></p>
<span data-x="struct item">items</span>.</p>

<ul>
<li><p>A <dfn data-export="">JavaScript module script</dfn> represents a JavaScript <span>Source
Text Module Record</span>.</p></li>

<li><p>A <dfn data-export="">JSON module script</dfn> represents a parsed JSON document.</p>
<li><p>A <dfn data-export="">JSON module script</dfn> represents a parsed JSON document.
As JSON documents do import dependent modules and do not throw exceptions on execution,
the <span data-x="concept-script-script-fetch-options">fetch options</span> and <span
data-x="concept-script-base-url">base URL</span> of a <span>JSON module script</span>
are always null.</li>
are always null.</p></li>
</ul>

<p>The <dfn>active script</dfn> is determined by the following algorithm:</p>
Expand Down Expand Up @@ -89001,9 +89012,6 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
<li><p>Assert: Neither <var>base URL</var> nor <var>fetch options</var> is null, as
<var>referencing script</var> is a <span>classic script</span> or a <span>JavaScript module
script</span>.</p></li>

<li><p>Assert: is not null, since this algorithm is always called
from a <span>classic script</span> or a <span>JavaScript module script</span>.</p></li>
</ol>

<p class="note">As explained above for <span>HostResolveImportedModule</span>, in the common
Expand Down