From bc04bb4d8f713811d05c800ed9e0a5bb3ccb4453 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Fri, 5 Apr 2024 15:15:00 -0700 Subject: [PATCH] update for exnref --- document/js-api/index.bs | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/document/js-api/index.bs b/document/js-api/index.bs index 51ec0ee2..37fbcfed 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -507,6 +507,23 @@ The verification of WebAssembly type requirements is deferred to the Note: A follow-on streaming API is documented in the WebAssembly Web API. +
+create the WebAssembly namespace object: + +When the [=namespace object=] for the {{WebAssembly}} namespace is [=create a namespace object|created=], the following steps must be run: + +1. Let |namespaceObject| be the [=namespace object=]. +1. [=list/iterate|For each=] |error| of « "CompileError", "LinkError", "RuntimeError" », + 1. Let |constructor| be a new object, implementing the [=NativeError Object Structure=], with NativeError set to |error|. + 1. [=!=] [$DefineMethodProperty$](|namespaceObject|, |error|, |constructor|, True). +1. Let |JsTagAddr| be the result of [=get the JavaScript exception tag|getting the JavaScript exception tag=]. +1. Let |JsTagObject| be the result of [=create a Tag object|creating a Tag object=] from |JsTagAddr|. +1. [=!=] [$DefineMethodProperty$](|namespaceObject|, "JSTag", |JsTagObject|, True). + +
+ +Note: It is not currently possible to define this behavior using Web IDL. +

Modules

@@ -1361,6 +1378,7 @@ The JavaScript exception tag is a [=tag address=] associated with
 the surrounding agent. It is allocated in the agent's [=associated store=] on
 first use and cached. It always has the [=tag type=] « [=externref=] » → « ».
 
+It is exposed to JavaScript code via {{WebAssembly}}.{{JSTag}} a global pre-initialized
 
 
@@ -1376,25 +1394,16 @@ To get the JavaScript exception tag, perform the following steps:
-

Error Objects

- -WebAssembly defines the following Error classes: CompileError, LinkError, and RuntimeError. -
-When the [=namespace object=] for the {{WebAssembly}} namespace is [=create a namespace object|created=], the following steps must be run: -1. Let |namespaceObject| be the [=namespace object=]. -1. [=list/iterate|For each=] |error| of « "CompileError", "LinkError", "RuntimeError" », - 1. Let |constructor| be a new object, implementing the [=NativeError Object Structure=], with NativeError set to |error|. - 1. [=!=] [$CreateMethodProperty$](|namespaceObject|, |error|, |constructor|). +

Error Objects

-
+WebAssembly defines the following Error classes: CompileError, LinkError, and RuntimeError. +Their initialization is described in [=create the WebAssembly namespace object=]. Note: This defines {{CompileError}}, {{LinkError}}, and {{RuntimeError}} classes on the {{WebAssembly}} namespace, which are produced by the APIs defined in this specification. They expose the same interface as native JavaScript errors like {{TypeError}} and {{RangeError}}. -Note: It is not currently possible to define this behavior using Web IDL. -

Error Condition Mappings to JavaScript