Skip to content

Commit bf558ea

Browse files
committed
Integrate with latest ECMA-262 import attributes
1 parent 3e82df4 commit bf558ea

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

document/js-api/index.bs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMASCRIPT
110110
text: ToBigInt64; url: sec-tobigint64
111111
text: Module Namespace exotic object; url: sec-module-namespace-exotic-objects
112112
text: ResolvedBinding Record; url: resolvedbinding-record
113+
text: ModuleRequest Record; url: modulerequest-record
114+
text: ImportAttribute Record; url: importattribute-record
113115
type: abstract-op
114116
text: CreateDataPropertyOrThrow; url: sec-createdatapropertyorthrow
115117
text: CreateMethodProperty; url: sec-createmethodproperty
@@ -286,11 +288,15 @@ urlPrefix: https://tc39.es/proposal-resizablearraybuffer/; spec: ResizableArrayB
286288
text: handled; url: sec-hostresizearraybuffer
287289
text: IsFixedLengthArrayBuffer; url: sec-isfixedarraybuffer
288290
text: HostResizeArrayBuffer; url: sec-hostresizearraybuffer
291+
urlPrefix: https://url.spec.whatwg.org/; spec: URL
292+
type: dfn
293+
text: application/x-www-form-urlencoded string parsing; url: concept-urlencoded-string-parser
289294
</pre>
290295

291296
<pre class='link-defaults'>
292297
spec:infra; type:dfn; text:list
293298
spec:infra; type:dfn; text:byte sequence
299+
spec:infra; type:dfn; text:scalar value string
294300
spec:ecma-262; type:exception; for:ECMAScript; text:Error
295301
spec:ecmascript; type:exception; for:ECMAScript; text:TypeError
296302
spec:ecmascript; type:exception; for:ECMAScript; text:RangeError
@@ -2320,7 +2326,8 @@ To <dfn export>parse a WebAssembly module</dfn> given a <a>byte sequence</a> |by
23202326
1. Throw a {{LinkError}} exception.
23212327
1. Note: The following step only applies when integrating with the JS String Builtins proposal.
23222328
1. If [=Find a builtin=] with (|moduleName|, |name|, |type|) and builtins |module|.\[[BuiltinSets]] is not null, then [=iteration/continue=].
2323-
1. [=set/Append=] |moduleName| to |requestedModules|.
2329+
1. Let |moduleRequest| be the [=module request=] for |moduleName| and |name|.
2330+
1. [=set/Append=] |moduleRequest| to |requestedModules|.
23242331
1. For each (|name|, <var ignore>type</var>) in [=module_exports=](|module|.\[[Module]])
23252332
1. If |name| starts with the prefix "wasm:" or "wasm-js:",
23262333
1. Throw a {{LinkError}} exception.
@@ -2364,6 +2371,21 @@ The <dfn>export name list</dfn> of a WebAssembly Module Record |record| is defin
23642371

23652372
</div>
23662373

2374+
<div algorithm>
2375+
The <dfn>module request</dfn> for a string |moduleName| and a string |name| is defined by the following algorithm:
2376+
2377+
1. Let |attributes| be an empty [=set=].
2378+
1. If |name| is a [=scalar value string=] and contains the string "?",
2379+
1. Let |query| be the substring of |name| after the index of "?".
2380+
1. Let |params| be the result of [=application/x-www-form-urlencoded string parsing|parsing=] |query|.
2381+
1. For each (|key|, |value|) in |params|
2382+
1. Let |attribute| be the [=ImportAttribute Record=] { [[Key]]: |key|, [[Value]]: |value| }.
2383+
1. [=set/Append=] |attribute| to |attributes|.
2384+
1. Let |moduleRequest| be a new [=ModuleRequest Record=] { [[Specifier]]: |moduleName|, [[Attributes]]: |attributes| }.
2385+
1. Return |moduleRequest|.
2386+
2387+
</div>
2388+
23672389
WebAssembly Module Records have the following methods:
23682390

23692391
<div algorithm=GetExportedNames>
@@ -2411,7 +2433,8 @@ WebAssembly Module Records have the following methods:
24112433
1. [=list/iterate|For each=] (|importedModuleName|, |name|, |importtype|) in [=module_imports=](|module|),
24122434
1. Note: The following step only applies when integrating with the JS String Builtins proposal.
24132435
1. If [=Find a builtin=] with (|importedModuleName|, |name|) and builtins |module|.\[[BuiltinSets]] is not null, then [=iteration/continue=].
2414-
1. Let |importedModule| be [$GetImportedModule$](|record|, |importedModuleName|).
2436+
1. Let |moduleRequest| be the [=module request=] for |importedModuleName| and |name|.
2437+
1. Let |importedModule| be [$GetImportedModule$](|record|, |moduleRequest|).
24152438
1. Let |resolution| be |importedModule|.ResolveExport(|name|).
24162439
1. Assert: |resolution| is a [=ResolvedBinding Record=], as validated during environment initialization.
24172440
1. Let |resolvedModule| be |resolution|.\\[[Module]].

0 commit comments

Comments
 (0)