exception-handling icon indicating copy to clipboard operation
exception-handling copied to clipboard

Missing s128 type check in the JS API?

Open thibaudmichaud opened this issue 1 year ago • 2 comments

If I am reading the spec correctly, s128 types are allowed in tags, whether the tag is defined in a wasm module, or created with the JS API's WebAssembly.Tag constructor.

But the WebAssembly.Exception constructor and the WebAssembly.Exception#getArg function use ToWebAssemblyValue and ToJSValue to convert values to/from JS, and this function simply asserts that the type is not s128. Is a type check missing here, or did I miss something?

thibaudmichaud avatar Feb 14 '24 16:02 thibaudmichaud

What do we do for exported functions that return s128 function return types? Do we disallow it or do we trap? I guess we can do the same for getArg..

aheejin avatar Feb 15 '24 22:02 aheejin

We throw a TypeError when the exported function is called. I agree, we should do something similar here and throw a TypeError if we try to create a WA.Exception from JS with any s128 in it, or call getArg on an s128 param (but there may be other s128 params in this case, I think that would be fine as long as we don't access them).

thibaudmichaud avatar Feb 15 '24 22:02 thibaudmichaud