From 353d16a7aef80867494b3a50f059a15a205ff8a2 Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Thu, 26 Mar 2026 10:19:00 -0500 Subject: [PATCH 01/21] [js-api] Fix Instance constructor variable shadowing |module| was overwritten with its [[Module]] slot before reading [[BuiltinSets]] and [[ImportedStringModule]], which are slots on the JS Module wrapper, not the internal module. --- document/js-api/index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/document/js-api/index.bs b/document/js-api/index.bs index 97bb29464f..348e091c35 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -788,9 +788,9 @@ interface Instance {
The Instance(|module|, |importObject|) constructor, when invoked, runs the following steps: - 1. Let |module| be |module|.\[[Module]]. 1. Let |builtinSetNames| be |module|.\[[BuiltinSets]]. 1. Let |importedStringModule| be |module|.\[[ImportedStringModule]]. + 1. Let |module| be |module|.\[[Module]]. 1. [=Read the imports=] of |module| with imports |importObject|, |builtinSetNames|, and |importedStringModule|, and let |imports| be the result. 1. [=Instantiate the core of a WebAssembly module=] |module| with |imports|, and let |instance| be the result. 1. [=initialize an instance object|Initialize=] **this** from |module| and |instance|. From b891da53fa9f66691b2b4e2613d6d4e67bf3b419 Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Thu, 26 Mar 2026 12:09:11 -0500 Subject: [PATCH 02/21] [js-api] Fix If/Else-if for objectkind in ToWebAssemblyValue --- document/js-api/index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/document/js-api/index.bs b/document/js-api/index.bs index 348e091c35..d24b9a7b61 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -1466,7 +1466,7 @@ The algorithm ToWebAssemblyValue(|v|, |type|) coerces a JavaScript va 1. Let |objectkind| be the value of |v|'s \[[ObjectKind]] internal slot. 1. If |objectkind| is "array", 1. Let |r| be [=ref.array=] |objectaddr|. - 1. If |objectkind| is "struct", + 1. Else if |objectkind| is "struct", 1. Let |r| be [=ref.struct=] |objectaddr|. 1. Else, 1. Let |map| be the [=surrounding agent=]'s associated [=host value cache=]. From 0afdf98044f1d101357c660f453658f080539661 Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Thu, 26 Mar 2026 12:09:17 -0500 Subject: [PATCH 03/21] [js-api] Fix loop variable shadowing in Tag constructor --- document/js-api/index.bs | 4 ++-- document/legacy/exceptions/js-api/index.bs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/document/js-api/index.bs b/document/js-api/index.bs index d24b9a7b61..dd7a60ecdf 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -1559,8 +1559,8 @@ The new Tag(|type|) constructor 1. Let |parameters| be |type|["parameters"]. 1. Let |wasmParameters| be «». -1. [=list/iterate|For each=] |type| of |parameters|, - 1. [=list/Append=] [=ToValueType=](|type|) to |wasmParameters|. +1. [=list/iterate|For each=] |paramType| of |parameters|, + 1. [=list/Append=] [=ToValueType=](|paramType|) to |wasmParameters|. 1. Let |store| be the current agent's [=associated store=]. 1. Let (|store|, |tagAddress|) be [=tag_alloc=](|store|, |wasmParameters|). 1. Set the current agent's [=associated store=] to |store|. diff --git a/document/legacy/exceptions/js-api/index.bs b/document/legacy/exceptions/js-api/index.bs index e7db140740..6eaf8dac8b 100644 --- a/document/legacy/exceptions/js-api/index.bs +++ b/document/legacy/exceptions/js-api/index.bs @@ -1213,8 +1213,8 @@ The new Tag(|type|) constructor 1. Let |parameters| be |type|["parameters"]. 1. Let |wasmParameters| be «». -1. [=list/iterate|For each=] |type| of |parameters|, - 1. [=list/Append=] [=ToValueType=](|type|) to |wasmParameters|. +1. [=list/iterate|For each=] |paramType| of |parameters|, + 1. [=list/Append=] [=ToValueType=](|paramType|) to |wasmParameters|. 1. Let |store| be the current agent's [=associated store=]. 1. Let (|store|, |tagAddress|) be [=tag_alloc=](|store|, |wasmParameters|). 1. Set the current agent's [=associated store=] to |store|. From 22643b7e6b39df799f180b9912b238ce64df98f9 Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Thu, 26 Mar 2026 12:29:01 -0500 Subject: [PATCH 04/21] [js-api] Fix signed_31 variable in ToWebAssemblyValue i31ref conversion The condition used i31 on both sides of signed_31(), making it a circular tautology. Every other similar conversion in the algorithm uses the unsigned variable (e.g. signed_64(u64)). Change to u31. --- document/js-api/index.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/document/js-api/index.bs b/document/js-api/index.bs index dd7a60ecdf..7f675b58d3 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -1458,8 +1458,8 @@ The algorithm ToWebAssemblyValue(|v|, |type|) coerces a JavaScript va 1. Let |funcaddr| be the value of |v|'s \[[FunctionAddress]] internal slot. 1. Let |r| be [=ref.func=] |funcaddr|. 1. Else if |v| [=is a Number=] and |v| is equal to [=?=] [$ToInt32$](|v|) and [=ℝ=](|v|) < 230 and [=ℝ=](|v|) ⩾ -230, - 1. Let |i31| [=?=] [$ToInt32$](|v|). - 1. Let |u31| be the unsigned integer such that |i31| is [=signed_31=](|i31|). + 1. Let |i31| be [=?=] [$ToInt32$](|v|). + 1. Let |u31| be the unsigned integer such that |i31| is [=signed_31=](|u31|). 1. Let |r| be [=ref.i31=] |u31|. 1. Else if |v| is an [=Exported GC Object=], 1. Let |objectaddr| be the value of |v|'s \[[ObjectAddress]] internal slot. From 2142df7b6ccf71b7543cc4b2c0a9cfc806c4c8f1 Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Thu, 26 Mar 2026 12:15:38 -0500 Subject: [PATCH 05/21] [js-api] Fix create a builtin function: missing store and wrong variable name |store| was used without being retrieved first, and |functype| didn't match the parameter name |funcType|. --- document/js-api/index.bs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/document/js-api/index.bs b/document/js-api/index.bs index 7f675b58d3..a0048486b4 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -1876,7 +1876,8 @@ To validate builtin set names with |builtinSetNames|, perform the fol To create a builtin function from type |funcType| and execution steps |steps|, perform the following steps: 1. Let |hostfunc| be a [=host function=] which executes |steps| when called. -1. Let (|store|, |funcaddr|) be [=func_alloc=](|store|, |functype|, |hostfunc|). +1. Let |store| be the [=surrounding agent=]'s [=associated store=]. +1. Let (|store|, |funcaddr|) be [=func_alloc=](|store|, |funcType|, |hostfunc|). 1. Set the [=surrounding agent=]'s [=associated store=] to |store|. 1. Return |funcaddr|. From 739dd9df115f4c5d7d6cb7a9d35d51107611b681 Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Thu, 26 Mar 2026 12:29:09 -0500 Subject: [PATCH 06/21] [js-api] Fix wrong index into maybeBuiltin in validate an import for builtins find a builtin returns (builtinSetName, builtin) where builtin is (name, funcType, steps). The funcType is at maybeBuiltin[1][1], not maybeBuiltin[0][1] which indexes into the string name. --- document/js-api/index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/document/js-api/index.bs b/document/js-api/index.bs index a0048486b4..02e5d8c628 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -1907,7 +1907,7 @@ To validate an import for builtins with |import|, enabled builtins |b 1. Let |maybeBuiltin| be the result of [=find a builtin|finding a builtin=] for |import| and |builtinSetNames|. 1. If |maybeBuiltin| is null, return true. 1. Let |importExternType| be |import|[2]. -1. Let |builtinFuncType| be |maybeBuiltin|[0][1]. +1. Let |builtinFuncType| be |maybeBuiltin|[1][1]. 1. Let |builtinExternType| be `func |builtinFuncType|`. 1. Return [=match_externtype=](|builtinExternType|, |importExternType|). From d714e1e4d838b5d1c30230262134b16105205b1f Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Thu, 26 Mar 2026 12:29:35 -0500 Subject: [PATCH 07/21] [js-api] Use embedding spec tag_alloc instead of a local definition Remove the js-api's local tag_alloc(store, parameters) and replace all callers with the embedding spec's tag_alloc(store, tagtype), passing an inline functype as the tag type. --- document/js-api/index.bs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/document/js-api/index.bs b/document/js-api/index.bs index 02e5d8c628..47b8d4bae9 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -1513,8 +1513,6 @@ The algorithm U64ToAddressValue(|v|, |addrtype|) converts a [=u64=] v

Tags

-The tag_alloc(|store|, |parameters|) algorithm creates a new [=tag address=] for |parameters| in |store| and returns the updated store and the [=tag address=]. -

Tag types

@@ -1562,7 +1560,7 @@ The new Tag(|type|) constructor
 1. [=list/iterate|For each=] |paramType| of |parameters|,
     1. [=list/Append=] [=ToValueType=](|paramType|) to |wasmParameters|.
 1. Let |store| be the current agent's [=associated store=].
-1. Let (|store|, |tagAddress|) be [=tag_alloc=](|store|, |wasmParameters|).
+1. Let (|store|, |tagAddress|) be [=tag_alloc=](|store|, |wasmParameters| → « »).
 1. Set the current agent's [=associated store=] to |store|.
 1. [=initialize a Tag object|Initialize=] **this** from |tagAddress|.
 

From cb00bcab84065418a990a1e8e1f86d7523754b82 Mon Sep 17 00:00:00 2001
From: Ryan Hunt 
Date: Thu, 26 Mar 2026 14:50:00 -0500
Subject: [PATCH 08/21] [js-api] Use ToJSValue to unwrap JSTag exception
 payload

When re-throwing a JS exception that was caught by WebAssembly,
the payload is a list of WebAssembly values from exn_read. For
the JSTag, payload[0] is ref.extern (ref.host hostaddr), not a
raw host address. Passing it directly to 'retrieving a host
value' is wrong since that algorithm expects a host address
integer. Use ToJSValue to correctly unwrap the value.
---
 document/js-api/index.bs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/document/js-api/index.bs b/document/js-api/index.bs
index 47b8d4bae9..a00ec06d9d 100644
--- a/document/js-api/index.bs
+++ b/document/js-api/index.bs
@@ -1304,7 +1304,7 @@ This slot holds a [=function address=] relative to the [=surrounding agent=]'s [
         1. Let |payload| be [=exn_read=](|store|, |exnaddr|).
         1. Let |jsTagAddr| be the result of [=get the JavaScript exception tag |getting the JavaScript exception tag=].
         1. If |tagaddr| is equal to |jsTagAddr|,
-            1. Throw the result of [=retrieving a host value=] from |payload|[0].
+            1. Throw [=!=] [=ToJSValue=](|payload|[0]).
         1. Otherwise,
             1. Let |exception| be [=create an Exception object|a new Exception=] created from |exnaddr|.
             1. Throw |exception|.

From 66662e8f92eee06eb09677cbe11298c490600ad6 Mon Sep 17 00:00:00 2001
From: Ryan Hunt 
Date: Thu, 26 Mar 2026 12:29:45 -0500
Subject: [PATCH 09/21] [js-api] Fix missing type argument to
 ToWebAssemblyValue in intoCharCodeArray

ToWebAssemblyValue takes two arguments (value, type). The call was
missing the element type. The array type is (array (mut i16)) whose
elements are stored as i32.
---
 document/js-api/index.bs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/document/js-api/index.bs b/document/js-api/index.bs
index a00ec06d9d..60d4db9b6b 100644
--- a/document/js-api/index.bs
+++ b/document/js-api/index.bs
@@ -2020,7 +2020,7 @@ When this builtin is invoked with parameters |string|, |array|, and |start|, the
 1. Let |i| be 0.
 1. While |i| < |stringLength|:
     1. Let |charCode| be [$CharCodeAt$](|string|, |i|).
-    1. Set the element at index |start| + |i| in |array| to [=ToWebAssemblyValue=](|charCode|).
+    1. Set the element at index |start| + |i| in |array| to [=ToWebAssemblyValue=](|charCode|, [=i32=]).
     1. Set |i| to |i| + 1.
 1. Return |stringLength|.
 

From 260091884cecb5ea35b645052942f730a4a88ed0 Mon Sep 17 00:00:00 2001
From: Ryan Hunt 
Date: Thu, 26 Mar 2026 12:34:37 -0500
Subject: [PATCH 10/21] [js-api] Fix Table.grow to return AddressValue via
 U64ToAddressValue

table_size returns a raw u64. Table.grow's IDL signature returns
AddressValue. The length getter and Memory.grow both use U64ToAddressValue
for this conversion; Table.grow was missing it.
---
 document/js-api/index.bs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/document/js-api/index.bs b/document/js-api/index.bs
index 60d4db9b6b..22d52136b8 100644
--- a/document/js-api/index.bs
+++ b/document/js-api/index.bs
@@ -1076,7 +1076,7 @@ Each {{Table}} object has a \[[Table]] internal slot, which is a [=table address
         Note: The above exception can happen due to either insufficient memory or an invalid size parameter.
 
     1. Set the [=surrounding agent=]'s [=associated store=] to |result|.
-    1. Return |initialSize|.
+    1. Return [=U64ToAddressValue=](|initialSize|, |addrtype|).
 
From 498dc03856aebeed2f888cea89c443da8a5fea18 Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Thu, 26 Mar 2026 12:34:52 -0500 Subject: [PATCH 11/21] [js-api] Fix memory.grow hook to use instruction's memory index The hook previously hardcoded memaddrs[0], which is wrong for multi-memory modules where memory.grow x can target any memory index. Use the instruction's immediate x to index memaddrs. --- document/js-api/index.bs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/document/js-api/index.bs b/document/js-api/index.bs index 22d52136b8..ab7c33ab00 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -925,13 +925,13 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each 1. Return [=U64ToAddressValue=](|ret|, |addrtype|).
-Immediately after a WebAssembly [=memory.grow=] instruction executes, perform the following steps: +Immediately after a WebAssembly [=memory.grow=] |x| instruction executes, perform the following steps:
1. If the top of the stack is not [=i32.const=] (−1), 1. Let |frame| be the [=current frame=]. - 1. Assert: due to validation, |frame|.[=frame/module=].[=moduleinst/memaddrs=][0] exists. - 1. Let |memaddr| be the memory address |frame|.[=frame/module=].[=moduleinst/memaddrs=][0]. + 1. Assert: due to validation, |frame|.[=frame/module=].[=moduleinst/memaddrs=][|x|] exists. + 1. Let |memaddr| be the memory address |frame|.[=frame/module=].[=moduleinst/memaddrs=][|x|]. 1. [=Refresh the memory buffer=] of |memaddr|.
From 51b56111769801007cc6b7fff911192ea310e328 Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Thu, 26 Mar 2026 15:00:12 -0500 Subject: [PATCH 12/21] [js-api] Fix memory.grow hook failure check for i64 memories For 64-bit memories, memory.grow pushes i64.const (-1) on failure, not i32.const (-1). The previous check only matched the i32 case, so for a failed i64 grow the hook incorrectly called Refresh the memory buffer, detaching the ArrayBuffer even though the memory size did not change. --- document/js-api/index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/document/js-api/index.bs b/document/js-api/index.bs index ab7c33ab00..52252b4da9 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -928,7 +928,7 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each Immediately after a WebAssembly [=memory.grow=] |x| instruction executes, perform the following steps:
- 1. If the top of the stack is not [=i32.const=] (−1), + 1. If the top of the stack is not [=i32.const=] (−1) and the top of the stack is not [=i64.const=] (−1), 1. Let |frame| be the [=current frame=]. 1. Assert: due to validation, |frame|.[=frame/module=].[=moduleinst/memaddrs=][|x|] exists. 1. Let |memaddr| be the memory address |frame|.[=frame/module=].[=moduleinst/memaddrs=][|x|]. From 35a63dc70d430c8d062e6b45a52925bf405266dc Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Thu, 26 Mar 2026 12:35:18 -0500 Subject: [PATCH 13/21] [js-api] Fix exception check in call an Exported Function func_invoke returns (store, val* | exception | error) where exception is defined in the core embedding spec as EXCEPTION exnaddr. The check was using [=THROW=] [=ref.exn=] which is undefined notation. Use [=exception=] to match the core embedder spec's type. --- document/js-api/index.bs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/document/js-api/index.bs b/document/js-api/index.bs index 52252b4da9..ccfd176ba1 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -168,6 +168,7 @@ urlPrefix: https://webassembly.github.io/spec/core/; spec: WebAssembly; type: df text: match_valtype; url: appendix/embedding.html#embed-match-valtype text: match_externtype; url: appendix/embedding.html#embed-match-externtype text: error; url: appendix/embedding.html#embed-error + text: exception; url: appendix/embedding.html#embed-error text: store; url: exec/runtime.html#syntax-store text: address type; url: syntax/types.html#syntax-addrtype text: limits; url: syntax/types.html#syntax-limits @@ -1299,7 +1300,7 @@ This slot holds a [=function address=] relative to the [=surrounding agent=]'s [ 1. Let (|store|, |ret|) be the result of [=func_invoke=](|store|, |funcaddr|, |args|). 1. Set the [=surrounding agent=]'s [=associated store=] to |store|. 1. If |ret| is [=error=], throw an exception. This exception should be a WebAssembly {{RuntimeError}} exception, unless otherwise indicated by the WebAssembly error mapping. - 1. If |ret| is [=THROW=] [=ref.exn=] |exnaddr|, then + 1. If |ret| is [=exception=] |exnaddr|, then 1. Let |tagaddr| be [=exn_tag=](|store|, |exnaddr|). 1. Let |payload| be [=exn_read=](|store|, |exnaddr|). 1. Let |jsTagAddr| be the result of [=get the JavaScript exception tag |getting the JavaScript exception tag=]. From d19ea3b122a198772b96fd4fccdadb53a79a113c Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Thu, 26 Mar 2026 15:00:33 -0500 Subject: [PATCH 14/21] [js-api] Read store before func_alloc in create a host function The outer algorithm used |store| in the func_alloc call without ever binding it. The |store| inside the hostfunc closure is a separate binding read at invocation time, not at definition time. --- document/js-api/index.bs | 1 + 1 file changed, 1 insertion(+) diff --git a/document/js-api/index.bs b/document/js-api/index.bs index ccfd176ba1..e0828b2149 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -1372,6 +1372,7 @@ Note: Exported Functions do not have a \[[Construct]] method and thus it is not 1. Set the [=surrounding agent=]'s [=associated store=] to |store|. 1. Execute the WebAssembly instructions ([=ref.exn=] |address|) ([=throw_ref=]). 1. Otherwise, return |result|.\[[Value]]. + 1. Let |store| be the [=surrounding agent=]'s [=associated store=]. 1. Let (|store|, |funcaddr|) be [=func_alloc=](|store|, |functype|, |hostfunc|). 1. Set the [=surrounding agent=]'s [=associated store=] to |store|. 1. Return |funcaddr|. From 921de8f32a1d25b6482f97bae43ddc3f5db911c1 Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Thu, 26 Mar 2026 13:01:33 -0500 Subject: [PATCH 15/21] [js-api] Add missing ?/! on ToWebAssemblyValue calls --- document/js-api/index.bs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/document/js-api/index.bs b/document/js-api/index.bs index e0828b2149..d833d7dd62 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -1188,7 +1188,7 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each
The algorithm DefaultValue(|valuetype|) performs the following steps: - 1. If |valuetype| equals [=externref=], return [=ToWebAssemblyValue=](undefined, |valuetype|). + 1. If |valuetype| equals [=externref=], return [=!=] [=ToWebAssemblyValue=](undefined, |valuetype|). 1. Return [=val_default=](|valuetype|).
@@ -1202,7 +1202,7 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each 1. Let |value| be [=DefaultValue=](|valuetype|). 1. Assert: |value| is not [=error=]. 1. Otherwise, - 1. Let |value| be [=ToWebAssemblyValue=](|v|, |valuetype|). + 1. Let |value| be [=?=] [=ToWebAssemblyValue=](|v|, |valuetype|). 1. If |mutable| is true, let |globaltype| be [=var=] |valuetype|; otherwise, let |globaltype| be [=const=] |valuetype|. 1. Let |store| be the current agent's [=associated store=]. 1. Let (|store|, |globaladdr|) be [=global_alloc=](|store|, |globaltype|, |value|). @@ -1230,7 +1230,7 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each 1. Let |mut| |valuetype| be [=global_type=](|store|, |globaladdr|). 1. If |valuetype| [=matches/valtype|matches=] [=v128=] or [=exnref=], throw a {{TypeError}}. 1. If |mut| is [=const=], throw a {{TypeError}}. - 1. Let |value| be [=ToWebAssemblyValue=](**the given value**, |valuetype|). + 1. Let |value| be [=?=] [=ToWebAssemblyValue=](**the given value**, |valuetype|). 1. Let |store| be [=global_write=](|store|, |globaladdr|, |value|). 1. If |store| is [=error=], throw a {{RangeError}} exception. 1. Set the current agent's [=associated store=] to |store|. @@ -1295,7 +1295,7 @@ This slot holds a [=function address=] relative to the [=surrounding agent=]'s [ 1. [=list/iterate|For each=] |t| of |parameters|, 1. If |argValues|'s [=list/size=] > |i|, let |arg| be |argValues|[|i|]. 1. Otherwise, let |arg| be undefined. - 1. [=list/Append=] [=ToWebAssemblyValue=](|arg|, |t|) to |args|. + 1. [=list/Append=] [=?=] [=ToWebAssemblyValue=](|arg|, |t|) to |args|. 1. Set |i| to |i| + 1. 1. Let (|store|, |ret|) be the result of [=func_invoke=](|store|, |funcaddr|, |args|). 1. Set the [=surrounding agent=]'s [=associated store=] to |store|. @@ -1342,7 +1342,7 @@ Note: Exported Functions do not have a \[[Construct]] method and thus it is not 1. Let |wasmValues| be a new, empty [=list=]. 1. If |values|'s [=list/size=] is not |resultsSize|, throw a {{TypeError}} exception. 1. For each |value| and |resultType| in |values| and |results|, paired linearly, - 1. [=list/Append=] [=ToWebAssemblyValue=](|value|, |resultType|) to |wasmValues|. + 1. [=list/Append=] [=?=] [=ToWebAssemblyValue=](|value|, |resultType|) to |wasmValues|. 1. Return |wasmValues|.
@@ -1454,7 +1454,7 @@ The algorithm ToWebAssemblyValue(|v|, |type|) coerces a JavaScript va 1. If |v| is null, 1. Let |r| be [=ref.null=] |heaptype|. 1. Else if [=match_valtype=](|type|, [=ref=] |null| [=heap-type/extern=]), - 1. Let |ref| be [=ToWebAssemblyValue=](|v|, [=ref=] [=heap-type/any=]). + 1. Let |ref| be [=!=] [=ToWebAssemblyValue=](|v|, [=ref=] [=heap-type/any=]). 1. Let |r| be [=ref.extern=] |ref|. 1. Else if |v| is an [=Exported Function=] and [=match_valtype=](|type|, [=ref=] |null| [=heap-type/func=]), 1. Let |funcaddr| be the value of |v|'s \[[FunctionAddress]] internal slot. From c85eb142696347b6e2983ed62bd559a69887a446 Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Thu, 26 Mar 2026 13:26:37 -0500 Subject: [PATCH 16/21] [js-api] Add missing ! to ToJSValue calls ToJSValue is infallible. Add ! to all call sites that are missing it for consistency with the existing pattern in run a host function and create a builtin function. --- document/js-api/index.bs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/document/js-api/index.bs b/document/js-api/index.bs index d833d7dd62..7804437821 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -1099,7 +1099,7 @@ Each {{Table}} object has a \[[Table]] internal slot, which is a [=table address 1. Let |index64| be [=?=] [=AddressValueToU64=](|index|, |addrtype|). 1. Let |result| be [=table_read=](|store|, |tableaddr|, |index64|). 1. If |result| is [=error=], throw a {{RangeError}} exception. - 1. Return [=ToJSValue=](|result|). + 1. Return [=!=] [=ToJSValue=](|result|).
@@ -1217,7 +1217,7 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each 1. Let |globaltype| be [=global_type=](|store|, |globaladdr|). 1. If |globaltype| is of the form mut |valuetype| where |valuetype| [=matches/valtype|matches=] [=v128=] or [=exnref=], throw a {{TypeError}}. 1. Let |value| be [=global_read=](|store|, |globaladdr|). - 1. Return [=ToJSValue=](|value|). + 1. Return [=!=] [=ToJSValue=](|value|).
@@ -1311,11 +1311,11 @@ This slot holds a [=function address=] relative to the [=surrounding agent=]'s [ 1. Throw |exception|. 1. Let |outArity| be the [=list/size=] of |ret|. 1. If |outArity| is 0, return undefined. - 1. Otherwise, if |outArity| is 1, return [=ToJSValue=](|ret|[0]). + 1. Otherwise, if |outArity| is 1, return [=!=] [=ToJSValue=](|ret|[0]). 1. Otherwise, 1. Let |values| be « ». 1. [=list/iterate|For each=] |r| of |ret|, - 1. [=list/Append=] [=ToJSValue=](|r|) to |values|. + 1. [=list/Append=] [=!=] [=ToJSValue=](|r|) to |values|. 1. Return [$CreateArrayFromList$](|values|).
@@ -1765,7 +1765,7 @@ The getArg(|exceptionTag|, |index|) method ste 1. Let [|types|] → [] be [=tag_type=](|store|, |tagaddr|). 1. If |types|[|index|] [=matches/valtype|matches=] [=v128=] or [=exnref=], 1. Throw a {{TypeError}}. -1. Return [=ToJSValue=](|payload|[|index|]). +1. Return [=!=] [=ToJSValue=](|payload|[|index|]). From 6b814977a3d5c11aaf59d4563d91722e3eb245e6 Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Thu, 26 Mar 2026 14:50:14 -0500 Subject: [PATCH 17/21] [js-api] Include [[ObjectKind]] in MakeBasicObject slot list Per ECMA-262, all internal slots must be declared in the MakeBasicObject call. [[ObjectKind]] was set immediately after but was missing from the initial slot list. --- document/js-api/index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/document/js-api/index.bs b/document/js-api/index.bs index 7804437821..4134dcd5f4 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -1656,7 +1656,7 @@ The internal methods of an [=Exported GC Object=] use the following implementati 1. Let |map| be the [=surrounding agent=]'s associated [=exported GC object cache=]. 1. If |map|[|objectaddr|] [=map/exists=], 1. Return |map|[|objectaddr|]. - 1. Let |object| be [=MakeBasicObject=](« \[[ObjectAddress]] »). + 1. Let |object| be [=MakeBasicObject=](« \[[ObjectAddress]], \[[ObjectKind]] »). 1. Set |object|.\[[ObjectAddress]] to |objectaddr|. 1. Set |object|.\[[ObjectKind]] to |objectkind|. 1. Set |object|.\[[GetPrototypeOf]] as specified in [=[[GetPrototypeOf]] internal method of an Exported GC Object=]. From eddbd492d85d3216b903b613d1a74ab6e2a16a1d Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Thu, 26 Mar 2026 14:33:57 -0500 Subject: [PATCH 18/21] [js-api] Return after rejecting on compile error in asynchronously compile --- document/js-api/index.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/document/js-api/index.bs b/document/js-api/index.bs index 4134dcd5f4..ab32a9f3a2 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -454,8 +454,8 @@ A {{Module}} object represents a single WebAssembly module. Each {{Module}} obje 1. Let |promise| be [=a new promise=]. 1. Run the following steps [=in parallel=]: 1. [=compile a WebAssembly module|Compile the WebAssembly module=] |bytes| and store the result as |module|. - 1. [=Queue a task=] to perform the following steps. If |taskSource| was provided, queue the task on that task source. - 1. If |module| is [=error=], reject |promise| with a {{CompileError}} exception. + 1. [=Queue a task=] on |taskSource|, if provided, to perform the following steps: + 1. If |module| is [=error=], reject |promise| with a {{CompileError}} exception and return. 1. Let |builtinSetNames| be |options|["builtins"]. 1. Let |importedStringModule| be |options|["importedStringConstants"]. 1. If [=validate builtins and imported string for a WebAssembly module|validating builtins and imported strings=] for |module| with |builtinSetNames| and |importedStringModule| is false, reject |promise| with a {{CompileError}} exception. From d23bef202f68d5c0284330890ce422c2aeeee079 Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Thu, 26 Mar 2026 13:02:04 -0500 Subject: [PATCH 19/21] [js-api] Fix read the imports assert to check qualified builtin set name The map is keyed by qualified names ("wasm:" prefix) but the assert checked for the unqualified name, which was never present and made the assert vacuously true. Compute the qualified name first and assert against that. --- document/js-api/index.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/document/js-api/index.bs b/document/js-api/index.bs index ab32a9f3a2..6139fdd8f1 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -491,10 +491,10 @@ To instantiate imported strings with module |module| and |importedStr 1. If |module|.[=imports=] [=list/is empty|is not empty=], and |importObject| is undefined, throw a {{TypeError}} exception. 1. Let |builtinOrStringImports| be the ordered map « ». 1. [=list/iterate|For each=] |builtinSetName| of |builtinSetNames|, - 1. Assert: |builtinOrStringImports| does not contain |builtinSetName| + 1. Let |builtinSetQualifiedName| be |builtinSetName| prefixed with "wasm:" + 1. Assert: |builtinOrStringImports| does not contain |builtinSetQualifiedName| 1. If |builtinSetName| does not refer to a builtin set, then [=iteration/continue=]. 1. Let |exportsObject| be the result of [=instantiate a builtin set=] with |builtinSetName| - 1. Let |builtinSetQualifiedName| be |builtinSetName| prefixed with "wasm:" 1. [=map/set|Set=] |builtinOrStringImports|[|builtinSetQualifiedName|] to |exportsObject| 1. If |importedStringModule| is not null, 1. Let |exportsObject| be the result of [=instantiate imported strings=] with |module| and |importedStringModule| From 3d9238f0398571851a9ee8c13580eada561e8f92 Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Thu, 26 Mar 2026 13:18:02 -0500 Subject: [PATCH 20/21] [js-api] Use HasProperty instead of map 'contains' for exports object The builtin/string exports object is a plain JS object, not an Infra ordered map. Use HasProperty to check for component name presence. --- document/js-api/index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/document/js-api/index.bs b/document/js-api/index.bs index 6139fdd8f1..bef488c126 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -503,7 +503,7 @@ To instantiate imported strings with module |module| and |importedStr 1. [=list/iterate|For each=] (|moduleName|, |componentName|, |externtype|) of [=module_imports=](|module|), 1. If |builtinOrStringImports| [=map/exist|contains=] |moduleName|, 1. Let |o| be |builtinOrStringImports|[|moduleName|]. - 1. If |o| [=is not an Object=] or if |o| [=map/exist|does not contain=] |componentName|, + 1. If |o| [=is not an Object=] or if [$HasProperty$](|o|, |componentName|) is false, 1. Set |o| to [=?=] [$Get$](|importObject|, |moduleName|). 1. Else, 1. Let |o| be [=?=] [$Get$](|importObject|, |moduleName|). From 01b59c36cfd5cd7617b6376daa3e5bb9d55caf9d Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Thu, 26 Mar 2026 16:31:49 -0500 Subject: [PATCH 21/21] [js-api, web-api] Editorial fixes - Fix elementType case inconsistency in Table constructor - Fix "Let return" typo in ToJSValue - Fix missing "be" in ToWebAssemblyValue - Fix "fo" typo in instantiate a builtin set - Fix indentation of 'Return handled' in HostResizeArrayBuffer - Fix spurious space in get the JavaScript exception tag links - Fix 'a import' typo in validate builtins display text - Fix 'is' typo in Set [[ArrayBufferMaxByteLength]] step - Update WebIDL URL to webidl.spec.whatwg.org - Use [=/new=] consistently for Tag and Exception object creation - Use 'surrounding agent' consistently instead of 'current agent' - Update TC39 URL to tc39.es/ecma262 - Remove dead and duplicate ECMASCRIPT anchor entries - Fix 'appending' typo in embedding interface URL - Fix tag address pluralization in Tag object cache description - Use [=/new=] for Module object creation in construct a WebAssembly module object - Fix list item numbering in ToJSValue i32 branch - Remove unused 'instantiate a WebAssembly module' anchor - Rename Instance constructor parameter to moduleObject - Fix missing period in Exception constructor --- document/js-api/index.bs | 70 ++++++++++++++++++--------------------- document/web-api/index.bs | 3 +- 2 files changed, 33 insertions(+), 40 deletions(-) diff --git a/document/js-api/index.bs b/document/js-api/index.bs index bef488c126..a8374f2792 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -35,7 +35,7 @@ Date: now
-urlPrefix: https://tc39.github.io/ecma262/; spec: ECMASCRIPT
+urlPrefix: https://tc39.es/ecma262/; spec: ECMASCRIPT
     type: interface; for: ECMAScript
         text: ArrayBuffer; url: sec-arraybuffer-objects
     type: exception; for: ECMAScript
@@ -68,14 +68,10 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMASCRIPT
             text: is an Object
             text: is not an Object
         text: current Realm; url: current-realm
-        text: ObjectCreate; url: sec-objectcreate
         text: CreateBuiltinFunction; url: sec-createbuiltinfunction
-        text: SetFunctionName; url: sec-setfunctionname
-        text: SetFunctionLength; url: sec-setfunctionlength
         text: the Number value; url: sec-ecmascript-language-types-number-type
         text: is a Number; url: sec-ecmascript-language-types-number-type
         text: is a BigInt; url: sec-ecmascript-language-types-bigint-type
-        text: NumberToRawBytes; url: sec-numbertorawbytes
         text: Built-in Function Objects; url: sec-built-in-function-objects
         text: NativeError Object Structure; url: sec-nativeerror-object-structure
         text: CreateArrayFromList; url: sec-createarrayfromlist
@@ -85,8 +81,6 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMASCRIPT
         text: BigInt; url: #sec-ecmascript-language-types-bigint-type
         text: MakeBasicObject; url: #sec-makebasicobject
         text: ℝ; url: #ℝ
-        text: Built-in Function Objects; url: sec-built-in-function-objects
-        text: NativeError Object Structure; url: sec-nativeerror-object-structure
         text: 𝔽; url: #𝔽
         text: ℤ; url: #ℤ
         text: mathematical value; url: #mathematical-value
@@ -102,7 +96,7 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMASCRIPT
         text: Array; url: sec-array-exotic-objects
         text: BigInt; url: sec-ecmascript-language-types-bigint-type
 urlPrefix: https://webassembly.github.io/spec/core/; spec: WebAssembly; type: dfn
-    text: embedding interface; url: appending/embedding.html
+    text: embedding interface; url: appendix/embedding.html
     text: scope; url: intro/introduction.html#scope
     url: valid/modules.html#valid-module
         text: valid
@@ -252,7 +246,7 @@ urlPrefix: https://webassembly.github.io/spec/core/; spec: WebAssembly; type: df
     text: signed_64; url: exec/numerics.html#aux-signed
     text: sequence; url: syntax/conventions.html#grammar-notation
     text: exception; for: tagtype/attribute; url: syntax/types.html#syntax-tagtype
-urlPrefix: https://heycam.github.io/webidl/; spec: WebIDL
+urlPrefix: https://webidl.spec.whatwg.org/; spec: WebIDL
     type: dfn
         text: create a namespace object; url: create-a-namespace-object
         text: [EnforceRange]; url: #EnforceRange
@@ -354,7 +348,7 @@ Each [=agent=] is associated with the following [=ordered map=]s:
     * The Exported Function cache, mapping [=function address=]es to [=Exported Function=] objects.
     * The Exported GC Object cache, mapping [=struct address=]es and [=array address=]es to [=Exported GC Object=] objects.
     * The Global object cache, mapping [=global address=]es to {{Global}} objects.
-    * The Tag object cache, mapping [=tag addresses=] to {{Tag}} objects.
+    * The Tag object cache, mapping [=tag address=]es to {{Tag}} objects.
     * The Exception object cache, mapping [=exception address=]es to {{Exception}} objects.
     * The Host value cache, mapping [=host address=]es to values.
 
@@ -414,7 +408,7 @@ To validate builtins and imported string for a WebAssembly module fro
         1. Let |stringExternType| be `global const (ref extern)`.
         1. If [=match_externtype=](|stringExternType|, |importExternType|) is false, return false
     1. Else,
-        1. If [=validate an import for builtins|validating a import for builtin=] with |import| and |builtinSetNames| is false, return false.
+        1. If [=validate an import for builtins|validating an import for builtins=] with |import| and |builtinSetNames| is false, return false.
 1. Return true.
 
 
@@ -440,7 +434,7 @@ A {{Module}} object represents a single WebAssembly module. Each {{Module}} obje
 
To construct a WebAssembly module object from a module |module|, source bytes |bytes|, enabled builtins |builtinSetNames|, and |importedStringModule|, perform the following steps: - 1. Let |moduleObject| be a new {{Module}} object. + 1. Let |moduleObject| be a [=/new=] {{Module}}. 1. Set |moduleObject|.\[[Module]] to |module|. 1. Set |moduleObject|.\[[Bytes]] to |bytes|. 1. Set |moduleObject|.\[[BuiltinSets]] to |builtinSetNames|. @@ -788,10 +782,10 @@ interface Instance {
- The Instance(|module|, |importObject|) constructor, when invoked, runs the following steps: - 1. Let |builtinSetNames| be |module|.\[[BuiltinSets]]. - 1. Let |importedStringModule| be |module|.\[[ImportedStringModule]]. - 1. Let |module| be |module|.\[[Module]]. + The Instance(|moduleObject|, |importObject|) constructor, when invoked, runs the following steps: + 1. Let |builtinSetNames| be |moduleObject|.\[[BuiltinSets]]. + 1. Let |importedStringModule| be |moduleObject|.\[[ImportedStringModule]]. + 1. Let |module| be |moduleObject|.\[[Module]]. 1. [=Read the imports=] of |module| with imports |importObject|, |builtinSetNames|, and |importedStringModule|, and let |imports| be the result. 1. [=Instantiate the core of a WebAssembly module=] |module| with |imports|, and let |instance| be the result. 1. [=initialize an instance object|Initialize=] **this** from |module| and |instance|. @@ -848,7 +842,7 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each 1. Let |buffer| be a new {{ArrayBuffer}} with the internal slots \[[ArrayBufferData]], \[[ArrayBufferByteLength]], \[[ArrayBufferMaxByteLength]], and \[[ArrayBufferDetachKey]]. 1. Set |buffer|.\[[ArrayBufferData]] to |block|. 1. Set |buffer|.\[[ArrayBufferByteLength]] to |length|. - 1. Set |buffer|.\[[ArrayBufferMaxByteLength]] is |maxsize|. + 1. Set |buffer|.\[[ArrayBufferMaxByteLength]] to |maxsize|. 1. Set |buffer|.\[[ArrayBufferDetachKey]] to "WebAssembly.Memory". 1. Return |buffer|.
@@ -981,7 +975,7 @@ Immediately after a WebAssembly [=memory.grow=] |x| instruction executes, perfor 1. Throw a {{RangeError}} exception. 1. Let |delta| be |lengthDelta| ÷ 65536. 1. [=Grow the memory buffer=] associated with |memaddr| by |delta|. - 1. Return handled. + 1. Return handled. 1. Otherwise, return unhandled. @@ -1046,13 +1040,13 @@ Each {{Table}} object has a \[[Table]] internal slot, which is a [=table address 1. If |descriptor|["address"] [=map/exists=], let |addrtype| be |descriptor|["address"]; otherwise, let |addrtype| be "i32". 1. Let |initial| be [=?=] [=AddressValueToU64=](|descriptor|["initial"], |addrtype|). 1. If |descriptor|["maximum"] [=map/exists=], let |maximum| be [=?=] [=AddressValueToU64=](|descriptor|["maximum"], |addrtype|); otherwise, let |maximum| be empty. - 1. Let |type| be the [=table type=] |addrtype| { [=limits|min=] |initial|, [=limits|max=] |maximum| } |elementType|. + 1. Let |type| be the [=table type=] |addrtype| { [=limits|min=] |initial|, [=limits|max=] |maximum| } |elementtype|. 1. If |type| is not [=valid tabletype|valid=], throw a {{RangeError}} exception. 1. If |value| is missing, 1. Let |ref| be [=DefaultValue=](|elementtype|). 1. Assert: |ref| is not [=error=]. 1. Otherwise, - 1. Let |ref| be [=?=] [=ToWebAssemblyValue=](|value|, |elementType|). + 1. Let |ref| be [=?=] [=ToWebAssemblyValue=](|value|, |elementtype|). 1. Let |store| be the [=surrounding agent=]'s [=associated store=]. 1. Let (|store|, |tableaddr|) be [=table_alloc=](|store|, |type|, |ref|). If allocation fails, throw a {{RangeError}} exception. 1. Set the [=surrounding agent=]'s [=associated store=] to |store|. @@ -1204,15 +1198,15 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each 1. Otherwise, 1. Let |value| be [=?=] [=ToWebAssemblyValue=](|v|, |valuetype|). 1. If |mutable| is true, let |globaltype| be [=var=] |valuetype|; otherwise, let |globaltype| be [=const=] |valuetype|. - 1. Let |store| be the current agent's [=associated store=]. + 1. Let |store| be the [=surrounding agent=]'s [=associated store=]. 1. Let (|store|, |globaladdr|) be [=global_alloc=](|store|, |globaltype|, |value|). - 1. Set the current agent's [=associated store=] to |store|. + 1. Set the [=surrounding agent=]'s [=associated store=] to |store|. 1. [=initialize a global object|Initialize=] **this** from |globaladdr|.
The algorithm GetGlobalValue({{Global}} |global|) performs the following steps: - 1. Let |store| be the current agent's [=associated store=]. + 1. Let |store| be the [=surrounding agent=]'s [=associated store=]. 1. Let |globaladdr| be |global|.\[[Global]]. 1. Let |globaltype| be [=global_type=](|store|, |globaladdr|). 1. If |globaltype| is of the form mut |valuetype| where |valuetype| [=matches/valtype|matches=] [=v128=] or [=exnref=], throw a {{TypeError}}. @@ -1225,7 +1219,7 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each 1. Return [=GetGlobalValue=](**this**). The setter of the value attribute of {{Global}}, when invoked, performs the following steps: - 1. Let |store| be the current agent's [=associated store=]. + 1. Let |store| be the [=surrounding agent=]'s [=associated store=]. 1. Let |globaladdr| be **this**.\[[Global]]. 1. Let |mut| |valuetype| be [=global_type=](|store|, |globaladdr|). 1. If |valuetype| [=matches/valtype|matches=] [=v128=] or [=exnref=], throw a {{TypeError}}. @@ -1233,7 +1227,7 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each 1. Let |value| be [=?=] [=ToWebAssemblyValue=](**the given value**, |valuetype|). 1. Let |store| be [=global_write=](|store|, |globaladdr|, |value|). 1. If |store| is [=error=], throw a {{RangeError}} exception. - 1. Set the current agent's [=associated store=] to |store|. + 1. Set the [=surrounding agent=]'s [=associated store=] to |store|.
@@ -1303,7 +1297,7 @@ This slot holds a [=function address=] relative to the [=surrounding agent=]'s [ 1. If |ret| is [=exception=] |exnaddr|, then 1. Let |tagaddr| be [=exn_tag=](|store|, |exnaddr|). 1. Let |payload| be [=exn_read=](|store|, |exnaddr|). - 1. Let |jsTagAddr| be the result of [=get the JavaScript exception tag |getting the JavaScript exception tag=]. + 1. Let |jsTagAddr| be the result of [=get the JavaScript exception tag|getting the JavaScript exception tag=]. 1. If |tagaddr| is equal to |jsTagAddr|, 1. Throw [=!=] [=ToJSValue=](|payload|[0]). 1. Otherwise, @@ -1366,7 +1360,7 @@ Note: Exported Functions do not have a \[[Construct]] method and thus it is not 1. If |v| [=implements=] {{Exception}}, 1. Let |address| be |v|.\[[Address]]. 1. Otherwise, - 1. Let |type| be the result of [=get the JavaScript exception tag |getting the JavaScript exception tag=]. + 1. Let |type| be the result of [=get the JavaScript exception tag|getting the JavaScript exception tag=]. 1. Let |payload| be [=!=] [=ToWebAssemblyValue=](|v|, [=externref=]). 1. Let (|store|, |address|) be [=exn_alloc=](|store|, |type|, « |payload| »). 1. Set the [=surrounding agent=]'s [=associated store=] to |store|. @@ -1388,7 +1382,7 @@ The algorithm ToJSValue(|w|) coerces a [=WebAssembly value=] to a Jav 1. Return [=ℤ=](|i64| interpreted as a [=mathematical value=]). 1. If |w| is of the form [=i32.const=] |u32|, 1. Let |i32| be [=signed_32=](|u32|). - 2. Return [=𝔽=](|i32| interpreted as a [=mathematical value=]). + 1. Return [=𝔽=](|i32| interpreted as a [=mathematical value=]). 1. If |w| is of the form [=f32.const=] |f32|, 1. If |f32| is [=+∞=] or [=−∞=], return **+∞**𝔽 or **-∞**𝔽, respectively. 1. If |f32| is [=nan=], return **NaN**. @@ -1400,7 +1394,7 @@ The algorithm ToJSValue(|w|) coerces a [=WebAssembly value=] to a Jav 1. If |w| is of the form [=ref.null=] t, return null. 1. If |w| is of the form [=ref.i31=] |u31|, 1. Let |i31| be [=signed_31=](|u31|). - 1. Let return [=𝔽=](|i31|). + 1. Return [=𝔽=](|i31|). 1. If |w| is of the form [=ref.struct=] |structaddr|, return the result of creating [=a new Exported GC Object=] from |structaddr| and "struct". 1. If |w| is of the form [=ref.array=] |arrayaddr|, return the result of creating [=a new Exported GC Object=] from |arrayaddr| and "array". 1. If |w| is of the form [=ref.func=] |funcaddr|, return the result of creating [=a new Exported Function=] from |funcaddr|. @@ -1477,7 +1471,7 @@ The algorithm ToWebAssemblyValue(|v|, |type|) coerces a JavaScript va 1. Let [=host address=] |hostaddr| be the smallest address such that |map|[|hostaddr|] [=map/exists=] is false. 1. [=map/Set=] |map|[|hostaddr|] to |v|. 1. Let |r| be [=ref.host=] |hostaddr|. - 1. Let |store| be the current agent's [=associated store=]. + 1. Let |store| be the [=surrounding agent=]'s [=associated store=]. 1. Let |actualtype| be [=ref_type=](|store|, |r|). 1. If [=match_valtype=](|actualtype|, |type|) is false, 1. Throw a {{TypeError}}. @@ -1547,7 +1541,7 @@ To create a Tag object from a [=tag address=] |tagAddress|, perform t 1. Let |map| be the [=surrounding agent=]'s associated [=Tag object cache=]. 1. If |map|[|tagAddress|] [=map/exists=], 1. Return |map|[|tagAddress|]. -1. Let |tag| be a [=new=] {{Tag}}. +1. Let |tag| be a [=/new=] {{Tag}}. 1. [=initialize a Tag object|Initialize=] |tag| from |tagAddress|. 1. Return |tag|. @@ -1561,9 +1555,9 @@ The new Tag(|type|) constructor 1. Let |wasmParameters| be «». 1. [=list/iterate|For each=] |paramType| of |parameters|, 1. [=list/Append=] [=ToValueType=](|paramType|) to |wasmParameters|. -1. Let |store| be the current agent's [=associated store=]. +1. Let |store| be the [=surrounding agent=]'s [=associated store=]. 1. Let (|store|, |tagAddress|) be [=tag_alloc=](|store|, |wasmParameters| → « »). -1. Set the current agent's [=associated store=] to |store|. +1. Set the [=surrounding agent=]'s [=associated store=] to |store|. 1. [=initialize a Tag object|Initialize=] **this** from |tagAddress|.
@@ -1716,7 +1710,7 @@ To create an Exception object from a [=exception address=] |exnAddres 1. Let |map| be the [=surrounding agent=]'s associated [=Exception object cache=]. 1. If |map|[|exnAddress|] [=map/exists=], 1. Return |map|[|exnAddress|]. -1. Let |exn| be a [=new=] {{Exception}}. +1. Let |exn| be a [=/new=] {{Exception}}. 1. [=initialize an Exception object|Initialize=] |exn| from |exnAddress|. 1. Return |exn|. @@ -1741,7 +1735,7 @@ constructor steps are: 1. If |resultType| [=matches/valtype|matches=] [=v128=] or [=exnref=], 1. Throw a {{TypeError}}. 1. [=list/Append=] [=?=] [=ToWebAssemblyValue=](|value|, |resultType|) to |wasmPayload|. -1. Let (|store|, |exceptionAddr|) be [=exn_alloc=](|store|, |exceptionTag|.\[[Address]], |wasmPayload|) +1. Let (|store|, |exceptionAddr|) be [=exn_alloc=](|store|, |exceptionTag|.\[[Address]], |wasmPayload|). 1. Set the [=surrounding agent=]'s [=associated store=] to |store|. 1. [=initialize an Exception object|Initialize=] **this** from |exceptionAddr|. 1. If |options|["traceStack"] is true, @@ -1802,8 +1796,8 @@ To get the JavaScript exception tag, perform the following steps: 1. return the [=surrounding agent=]'s associated [=JavaScript exception tag=] 1. Let |store| be the [=surrounding agent=]'s [=associated store=]. 1. Let (|store|, |tagAddress|) be [=tag_alloc=](|store|, « [=externref=] » → « »). - 1. Set the current agent's [=associated store=] to |store|. - 1. Set the current agent's associated [=JavaScript exception tag=] to |tagAddress|. + 1. Set the [=surrounding agent=]'s [=associated store=] to |store|. + 1. Set the [=surrounding agent=]'s associated [=JavaScript exception tag=] to |tagAddress|. 1. return |tagAddress|. @@ -1890,7 +1884,7 @@ To instantiate a builtin set with name |builtinSetName|, perform the 1. Let |builtins| be the result of [=get the builtins for a builtin set=] |builtinSetName|. 1. Let |exportsObject| be [=!=] [$OrdinaryObjectCreate$](null). 1. [=list/iterate|For each=] (|name|, |funcType|, |steps|) of |builtins|, - 1. Let |funcaddr| be the result fo [=create a builtin function=] with |funcType| and |steps|. + 1. Let |funcaddr| be the result of [=create a builtin function=] with |funcType| and |steps|. 1. Let |func| be the result of creating [=a new Exported Function=] from |funcaddr|. 1. Let |value| be |func|. 1. Let |status| be [=!=] [$CreateDataProperty$](|exportsObject|, |name|, |value|). diff --git a/document/web-api/index.bs b/document/web-api/index.bs index 57b4211375..aa58250d5c 100644 --- a/document/web-api/index.bs +++ b/document/web-api/index.bs @@ -41,7 +41,7 @@ Date: now
-urlPrefix: https://tc39.github.io/ecma262/; spec: ECMASCRIPT
+urlPrefix: https://tc39.es/ecma262/; spec: ECMASCRIPT
     type: exception; for: ECMAScript
         text: TypeError; url: sec-native-error-types-used-in-this-standard-typeerror
     type: interface
@@ -62,7 +62,6 @@ urlPrefix: https://webassembly.github.io/spec/js-api/; spec: WASMJS
         text: WebAssemblyInstantiatedSource; url: #dictdef-webassemblyinstantiatedsource
     type: dfn
         text: compile a WebAssembly module; url: #compile-a-webassembly-module
-        text: instantiate a WebAssembly module; url: #instantiate-a-webassembly-module
         text: instantiate; url: #dom-webassembly-instantiate
         text: asynchronously compile a webassembly module; url: #asynchronously-compile-a-webassembly-module
         text: instantiate a promise of a module; url: #instantiate-a-promise-of-a-module