Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Expose the JavaScript Exception tag and allow importing it #269

Merged
merged 31 commits into from
Apr 26, 2024
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
587dafb
Add exceptional return to func_invoke in embedding doc
dschuff Mar 16, 2023
15a47cf
review comments
dschuff Mar 27, 2023
904a8fb
swap order of error/exception in func_invoke
dschuff Mar 30, 2023
fe0d00e
Expose the JavaScript Exception tag and allow importing it
dschuff Apr 7, 2023
ec302e1
review suggestions
dschuff Apr 11, 2023
fdf1b7c
Apply suggestions from code review
dschuff May 4, 2023
997754d
fix typo
dschuff Mar 15, 2024
a276636
Merge branch 'main' into js-tag-import
dschuff Mar 15, 2024
4799452
Merge branch 'main' into embedding-invoke
dschuff Mar 15, 2024
f57cdb8
add exception allocation
dschuff Mar 22, 2024
ccbee0f
udpate for exnref
dschuff Mar 22, 2024
4d08a58
apply all suggestions other than exn_read
dschuff Mar 29, 2024
74a92cb
add exn_read
dschuff Mar 29, 2024
b17459a
Update allocation, initialization, construction and call-exported-fn
dschuff Mar 29, 2024
fa07dea
fix linkage, syntax
dschuff Mar 29, 2024
ea5217b
fix typo
dschuff Mar 29, 2024
1c958c2
fix vars
dschuff Mar 29, 2024
46de060
Merge branch 'main' into exnref-js
dschuff Apr 2, 2024
5b8380a
address comments
dschuff Apr 4, 2024
4d03423
remove Tag parameter from getArg
dschuff Apr 4, 2024
d073cfe
remove 2 more spurious references to webassembly throw
dschuff Apr 4, 2024
b6a79f9
more properly allocate the JS exception tag, and wrap/unwrap JS excep…
dschuff Apr 5, 2024
51338d7
apply review comments
dschuff Apr 5, 2024
dfdd0b9
inline throwing into 'create a host function' and define in terms of …
dschuff Apr 5, 2024
a80e7b3
Merge branch 'exnref-js' into js-tag-import
dschuff Apr 5, 2024
bc04bb4
update for exnref
dschuff Apr 5, 2024
6c05eaa
remove leftover text
dschuff Apr 5, 2024
bece351
revert algorithm change
dschuff Apr 9, 2024
41b08cf
add getter
dschuff Apr 9, 2024
d3c3ab6
Merge branch 'main' into js-tag-import
dschuff Apr 11, 2024
8834860
Don't allow construction of a WebAssembly.Exception object with the J…
dschuff Apr 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions document/js-api/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ namespace WebAssembly {

Promise<Instance> instantiate(
Module moduleObject, optional object importObject);

readonly attribute Tag JSTag;
};
</pre>

Expand Down Expand Up @@ -505,6 +507,11 @@ The verification of WebAssembly type requirements is deferred to the

Note: A follow-on streaming API is documented in the <a href="https://webassembly.github.io/spec/web-api/index.html">WebAssembly Web API</a>.

The getter of the <dfn attribute for="WebAssembly">JSTag</dfn> attribute of the {{WebAssembly}} Namespace, when invoked, performs the following steps:
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. Return |JSTagObject|.

<h3 id="modules">Modules</h3>

<pre class="idl">
Expand Down Expand Up @@ -1306,6 +1313,9 @@ The <dfn constructor for=Exception
lt="Exception(exceptionTag, payload, options)">new Exception(|exceptionTag|, |payload|, |options|)</dfn>
constructor steps are:

1. Let |JSTagAddr| be the result of [=get the JavaScript exception tag|getting the JavaScript exception tag=].
1. If |exceptionTag|.\[[Address]] is equal to |JSTagAddr|,
1. Throw a {{TypeError}}.
1. Let |store| be the [=surrounding agent=]'s [=associated store=].
1. Let [|types|] → [] be [=tag_type=](|store|, |exceptionTag|.\[[Address]]).
1. If |types|'s [=list/size=] is not |payload|'s [=list/size=],
Expand Down