Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 70896f26ff64e9dcd3b67a9450da88af130e0c6d
https://github.com/WebKit/WebKit/commit/70896f26ff64e9dcd3b67a9450da88af130e0c6d
Author: Yusuke Suzuki <[email protected]>
Date: 2026-10-12 (Mon, 12 Oct 2026)
Changed paths:
A JSTests/stress/exception-stack-capture-handler-kind.js
M
Source/JavaScriptCore/SaferCPPExpectations/NoUncountedMemberCheckerExpectations
M Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
M Source/JavaScriptCore/inspector/ScriptCallStackFactory.cpp
M Source/JavaScriptCore/interpreter/Interpreter.cpp
M Source/JavaScriptCore/interpreter/Interpreter.h
M Source/JavaScriptCore/runtime/Exception.cpp
M Source/JavaScriptCore/runtime/Exception.h
M Source/JavaScriptCore/runtime/VM.cpp
M Source/JavaScriptCore/tools/JSDollarVM.cpp
M Source/JavaScriptCore/wasm/WasmConstExprGenerator.cpp
M Source/WebCore/bindings/js/WebCoreJSClientData.cpp
M Source/WebCore/bindings/js/WebCoreJSClientData.h
Log Message:
-----------
[JSC] Do not capture Exception's error stack information when error is caught
by user-handler definitely
https://bugs.webkit.org/show_bug.cgi?id=326332
rdar://189177825
Reviewed by Marcus Plutowski.
Exception is capturing error stack. This is just used only for Inspector
etc.'s error reporting. When error is caught by user's JS handler, then
ErrorInstance creation will capture error stack anyway instead of using
Exception's error stack.
This patch skips error stack capturing for Exception (not ErrorInstance)
when error is caught by user JS handler as this error stack is never read.
We also change async-without-await function's wrapping handler from
Finally to SynthesizedCatch. This patch's assumption was that a finally
handler "rethrows the same Exception cell or discards it". That holds
for real try/finally and the for-of iterator close. But an async function
with no await has its body inlined into its wrapper. There, a handler
typed HandlerType::Finally actually catches the throw and turns it into a
rejected promise. That handler type was chosen only so the catch handler
would load CompletionType::Throw. This SynthesizedCatch matches the async
wrapper that does use await, which already uses SynthesizedCatch. The walk
stops at it with no special case.
* JSTests/stress/exception-stack-capture-handler-kind.js: Added.
(shouldBe):
(userCatch):
(userCatchAroundCall):
(promiseConstructor):
(promiseTry):
(async asyncThrow):
(async asyncTryFinallyAroundCall):
(callAsyncInsideUserCatch):
(get catch):
(thenableGetterInsideUserCatch):
(shouldThrowAt):
(testUserCatch):
(testRejection):
*
Source/JavaScriptCore/SaferCPPExpectations/NoUncountedMemberCheckerExpectations:
* Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:
(JSC::FunctionNode::emitBytecode):
* Source/JavaScriptCore/inspector/ScriptCallStackFactory.cpp:
(Inspector::createScriptCallStackFromException):
* Source/JavaScriptCore/interpreter/Interpreter.cpp:
(JSC::isCatchingHandlerUserCatchClause):
(JSC::Interpreter::isExceptionCaughtByUserCatchClause):
* Source/JavaScriptCore/interpreter/Interpreter.h:
* Source/JavaScriptCore/runtime/Exception.cpp:
(JSC::Exception::visitChildrenImpl):
(JSC::Exception::stackForReporting):
* Source/JavaScriptCore/runtime/Exception.h:
* Source/JavaScriptCore/runtime/VM.cpp:
(JSC::VM::throwException):
* Source/JavaScriptCore/tools/JSDollarVM.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
(JSC::JSDollarVM::finishCreation):
* Source/JavaScriptCore/wasm/WasmConstExprGenerator.cpp:
* Source/WebCore/bindings/js/WebCoreJSClientData.cpp:
(WebCore::unmaskedSourceURLFromException):
* Source/WebCore/bindings/js/WebCoreJSClientData.h:
Canonical link: https://commits.webkit.org/323523@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications