Bug 297134

Summary: Exception (JS value) thrown inside WebAssembly using WebAssembly.JSTag is wrapped into WebAssembly.Exception immediately
Product: WebKit Reporter: bashorov
Component: WebAssemblyAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Major CC: webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

bashorov
Reported 2025-08-08 12:28:50 PDT
So as a result, 1. It's observable inside a wasm module as an instance of WebAssembly.Exception instead of thrown JS value. 2. It's not unwrapped when it crosses wasm-js border, so in JS it is also visible as an instance of WebAssembly.Exception instead of thrown JS value.
Attachments
Yusuke Suzuki
Comment 1 2025-08-08 13:26:16 PDT
Thanks! This will be fixed in bug 297127
Yusuke Suzuki
Comment 2 2025-08-08 13:26:21 PDT
*** This bug has been marked as a duplicate of bug 297127 ***
Radar WebKit Bug Importer
Comment 3 2025-08-08 13:27:17 PDT
Keith Miller
Comment 4 2025-08-08 16:16:34 PDT
Are you sure 2 is the case? https://webassembly.github.io/exception-handling/js-api/#call-an-exported-function says it is unwrapped back to the underlying JS value when propagating back through JS. I'm pretty sure the bug in https://github.com/WebKit/WebKit/pull/49130 was due to the opposite; we weren't unwrapping the `WebAssembly.Exception` if it had a JSTag for exported functions if it was created and thrown from wasm i.e. `(throw $JSTag someExternref)` What's the case you're seeing 1 in?
bashorov
Comment 5 2025-08-08 17:43:11 PDT
> we weren't unwrapping the `WebAssembly.Exception` (2) is basically saying the same thing
bashorov
Comment 6 2025-08-08 17:46:54 PDT
BTW, I don't see any test for (1) in the PR. Could you please check if it's fixed?
bashorov
Comment 7 2025-08-08 17:52:06 PDT
> What's the case you're seeing 1 in? Case: an exception is thrown inside wasm using JSTag and caught with JSTag inside wasm. Actual: in the catch block, we receive an instance of WebAssembly.Exception wrapping the original JS value, e,g, JS Error. Expected: in the catch block, we receive the original JS value.
Note You need to log in before you can comment on or make changes to this bug.