RESOLVED FIXED299629
REGRESSION (Safari 26): Apps using Emscripten with -fwasm-exceptions fail with an exception on startup
https://bugs.webkit.org/show_bug.cgi?id=299629
Summary REGRESSION (Safari 26): Apps using Emscripten with -fwasm-exceptions fail wit...
mithrendal
Reported 2025-09-26 13:14:27 PDT
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
Radar WebKit Bug Importer
Comment 1 2025-09-26 14:43:20 PDT
Shu-yu Guo
Comment 2 2025-09-26 23:14:14 PDT
mithrendal
Comment 3 2025-09-28 10:02:42 PDT
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
Comment 4 2025-10-06 12:58:40 PDT
EWS
Comment 5 2025-10-06 14:36:03 PDT
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
Comment 6 2025-10-06 21:45:50 PDT
Re-opened since this is blocked by bug 300289
Yusuke Suzuki
Comment 7 2025-10-06 21:51:06 PDT
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
Comment 8 2025-10-07 10:58:45 PDT
EWS
Comment 9 2025-10-07 15:27:36 PDT
Committed 301170@main (09be1474d0e6): <https://commits.webkit.org/301170@main> Reviewed commits have been landed. Closing PR #51954 and removing active labels.
mithrendal
Comment 10 2025-10-08 03:20:46 PDT
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
Note You need to log in before you can comment on or make changes to this bug.