From 12b814ac5f79bf8bf0703fd94586bc49350a049a Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Thu, 11 Jan 2024 18:55:18 -0800 Subject: [PATCH] [EH] Don't write to readonly Exception.stack property (#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 #21044. --- src/library_exceptions.js | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/library_exceptions.js b/src/library_exceptions.js index be10a631c688e..17ae258193a15 100644 --- a/src/library_exceptions.js +++ b/src/library_exceptions.js @@ -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