From 4becd1167a31105dedf37b21653600e5ff290d39 Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Mon, 9 Nov 2026 00:56:16 +0000 Subject: [PATCH] [JSC] The inspector shows `boundThis` of an arrow function as undefined while `this` of its derived constructor has no value JSInjectedScriptHost::getInternalProperties() reads `this` of an arrow function from the scope of the function, for the internal property `boundThis`. In a derived constructor that scope slot holds the empty value until super() returns. constructInternalProperty() stored the empty value with putDirect(), and the process aborted. A debugger client sends the request when the user expands the arrow function in its variables view, while the program is paused in the constructor before super(). The empty value is undefined now, as for a variable without a value in DebuggerScope::getOwnPropertySlot() and for `this` of a frame in DebuggerCallFrame::thisValue(). --- Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp b/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp index d18e0c93f8bfb..1b53e0fd4cea3 100644 --- a/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp +++ b/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp @@ -582,6 +582,9 @@ JSValue JSInjectedScriptHost::getInternalProperties(JSGlobalObject* globalObject RETURN_IF_EXCEPTION(scope, JSValue()); JSValue thisObject = jsScope->get(globalObject, vm.propertyNames->builtinNames().thisPrivateName()); RETURN_IF_EXCEPTION(scope, JSValue()); + // |this| of a derived constructor has no value before super() returns. As DebuggerScope does for a variable without a value, say undefined. + if (!thisObject) + thisObject = jsUndefined(); array->putDirectIndex(globalObject, index++, constructInternalProperty(globalObject, "boundThis"_s, thisObject)); RETURN_IF_EXCEPTION(scope, JSValue()); return array;