Skip to content

Commit

Permalink
Throw TypeError if new Exception or getArg would expose v128 to JS (#309
Browse files Browse the repository at this point in the history
)

Fixes #308
Fixes #295
  • Loading branch information
dschuff committed Jun 14, 2024
1 parent 87ae341 commit f30dfee
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions document/js-api/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,8 @@ constructor steps are:
1. Throw a {{TypeError}}.
1. Let |wasmPayload| be « ».
1. [=list/iterate|For each=] |value| and |resultType| of |payload| and |types|, paired linearly,
1. If |resultType| is [=v128=] or [=exnref=],
1. Throw a {{TypeError}}.
1. [=list/Append=] [=?=] [=ToWebAssemblyValue=](|value|, |resultType|) to |wasmPayload|.
1. Let (|store|, |exceptionAddr|) be [=exn_alloc=](|store|, |exceptionTag|.\[[Address]], |wasmPayload|)
1. Set the [=surrounding agent=]'s [=associated store=] to |store|.
Expand All @@ -1341,6 +1343,9 @@ The <dfn method for="Exception">getArg(|index|)</dfn> method steps are:
1. Assert: |tagaddr| is equal to **this**.\[[Type]].
1. If |index| ≥ |payload|'s [=list/size=],
1. Throw a {{RangeError}}.
1. Let [|types|] → [] be [=tag_type=](|store|, |tagaddr|).
1. If |types|[|index|] is [=v128=] or [=exnref=],
1. Throw a {{TypeError}}.
1. Return [=ToJSValue=](|payload|[|index|]).

</div>
Expand Down

0 comments on commit f30dfee

Please sign in to comment.