You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: document/js-api/index.bs
+17-11Lines changed: 17 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -1490,17 +1490,23 @@ To <dfn>create a suspending function</dfn> from a JavaScript function |func|, wi
1490
1490
1. Let |type|, |payload| and |opaqueData| be the result of [=coerce a JavaScript exception|coercing the JavaScript exception=] |ret|.\[[Value]].
1491
1491
1. [=WebAssembly/Throw=] with |type|, |payload| and |opaqueData|.
1492
1492
1. Otherwise,
1493
-
1. Let |promise| be [=?=][$PromiseResolve$]({{%Promise%}},|ret|.\[[Value]]).
1494
-
1. Set the entry for |async_context| in |map| to [=paused=].
1495
-
1. Let |awaitResult| be the result of performing [$Completion$]([$Await$](|promise|)).
1496
-
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.
1497
-
1. If the entry for |async_context| in |map| is not [=paused=] then:
1498
-
1. Perform [=throw a JavaScript exception=] with a {{RuntimeError}}.
1499
-
1. Otherwise, set the entry to [=active=].
1500
-
1. If |awaitResult|.\[[Type]] is <emu-const>throw</emu-const>, then:
1501
-
1. Let |type|, |payload| and |opaqueData| be the result of [=coerce a JavaScript exception|coercing the JavaScript exception=] |ret|.\[[Value]].
1502
-
1. [=WebAssembly/Throw=] with |type|, |payload| and |opaqueData|.
1503
-
1. Otherwise, return the result of performing [=coerce a JavaScript return=] on |resultTypes| and |awaitResult|.
1493
+
1. Let |prRet| be the result of [$PromiseResolve$]({{%Promise%}},|ret|.\[[Value]]).
1494
+
1. Assert: |prRet|.\[[Type]] is <emu-const>throw</emu-const> or <emu-const>normal</emu-const>.
1495
+
1. If |prRet|.\[[Type]] is <emu-const>throw</emu-const>, then:
1496
+
1. Let |type|, |payload| and |opaqueData| be the result of [=coerce a JavaScript exception|coercing the JavaScript exception=] |ret|.\[[Value]].
1497
+
1. [=WebAssembly/Throw=] with |type|, |payload| and |opaqueData|.
1498
+
1. Otherwise,
1499
+
1. Let |promise| be |prRet|.\[[Value]].
1500
+
1. Set the entry for |async_context| in |map| to [=paused=].
1501
+
1. Let |awaitResult| be the result of performing [$Completion$]([$Await$](|promise|)).
1502
+
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.
1503
+
1. If the entry for |async_context| in |map| is not [=paused=] then:
1504
+
1. Perform [=throw a JavaScript exception=] with a {{RuntimeError}}.
1505
+
1. Otherwise, set the entry to [=active=].
1506
+
1. If |awaitResult|.\[[Type]] is <emu-const>throw</emu-const>, then:
1507
+
1. Let |type|, |payload| and |opaqueData| be the result of [=coerce a JavaScript exception|coercing the JavaScript exception=] |ret|.\[[Value]].
1508
+
1. [=WebAssembly/Throw=] with |type|, |payload| and |opaqueData|.
1509
+
1. Otherwise, return the result of performing [=coerce a JavaScript return=] on |resultTypes| and |awaitResult|.
1504
1510
1. Let |store| be the [=surrounding agent=]'s [=associated store=].
1505
1511
1. Let (|store|, |funcaddr|) be [=func_alloc=](|store|, |functype|, |hostfunc|).
1506
1512
1. Set the [=surrounding agent=]'s [=associated store=] to |store|.
0 commit comments