Bug 299629
| Summary: | REGRESSION (Safari 26): Apps using Emscripten with -fwasm-exceptions fail with an exception on startup | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | mithrendal |
| Component: | WebAssembly | Assignee: | daniel_liu4 |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | alonzakai, commit-queue, keith_miller, maximilian, syg, webkit-bug-importer, ysuzuki, zowers |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 26 | ||
| Hardware: | All | ||
| OS: | Unspecified | ||
| Bug Depends on: | 300289 | ||
| Bug Blocks: | |||
mithrendal
URL of the web app = https://vamigaweb.github.io/uat/
Safari 26.0 produces a runtime exception and immediately crashes.
previous Safari versions i.e. version 15.x until version 18.x do run the app fine and without issues. It works also fine in chrome and firefox.
the wasm code of the web app uses the fast efficient and modern EH and is therefore compiled/linked with emscripten compiler and link flag -fwasm-exceptions
when I compile the code base with the emscripten legacy javascript based exceptions i.e. -fexceptions then it works also in safari 26. Unfortunately the app then puts around 14% more pressure on the CPU because of the slower inefficient legacy exceptions...
the safari 26 issue is also described in the emscripten repo https://github.com/emscripten-core/emscripten/issues/25365
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/161438523>
Shu-yu Guo
Looks to be caused by https://commits.webkit.org/294069@main
mithrendal
Ok I tracked the problem down to this
**only** when using `LinkerFlag -O3` and `-fwasm-exceptions` and `Safari26`
then it does not catch exceptions with the following statement `catch(...)`
for example
```
try { emu->isReady(); } catch(...) {
EM_ASM({
setTimeout(function() {message_handler( 'MSG_ROM_MISSING' );}, 0);
});
}
```
will produce an unhandled exception stopping the web app
if I change the code to `catch(std::exception& e)`
```
try { emu->isReady(); } catch(std::exception& e) {
EM_ASM({
setTimeout(function() {message_handler( 'MSG_ROM_MISSING' );}, 0);
});
}
```
then it can be handled by Safari26.
if we lower down the LF from -O3 to -O2 then it also works with `catch(...)` statements
daniel_liu4
Pull request: https://github.com/WebKit/WebKit/pull/51888
EWS
Committed 301090@main (0b99951396c7): <https://commits.webkit.org/301090@main>
Reviewed commits have been landed. Closing PR #51888 and removing active labels.
WebKit Commit Bot
Re-opened since this is blocked by bug 300289
Yusuke Suzuki
BBQ and OMG are correctly advancing the call site index. So this is IPInt bug which is not setting exception handler range in an exclusive manner.
daniel_liu4
Pull request: https://github.com/WebKit/WebKit/pull/51954
EWS
Committed 301170@main (09be1474d0e6): <https://commits.webkit.org/301170@main>
Reviewed commits have been landed. Closing PR #51954 and removing active labels.
mithrendal
just tested the fix on my web apps
301165@main still crashes (which is expected)
301194@main works fine again (which is also expected since it contains the fix)
thank you very much for fixing it 😍
mithrendal@web.de