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
+23-20Lines changed: 23 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -1135,7 +1135,7 @@ This slot holds a [=function address=] relative to the [=surrounding agent=]'s [
1135
1135
1. Let |map| be the [=surrounding agent=]'s associated [=Exported Function cache=].
1136
1136
1. If |map|[|funcaddr|][=map/exists=],
1137
1137
1. Return |map|[|funcaddr|].
1138
-
1. Let |steps| be "[=call an Exported Function|call the Exported Function=] |funcaddr| with arguments."
1138
+
1. Let |steps| be "[=call an Exported Function|call the Exported Function=] |funcaddr| with arguments.".
1139
1139
1. Let |realm| be the [=current Realm=].
1140
1140
1. Let |store| be the [=surrounding agent=]'s [=associated store=].
1141
1141
1. Let |functype| be [=func_type=](|store|, |funcaddr|).
@@ -1171,7 +1171,7 @@ This slot holds a [=function address=] relative to the [=surrounding agent=]'s [
1171
1171
1. Let (|store|, |ret|) be the result of [=func_invoke=](|store|, |funcaddr|, |args|).
1172
1172
1. Set the [=surrounding agent=]'s [=associated store=] to |store|.
1173
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>.
1174
-
1. If |ret| is [=THROW=][=ref.exn=] |exnaddr|, then
1174
+
1. If |ret| is [=THROW=][=ref.exn=] |exnaddr|, then:
1175
1175
1. Let |tagaddr| be [=exn_tag=](|store|, |exnaddr|).
1176
1176
1. Let |payload| be [=exn_read=](|store|, |exnaddr|).
1177
1177
1. Let |jsTagAddr| be the result of [=get the JavaScript exception tag |getting the JavaScript exception tag=].
@@ -1200,7 +1200,7 @@ Note: Exported Functions do not have a \[[Construct]] method and thus it is not
1200
1200
1. Let |jsArguments| be « ».
1201
1201
1. [=list/iterate|For each=] |arg| of |arguments|,
1202
1202
1. [=list/Append=][=!=][=ToJSValue=](|arg|) to |jsArguments|.
1203
-
1. Return |jsArguments|
1203
+
1. Return |jsArguments|.
1204
1204
</div>
1205
1205
1206
1206
<div algorithm>
@@ -1242,7 +1242,7 @@ Note: Exported Functions do not have a \[[Construct]] method and thus it is not
1242
1242
1. [=Prepare to run script=] with |relevant settings|.
1243
1243
1. [=Prepare to run a callback=] with |stored settings|.
1244
1244
1. Let [|parameters|] → [|resultTypes|] be |functype|.
1245
-
1. Let |jsArguments| be the result of [=coerce WebAssembly arguments=](|parameters|,|arguments|)
1245
+
1. Let |jsArguments| be the result of [=coerce WebAssembly arguments=](|parameters|,|arguments|).
1246
1246
1. Let |result| be the result of Completion([$Call$](|func|, undefined, |jsArguments|)).
1247
1247
1. [=Clean up after running a callback=] with |stored settings|.
1248
1248
1. [=Clean up after running script=] with |relevant settings|.
@@ -1251,20 +1251,24 @@ Note: Exported Functions do not have a \[[Construct]] method and thus it is not
1251
1251
1. If |result|.\[[Type]] is <emu-const>normal</emu-const>, then:
1252
1252
1. Return the result of performing [=coerce a JavaScript return=] on |resultTypes| and |ret|.
1253
1253
1. If |result|.\[[Type]] is <emu-const>throw</emu-const>, then:
1254
-
1. Let |v| be |result|.\[[Value]].
1255
-
1. If |v| [=implements=]{{Exception}},
1256
-
1. Let |address| be |v|.\[[Address]].
1257
-
1. Otherwise,
1258
-
1. Let |type| be the result of [=get the JavaScript exception tag |getting the JavaScript exception tag=].
1259
-
1. Let |payload| be [=!=][=ToWebAssemblyValue=](|v|, [=externref=]).
1260
-
1. Let (|store|, |address|) be [=exn_alloc=](|store|, |type|, « |payload| »).
1261
-
1. Set the [=surrounding agent=]'s [=associated store=] to |store|.
1262
-
1. Execute the WebAssembly instructions ([=ref.exn=] |address|) ([=throw_ref=]).
1254
+
1. Perform [=throw a JavaScript exception|throw the JavaScript exception=] |result|.\[[Value]].
1263
1255
1. Let (|store|, |funcaddr|) be [=func_alloc=](|store|, |functype|, |hostfunc|).
1264
1256
1. Set the [=surrounding agent=]'s [=associated store=] to |store|.
1265
1257
1. Return |funcaddr|.
1266
1258
</div>
1267
1259
1260
+
<div algorithm>
1261
+
To <dfn>throw a JavaScript exception</dfn> from the JavaScript object |v|, perform the following steps:
1262
+
1. If |v| [=implements=]{{Exception}},
1263
+
1. Let |address| be |v|.\[[Address]].
1264
+
1. Otherwise,
1265
+
1. Let |type| be the result of [=get the JavaScript exception tag |getting the JavaScript exception tag=].
1266
+
1. Let |payload| be [=!=][=ToWebAssemblyValue=](|v|, [=externref=]).
1267
+
1. Let (|store|, |address|) be [=exn_alloc=](|store|, |type|, « |payload| »).
1268
+
1. Set the [=surrounding agent=]'s [=associated store=] to |store|.
1269
+
1. Execute the WebAssembly instructions ([=ref.exn=] |address|) ([=throw_ref=]).
1270
+
</div>
1271
+
1268
1272
<div algorithm>
1269
1273
The algorithm <dfn>ToJSValue</dfn>(|w|) coerces a [=WebAssembly value=] to a JavaScript value by performing the following steps:
1270
1274
@@ -1294,7 +1298,6 @@ The algorithm <dfn>ToJSValue</dfn>(|w|) coerces a [=WebAssembly value=] to a Jav
1294
1298
1. If |w| is of the form [=ref.host=] |hostaddr|, return the result of [=retrieving a host value=] from |hostaddr|.
1295
1299
1. If |w| is of the form [=ref.extern=] |ref|, return [=ToJSValue=](|ref|).
1296
1300
1297
-
1298
1301
Note: Number values which are equal to NaN may have various observable NaN payloads; see [$NumericToRawBytes$] for details.
1299
1302
</div>
1300
1303
@@ -1327,7 +1330,7 @@ The algorithm <dfn>ToWebAssemblyValue</dfn>(|v|, |type|) coerces a JavaScript va
1327
1330
1. Let |n| be an implementation-defined integer such that [=canon=]<sub>32</sub> ≤ |n| < 2<sup>[=signif=](32)</sup>.
1328
1331
1. Let |f32| be [=nan=](n).
1329
1332
1. Otherwise,
1330
-
1. Let |f32| be |number| rounded to the nearest representable value using IEEE 754-2008 round to nearest, ties to even mode. [[IEEE-754]]
1333
+
\1.
1331
1334
1. Return [=f32.const=] |f32|.
1332
1335
1. If |type| is [=f64=],
1333
1336
1. Let |number| be [=?=][$ToNumber$](|v|).
@@ -1427,7 +1430,7 @@ interface Suspending {
1427
1430
The algorithm to <dfn>evaluate a Promising function</dfn>(|promise|, |funcaddr|, |arguments|) consists of the following steps:
1428
1431
1. Let |store| be the [=surrounding agent=]'s [=associated store=].
1429
1432
1. Let |functype| be [=func_type=](|store|, |funcaddr|).
1430
-
1. Let |args| be the result of [=coerce JavaScript arguments|coercing arguments=] (|functype|,|arguments|)
1433
+
1. Let |args| be the result of [=coerce JavaScript arguments|coercing arguments=] (|functype|,|arguments|).
1431
1434
1. Let |map| be the [=surrounding agent=]'s associated [=Execution Context Status map=].
1432
1435
1. Let |ec| be the currently executing [=execution context=], i.e., the [=execution context=] that is at the top of the [=surrounding agent=]'s current [=execution context stack=].
1433
1436
1. Assert: |map| does not contain any entry for |ec|.
@@ -1439,8 +1442,8 @@ interface Suspending {
1439
1442
1. If |result| 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>.
1440
1443
1. Otherwise, if |result| is of the form [=throw=] exnaddr,
1441
1444
1. [=Reject=] |promise| with |result|.
1442
-
1. Otherwise,
1443
-
1. Assert: |result| is a [=list=] of WebAssembly values
1445
+
1. Otherwise,
1446
+
1. Assert: |result| is a [=list=] of WebAssembly values.
1444
1447
1. Let |outArity| be the [=list/size=] of |result|.
1445
1448
1. If |outArity| is 0, return undefined.
1446
1449
1. Otherwise, if |outArity| is 1, let |jsReturnValue| be [=ToJSValue=](|result|[0]).
@@ -1738,7 +1741,7 @@ constructor steps are:
1738
1741
1. If |resultType| is [=v128=] or [=exnref=],
1739
1742
1. Throw a {{TypeError}}.
1740
1743
1. [=list/Append=][=?=][=ToWebAssemblyValue=](|value|, |resultType|) to |wasmPayload|.
1741
-
1. Let (|store|, |exceptionAddr|) be [=exn_alloc=](|store|, |exceptionTag|.\[[Address]], |wasmPayload|)
1744
+
1. Let (|store|, |exceptionAddr|) be [=exn_alloc=](|store|, |exceptionTag|.\[[Address]], |wasmPayload|).
1742
1745
1. Set the [=surrounding agent=]'s [=associated store=] to |store|.
1743
1746
1. [=initialize an Exception object|Initialize=] **this** from |exceptionAddr|.
1744
1747
1. If |options|["traceStack"] is true,
@@ -1794,7 +1797,7 @@ first use and cached. It always has the [=tag type=] « [=externref=] » → «
1794
1797
To <dfn>get the JavaScript exception tag</dfn>, perform the following steps:
1795
1798
1796
1799
1. If the [=surrounding agent=]'s associated [=JavaScript exception tag=] has been initialized,
1797
-
1. return the [=surrounding agent=]'s associated [=JavaScript exception tag=]
1800
+
1. return the [=surrounding agent=]'s associated [=JavaScript exception tag=].
1798
1801
1. Let |store| be the [=surrounding agent=]'s [=associated store=].
1799
1802
1. Let (|store|, |tagAddress|) be [=tag_alloc=](|store|, « [=externref=] » → « »).
1800
1803
1. Set the current agent's [=associated store=] to |store|.
0 commit comments