Skip to content

Commit

Permalink
[EH] Don't write to readonly Exception.stack property (emscripten-cor…
Browse files Browse the repository at this point in the history
…e#21065)

Apparently `WebAssembly.Exception.stack` has been `readonly` all along
and I wasn't aware. While I'm not sure if this should be `readonly` and
this may change in the future, for now writing to this property is not
spec compliant, so this removes the routine that tidies up the stack
trace, which is not the end of the world.

Fixes emscripten-core#21044.
  • Loading branch information
aheejin authored Jan 12, 2024
1 parent 1df0255 commit 12b814a
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions src/library_exceptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,20 +327,6 @@ var LibraryExceptions = {
__throw_exception_with_stack_trace: (ex) => {
var e = new WebAssembly.Exception(getCppExceptionTag(), [ex], {traceStack: true});
e.message = getExceptionMessage(e);
// The generated stack trace will be in the form of:
//
// Error
// at ___throw_exception_with_stack_trace(test.js:1139:13)
// at __cxa_throw (wasm://wasm/009a7c9a:wasm-function[1551]:0x24367)
// ...
//
// Remove this JS function name, which is in the second line, from the stack
// trace. Note that .stack does not yet exist in all browsers (see #18828).
if (e.stack) {
var arr = e.stack.split('\n');
arr.splice(1,1);
e.stack = arr.join('\n');
}
throw e;
},
#endif
Expand Down

0 comments on commit 12b814a

Please sign in to comment.