Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 432718f7014504b7c47a2be346f8f015fa36488e
https://github.com/WebKit/WebKit/commit/432718f7014504b7c47a2be346f8f015fa36488e
Author: Devin Rousso <[email protected]>
Date: 2026-10-13 (Tue, 13 Oct 2026)
Changed paths:
A
LayoutTests/inspector/console/console-log-single-tostring-invocation-expected.txt
A LayoutTests/inspector/console/console-log-single-tostring-invocation.html
M LayoutTests/inspector/worker/console-basic-expected.txt
M LayoutTests/inspector/worker/console-basic.html
M Source/JavaScriptCore/inspector/ConsoleMessage.cpp
M Source/JavaScriptCore/inspector/ConsoleMessage.h
M Source/JavaScriptCore/inspector/InjectedScript.cpp
M Source/JavaScriptCore/inspector/InjectedScript.h
M Source/JavaScriptCore/inspector/InjectedScriptSource.js
M Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp
M Source/WebCore/page/FrameConsoleClient.cpp
M Source/WebCore/workers/WorkerConsoleClient.cpp
Log Message:
-----------
Web Inspector: toString is called twice by console log
https://bugs.webkit.org/show_bug.cgi?id=306712
Reviewed by Timothy Hatcher.
Web Inspector attempts to stringify the first argument passed to `console`
methods as the primary "message".
If the first argument is an object, however, this happens again when generating
a `description` for the `Runtime.RemoteObject`.
This second can be used to observe whether Web Inspector is open as the latter
only happens then.
To avoid this, we can simply save and reuse the result of the first instead of
doing it again.
* Source/JavaScriptCore/inspector/ConsoleMessage.h:
(Inspector::ConsoleMessage::setMessageIsFirstArgument): Added.
* Source/JavaScriptCore/inspector/ConsoleMessage.cpp:
(Inspector::ConsoleMessage::addToFrontend):
* Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp:
(Inspector::JSGlobalObjectConsoleClient::messageWithTypeAndLevel):
* Source/WebCore/page/FrameConsoleClient.cpp:
(WebCore::FrameConsoleClient::messageWithTypeAndLevel):
* Source/WebCore/workers/WorkerConsoleClient.cpp:
(WebCore::WorkerConsoleClient::messageWithTypeAndLevel):
* Source/JavaScriptCore/inspector/InjectedScript.h:
* Source/JavaScriptCore/inspector/InjectedScript.cpp:
(Inspector::InjectedScript::wrapObject const):
* Source/JavaScriptCore/inspector/InjectedScriptSource.js:
(InjectedScript.prototype.wrapObject):
(RemoteObject):
(RemoteObject.create):
(RemoteObject.describe):
* LayoutTests/inspector/console/console-log-single-tostring-invocation.html:
Added.
*
LayoutTests/inspector/console/console-log-single-tostring-invocation-expected.txt:
Added.
* LayoutTests/inspector/worker/console-basic.html:
* LayoutTests/inspector/worker/console-basic-expected.txt:
Canonical link: https://commits.webkit.org/323668@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications