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
Per the current spec, when we call WebAssembly.Exception.getArg, we get a payload from exn_read, and invoke ToJSValue on an element of it.
From the definition of exn_read, the returned element we use for the payload is the field tuple from the exception instance, which is just some number of ordinary WebAssembly values val*.
But, in ToJSValue, we start off with this assertion:
Since v128 is an ordinary WebAssembly value type, it seems valid currently for one to occur in the return tuple of exn_read. But then, getArg funnels that value directly into ToJSValue, violating its invariants. I might be overlooking something? Otherwise, it seems like there should probably be a check for v128 elements in getArg which throws a TypeError.
The text was updated successfully, but these errors were encountered:
Yes, I think you are exactly right. v128 values can't currently be passed to JS, and there are various other places where we throw similar TypeErrors (e.g. the GetGlobalValue algorithm, the parameter conversion steps of "call an Exported Function" and "run a host function") before we invoke ToJSValue. It might make sense to sink that check into ToJSValue itself, but I haven't checked whether there are any places where e.g. we wouldn't be able to throw from there. But assuming we don't do that, then yeah, getArg should have the check, and also the Exception constructor (because ToWebAssemblyValue has a similar assertion). I can make a fix for that.
Per the current spec, when we call
WebAssembly.Exception.getArg
, we get apayload
fromexn_read
, and invokeToJSValue
on an element of it.From the definition of
exn_read
, the returned element we use for the payload is the field tuple from the exception instance, which is just some number of ordinary WebAssembly valuesval*
.But, in
ToJSValue
, we start off with this assertion:Since
v128
is an ordinary WebAssembly value type, it seems valid currently for one to occur in the return tuple ofexn_read
. But then,getArg
funnels that value directly intoToJSValue
, violating its invariants. I might be overlooking something? Otherwise, it seems like there should probably be a check forv128
elements ingetArg
which throws aTypeError
.The text was updated successfully, but these errors were encountered: