Skip to content

Commit ca61ec9

Browse files
committed
Specify the entry and incumbent realm for host functions.
Fixes WebAssembly/spec#1184.
1 parent 168e29f commit ca61ec9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

document/js-api/index.bs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,8 +1018,15 @@ Note: Exported Functions do not have a \[[Construct]] method and thus it is not
10181018
To <dfn>create a host function</dfn> from the JavaScript object |func| and type |functype|, perform the following steps:
10191019

10201020
1. Assert: [=IsCallable=](|func|).
1021+
1. Let |stored settings| be the [=incumbent settings object=].
10211022
1. Let |hostfunc| be a [=host function=] which performs the following steps when called with arguments |arguments|:
1023+
1. Let |realm| be |func|'s [=associated Realm=].
1024+
1. Let |relevant settings| be |realm|'s [=Realm/settings object=].
1025+
1. [=Prepare to run script=] with |relevant settings|.
1026+
1. [=Prepare to run a callback=] with |stored settings|.
10221027
1. Let |result| be the result of [=run a host function|running a host function=] from |func|, |functype|, and |arguments|.
1028+
1. [=Clean up after running a callback=] with |stored settings|.
1029+
1. [=Clean up after running script=] with |relevant settings|.
10231030
1. Assert: |result|.\[[Type]] is <emu-const>throw</emu-const> or <emu-const>normal</emu-const>.
10241031
1. If |result|.\[[Type]] is <emu-const>throw</emu-const>, then trigger a WebAssembly trap, and propagate |result|.\[[Value]] to the enclosing JavaScript.
10251032
1. Otherwise, return |result|.\[[Value]].

0 commit comments

Comments
 (0)