@@ -2751,6 +2751,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
27512751 <dfn data-x-href="https://mimesniff.spec.whatwg.org/#javascript-mime-type-essence-match">JavaScript MIME type essence match</dfn></li>
27522752 <li><dfn data-x-href="https://mimesniff.spec.whatwg.org/#json-mime-type">JSON MIME type</dfn></li>
27532753 <li><dfn data-x-href="https://mimesniff.spec.whatwg.org/#xml-mime-type">XML MIME type</dfn></li>
2754+ <li><dfn data-x-href="https://mimesniff.spec.whatwg.org/#webassembly-mime-type">WebAssembly MIME type</dfn></li>
27542755 </ul>
27552756
27562757 </dd>
@@ -2783,6 +2784,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
27832784 <li>the <dfn data-x-href="https://fetch.spec.whatwg.org/#requestcredentials"><code>RequestCredentials</code></dfn> enumeration</li>
27842785 <li>the <dfn data-x-href="https://fetch.spec.whatwg.org/#requestdestination"><code>RequestDestination</code></dfn> enumeration</li>
27852786 <li>the <dfn data-x-href="https://fetch.spec.whatwg.org/#dom-global-fetch"><code>fetch()</code></dfn> method</li>
2787+ <li><dfn data-x-href="https://fetch.spec.whatwg.org/#concept-body-consume-body">consume body</dfn></li>
27862788 <li>
27872789 <dfn data-x="concept-response"
27882790 data-x-href="https://fetch.spec.whatwg.org/#concept-response">response</dfn> and its
@@ -4180,6 +4182,17 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
41804182 </ul>
41814183 </dd>
41824184
4185+ <dt>WebAssembly JavaScript Module Integration</dt>
4186+
4187+ <dd>
4188+ <p>The following terms are defined in <cite>WebAssembly JavaScript Module Integration</cite>: <ref spec=WASMESM></p>
4189+
4190+ <ul class="brief">
4191+ <li><dfn data-x-href="https://webassembly.github.io/esm-integration/js-api/index.html#webassembly-module-record">WebAssembly Module Record</dfn></li>
4192+ <li><dfn data-x-href="https://webassembly.github.io/esm-integration/js-api/index.html#parse-a-webassembly-module">parse a WebAssembly module</dfn></li>
4193+ </ul>
4194+ </dd>
4195+
41834196 </dl>
41844197
41854198 <hr>
@@ -86768,7 +86781,7 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {
8676886781
8676986782 <h5>Definitions</h5>
8677086783
86771- <p>A <dfn data-x="concept-script" data-export="">script</dfn> is one of two possible <span
86784+ <p>A <dfn data-x="concept-script" data-export="">script</dfn> is one of three possible <span
8677286785 data-x="struct">structs</span>. All scripts have:</p>
8677386786
8677486787 <dl>
@@ -86781,8 +86794,10 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {
8678186794
8678286795 <dd><p>Either a <span>Script Record</span>, for <span data-x="classic script">classic
8678386796 scripts</span>; a <span>Source Text Module Record</span>, for <span data-x="module
86784- script">module scripts</span>; or null. In the former two cases, it represents a parsed script;
86785- null represents a failure parsing.</p></dd>
86797+ script">module scripts</span>; a <span>WebAssembly Module Record</span> for <span
86798+ data-x="WebAssembly module script">WebAssembly module scripts</span>; or null. In the
86799+ former two cases, it represents a parsed script; in the third case, a parsed WebAssembly
86800+ module; null represents a failure parsing.</p></dd>
8678686801
8678786802 <dt>A <dfn data-dfn-for="script" data-export="" data-x="concept-script-parse-error">parse
8678886803 error</dfn></dt>
@@ -86834,6 +86849,10 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {
8683486849 data-x="concept-script">script</span>. It has no additional <span data-x="struct
8683586850 item">items</span>.</p>
8683686851
86852+ <p>A <dfn data-export="">WebAssembly module script</dfn> is another type of <span
86853+ data-x="concept-script">script</span>. It has no additional <span data-x="struct
86854+ item">items</span>.</p>
86855+
8683786856 <p>The <dfn>active script</dfn> is determined by the following algorithm:</p>
8683886857
8683986858 <ol>
@@ -87472,25 +87491,48 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {
8747287491
8747387492 <li><p><var>response</var>'s <span data-x="concept-response-status">status</span> is not an
8747487493 <span>ok status</span></p></li>
87494+ </ul>
87495+ </li>
8747587496
87476- <li>
87477- <p>The result of <span data-x="extract a MIME type">extracting a MIME type</span> from
87478- <var>response</var>'s <span data-x="concept-response-header-list">header list</span> is not a
87479- <span>JavaScript MIME type< /span></p>
87497+ <li>
87498+ <p>Let <var>type</var> be the result of <span data-x="extract a MIME type">extracting a
87499+ MIME type</span> from <var>response</var>'s <span data-x="concept-response-header-list">header
87500+ list< /span>. </p>
8748087501
87481- <p class="note">For historical reasons, <span data-x="fetch a classic script">fetching a
87482- classic script</span> does not include MIME type checking. In contrast, module scripts will
87483- fail to load if they are not of a correct MIME type.</p>
87484- </li>
87485- </ul>
87502+ <p class="note">For historical reasons, <span data-x="fetch a classic script">fetching a
87503+ classic script</span> does not include MIME type checking. In contrast, module scripts'
87504+ interpretation is driven by their MIME type, and they will fail to load if they are not of
87505+ a supported MIME type.</p>
8748687506 </li>
8748787507
87488- <li><p>Let <var>source text</var> be the result of <span data-x="UTF-8 decode">UTF-8
87489- decoding</span> <var>response</var>'s <span data-x="concept-response-body">body</span>.</p></li>
87508+ <li><p>Let <var>module script</var> be null.</p></li>
8749087509
87491- <li><p>Let <var>module script</var> be the result of <span>creating a module script</span> given
87492- <var>source text</var>, <var>module map settings object</var>, <var>response</var>'s <span
87493- data-x="concept-response-url">url</span>, and <var>options</var>.</p></li>
87510+ <li>
87511+ <p>If <var>type</var> is a <span>JavaScript MIME type</span>, then:</p>
87512+
87513+ <ol>
87514+ <li><p>Let <var>source text</var> be the result of <span data-x="UTF-8 decode">UTF-8
87515+ decoding</span> <var>response</var>'s <span data-x="concept-response-body">body</span>.</p></li>
87516+
87517+ <li><p>Set <var>module script</var> to the result of <span>creating a module script</span> given
87518+ <var>source text</var>, <var>module map settings object</var>, <var>response</var>'s <span
87519+ data-x="concept-response-url">url</span>, and <var>options</var>.</p></li>
87520+ </ol>
87521+ </li>
87522+
87523+ <li>
87524+ <p>If <var>type</var> is a <span>WebAssembly MIME type</span>, then:</p>
87525+
87526+ <ol>
87527+ <li><p>Let <var>buffer</var> be the result of running <span>consume body</span> on
87528+ <var>response</var> with <i>ArrayBuffer</i>.</p></li>
87529+
87530+ <li><p>Set <var>module script</var> to the result of <span>creating a WebAssembly module
87531+ script</span> given <var>buffer</var>, <var>module map settings object</var>,
87532+ <var>response</var>'s <span data-x="concept-response-url">url</span>, and
87533+ <var>options</var>.</p></li>
87534+ </ol>
87535+ </li>
8749487536
8749587537 <li>
8749687538 <p><span data-x="map set">Set</span> <var>moduleMap</var>[<var>url</var>] to <var>module
@@ -87737,6 +87779,44 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {
8773787779 <li><p>Return <var>script</var>.</p></li>
8773887780 </ol>
8773987781
87782+ <p>To <dfn id="validate-requested-module-specifiers">validate requested module specifiers</dfn>
87783+ of a module record <var>record</var> for a script <var>script</var>:</p>
87784+
87785+ <ol>
87786+ <li>
87787+ <p><span data-x="list iterate">For each</span> string <var>requested</var> of
87788+ <var>record</var>.[[RequestedModules]]:</p>
87789+
87790+ <ol>
87791+ <li><p>Let <var>url</var> be the result of <span data-x="resolve a module specifier">resolving
87792+ a module specifier</span> given <var>script</var>'s <span data-x="concept-script-base-url">base
87793+ URL</span> and <var>requested</var>.</p></li>
87794+
87795+ <li>
87796+ <p>If <var>url</var> is failure, then:</p>
87797+
87798+ <ol>
87799+ <li><p>Let <var>error</var> be a new <code>TypeError</code> exception.</p></li>
87800+
87801+ <li><p>Set <var>script</var>'s <span data-x="concept-script-parse-error">parse error</span>
87802+ to <var>error</var>.</p></li>
87803+
87804+ <li><p>Return.</p></li>
87805+ </ol>
87806+ </li>
87807+ </ol>
87808+
87809+ </li>
87810+
87811+ <li><p>Set <var>script</var>'s <span data-x="concept-script-record">record</span> to
87812+ <var>result</var>.</p></li>
87813+ </ol>
87814+
87815+ <p class="note">This algorithm is essentially validating all of the requested module specifiers. We
87816+ treat a module with unresolvable module specifiers the same as one that cannot be parsed; in
87817+ both cases, a syntactic issue makes it impossible to ever contemplate instantiating the module
87818+ later.</p>
87819+
8774087820 <p>To <dfn data-x="creating a module script">create a module script</dfn>, given a
8774187821 <span>JavaScript string</span> <var>source</var>, an <span>environment settings object</span>
8774287822 <var>settings</var>, a <span>URL</span> <var>baseURL</var>, and some <span>script fetch
@@ -87781,37 +87861,56 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {
8778187861 </ol>
8778287862 </li>
8778387863
87784- <li id="validate-requested-module-specifiers">
87785- <p><span data-x="list iterate">For each</span> string <var>requested</var> of
87786- <var>result</var>.[[RequestedModules]]:</p>
87864+ <li><p><span>Validate requested module specifiers</span> of <var>result</var> with
87865+ <var>script</var>.</p></li>
8778787866
87788- <ol>
87789- <li><p>Let <var>url</var> be the result of <span data-x="resolve a module specifier">resolving
87790- a module specifier</span> given <var>script</var>'s <span data-x="concept-script-base-url">base
87791- URL</span> and <var>requested</var>.</p></li>
87867+ <li><p>Return <var>script</var>.</p></li>
87868+ </ol>
8779287869
87793- <li>
87794- <p>If <var>url</var> is failure, then:</p>
87870+ <p>To <dfn data-x="creating a WebAssembly module script">create a WebAssembly module script</dfn>,
87871+ given an <code data-x="idl-ArrayBuffer">ArrayBuffer</code> <var>buffer</var>, an
87872+ <span>environment settings object</span> <var>settings</var>, a <span>URL</span> <var>baseURL</var>,
87873+ and some <span>script fetch options</span> <var>options</var>:</p>
8779587874
87796- <ol>
87797- <li><p>Let <var>error</var> be a new <code>TypeError</code> exception.</p></li>
87875+ <ol>
87876+ <li><p>If <span data-x="concept-bc-noscript">scripting is disabled</span> for
87877+ <var>settings</var>'s <span>responsible browsing context</span>, then set <var>source</var> to
87878+ the empty string.</p></li>
8779887879
87799- <li><p>Set <var>script</var>'s <span data-x="concept-script-parse-error">parse error </span>
87800- to <var>error</var> .</p></li>
87880+ <li><p>Let <var>script</var> be a new <span>WebAssembly module script </span> that this algorithm
87881+ will subsequently initialize .</p></li>
8780187882
87802- <li><p>Return <var>script</var>.</p></li>
87803- </ol>
87804- </li>
87805- </ol>
87883+ <li><p>Set <var>script</var>'s <span>settings object</span> to <var>settings</var>.</p></li>
87884+
87885+ <li><p>Set <var>script</var>'s <span data-x="concept-script-base-url">base URL</span> to
87886+ <var>baseURL</var>.</p></li>
87887+
87888+ <li><p>Set <var>script</var>'s <span data-x="concept-script-script-fetch-options">fetch
87889+ options</span> to <var>options</var>.</p></li>
87890+
87891+ <li><p>Set <var>script</var>'s <span data-x="concept-script-parse-error">parse error</span> and
87892+ <span data-x="concept-script-error-to-rethrow">error to rethrow</span> to null.</p></li>
8780687893
87807- <p class="note">This step is essentially validating all of the requested module specifiers. We
87808- treat a module with unresolvable module specifiers the same as one that cannot be parsed; in
87809- both cases, a syntactic issue makes it impossible to ever contemplate instantiating the module
87810- later.</p>
87894+ <li>
87895+ <p>Let <var>module</var> be the result of <span>parse a WebAssembly module</span> given the
87896+ <code data-x="idl-ArrayBuffer">ArrayBuffer</code> <var>buffer</var>, <var>settings</var>'s
87897+ <span data-x="environment settings object's Realm">Realm</span>, and <var>script</var>.</p>
87898+
87899+ <p class="note">Passing <var>script</var> as the last parameter here ensures
87900+ <var>result</var>.[[HostDefined]] will be <var>script</var>.</p>
87901+
87902+ <p>If this algorithm throws an exception, then catch it and perform the following steps:</p>
87903+
87904+ <ol>
87905+ <li><p>Set <var>script</var>'s <span data-x="concept-script-parse-error">parse error</span> to
87906+ the exception.</li>
87907+
87908+ <li><p>Return <var>script</var>.</p></li>
87909+ </ol>
8781187910 </li>
8781287911
87813- <li><p>Set <var>script</var>'s <span data-x="concept-script-record">record</span> to
87814- <var>result </var>.</p></li>
87912+ <li><p><span>Validate requested module specifiers</span> of <var>module</var> with
87913+ <var>script </var>.</p></li>
8781587914
8781687915 <li><p>Return <var>script</var>.</p></li>
8781787916 </ol>
@@ -121512,6 +121611,9 @@ INSERT INTERFACES HERE
121512121611 <dt><dfn><code>application/xml</code></dfn></dt>
121513121612 <dd>XML <ref spec=XML> <ref spec=RFC7303></dd>
121514121613
121614+ <dt><dfn><code>application/wasm</code></dfn></dt>
121615+ <dd>WebAssembly <ref spec=WASM></dd>
121616+
121515121617 <dt><dfn><code>image/gif</code></dfn></dt>
121516121618 <dd>GIF images <ref spec=GIF></dd>
121517121619
@@ -122108,6 +122210,12 @@ INSERT INTERFACES HERE
122108122210 <dt id="refsUTR36">[UTR36]</dt>
122109122211 <dd>(Non-normative) <cite><a href="https://www.unicode.org/reports/tr36/">UTR #36: Unicode Security Considerations</a></cite>, M. Davis, M. Suignard. Unicode Consortium.</dd>
122110122212
122213+ <dt id="refsWASM">[WASM]</dt>
122214+ <dd><cite><a href="https://webassembly.github.io/spec/core/bikeshed/index.html">WebAssembly Core Specification</a></cite>, A. Rossberg. W3C.</dd>
122215+
122216+ <dt id="refsWASMESM">[WASMESM]</dt>
122217+ <dd><cite><a href="https://webassembly.github.io/esm-integration/js-api/index.html">WebAssembly JavaScript Module Integration</a></cite>, L. Clark, D. Ehrenberg. W3C.</dd>
122218+
122111122219 <dt id="refsWCAG">[WCAG]</dt>
122112122220 <dd>(Non-normative) <cite><a href="https://www.w3.org/TR/WCAG20/">Web Content Accessibility Guidelines (WCAG) 2.0</a></cite>, B. Caldwell, M. Cooper, L. Reid, G. Vanderheiden. W3C.</dd>
122113122221
0 commit comments