Skip to content

Commit 4e4275d

Browse files
authored
Merge pull request #55 from WebAssembly/fgmccabe-patch-3
Add SuspendError
2 parents b0a8b76 + 3a2016e commit 4e4275d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

‎document/js-api/index.bs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ This slot holds a [=function address=] relative to the [=surrounding agent=]'s [
11701170
1. Let |args| be the result of [=coerce JavaScript arguments|coercing arguments=] (|functype|,|argValues|).
11711171
1. Let (|store|, |ret|) be the result of [=func_invoke=](|store|, |funcaddr|, |args|).
11721172
1. Set the [=surrounding agent=]'s [=associated store=] to |store|.
1173-
1. If |ret| is [=error=], throw an exception. This exception should be a WebAssembly {{RuntimeError}} exception, unless otherwise indicated by <a href="#errors">the WebAssembly error mapping</a>.
1173+
1. If |ret| is [=error=], throw an exception. This exception must be a WebAssembly {{RuntimeError}} exception, unless otherwise indicated by <a href="#errors">the WebAssembly error mapping</a>.
11741174
1. If |ret| is [=THROW=] [=ref.exn=] |exnaddr|, then:
11751175
1. Let |tagaddr| be [=exn_tag=](|store|, |exnaddr|).
11761176
1. Let |payload| be [=exn_read=](|store|, |exnaddr|).
@@ -1437,7 +1437,7 @@ interface Suspending {
14371437
1. Add an entry mapping |ec| to [=active=] in |map|.
14381438
1. Let (|store|, |result|) be the result of [=func_invoke=](|store|, |funcaddr|, |args|).
14391439
1. Assert: If control reaches here, we have done waiting for suspended imports.
1440-
1. If the entry for |ec| in |map| is not [=active=] then throw a WebAssembly {{RuntimeError}} exception. Otherwise, remove the entry for |ec| from [=map=].
1440+
1. If the entry for |ec| in |map| is not [=active=] then throw a WebAssembly {{SuspendError}} exception. Otherwise, remove the entry for |ec| from [=map=].
14411441
1. Set the [=surrounding agent=]'s [=associated store=] to |store|.
14421442
1. If |result| is [=error=], throw a WebAssembly {{RuntimeError}} exception, unless otherwise indicated by <a href="#errors">the WebAssembly error mapping</a>.
14431443
1. Otherwise, if |result| is of the form [=throw=] exnaddr,
@@ -1476,7 +1476,7 @@ To <dfn>create a suspending function</dfn> from a JavaScript function |func|, wi
14761476
1. Let |async_context| be the [=surrounding agent=]'s [=running execution context=].
14771477
1. Let |map| be the [=surrounding agent=]'s associated [=Execution Context Status map=].
14781478
1. If the entry for |async_context| in |map| is not [=active=], then:
1479-
1. Perform [=throw a JavaScript exception=] with a {{RuntimeError}} exception.
1479+
1. Perform [=throw a JavaScript exception=] with a {{SuspendError}} exception.
14801480
1. [=Prepare to run script=] with |relevant settings|.
14811481
1. [=Prepare to run a callback=] with |stored settings|.
14821482
1. Let [|parameters|][|resultTypes|] be |functype|.
@@ -1495,7 +1495,7 @@ To <dfn>create a suspending function</dfn> from a JavaScript function |func|, wi
14951495
1. Note: We only invoke [$Await$] if the call to |func| has returned a Promise object.
14961496
1. Note: This will suspend both this algorithm, and the WebAssembly function being invoked by the [=evaluate a Promising function=] algorithm. On return, |ret| will be either a normal completion or a throw completion.
14971497
1. If the entry for |async_context| in |map| is not [=paused=] then:
1498-
1. Perform [=throw a JavaScript exception=] with a {{RuntimeError}}.
1498+
1. Perform [=throw a JavaScript exception=] with a {{SuspendError}}.
14991499
1. Otherwise, set the entry to [=active=].
15001500
1. If |awaitResult|.\[[Type]] is <emu-const>throw</emu-const>, then:
15011501
1. Let |type|, |payload| and |opaqueData| be the result of [=coerce a JavaScript exception|coercing the JavaScript exception=] |ret|.\[[Value]].
@@ -1807,19 +1807,19 @@ To <dfn>get the JavaScript exception tag</dfn>, perform the following steps:
18071807

18081808
<h3 id="error-objects">Error Objects</h3>
18091809

1810-
WebAssembly defines the following Error classes: <dfn exception>CompileError</dfn>, <dfn exception>LinkError</dfn>, and <dfn exception>RuntimeError</dfn>.
1810+
WebAssembly defines the following Error classes: <dfn exception>CompileError</dfn>, <dfn exception>LinkError</dfn>, <dfn exception>RuntimeError</dfn>, and <dfn exception>SuspendError</dfn>.
18111811

18121812
<div algorithm="create the WebAssembly namespace object">
18131813
When the [=namespace object=] for the {{WebAssembly}} namespace is [=create a namespace object|created=], the following steps must be run:
18141814

18151815
1. Let |namespaceObject| be the [=namespace object=].
1816-
1. [=list/iterate|For each=] |error| of « "CompileError", "LinkError", "RuntimeError" »,
1816+
1. [=list/iterate|For each=] |error| of « "CompileError", "LinkError", "RuntimeError", "SuspendError" »,
18171817
1. Let |constructor| be a new object, implementing the [=NativeError Object Structure=], with <var ignore>NativeError</var> set to |error|.
18181818
1. [=!=] [$DefineMethodProperty$](|namespaceObject|, |error|, |constructor|, false).
18191819

18201820
</div>
18211821

1822-
Note: This defines {{CompileError}}, {{LinkError}}, and {{RuntimeError}} classes on the {{WebAssembly}} namespace, which are produced by the APIs defined in this specification.
1822+
Note: This defines {{CompileError}}, {{LinkError}}, {{RuntimeError}}, and {{SuspendError}} classes on the {{WebAssembly}} namespace, which are produced by the APIs defined in this specification.
18231823
They expose the same interface as native JavaScript errors like {{TypeError}} and {{RangeError}}.
18241824

18251825
Note: It is not currently possible to define this behavior using Web IDL.

0 commit comments

Comments
 (0)