[webkit-changes] [WebKit/WebKit] 77830d: Web Inspector: Console messages may be lost on mai...
Patrick Angle
noreply at github.com
Fri Mar 10 11:17:05 PST 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 77830d12bea6680bcd70a3f2c48fe58b6c24a74f
https://github.com/WebKit/WebKit/commit/77830d12bea6680bcd70a3f2c48fe58b6c24a74f
Author: Patrick Angle <pangle at apple.com>
Date: 2023-03-10 (Fri, 10 Mar 2023)
Changed paths:
M LayoutTests/inspector/console/messagesCleared-expected.txt
M LayoutTests/inspector/console/messagesCleared.html
M Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp
M Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h
M Source/JavaScriptCore/inspector/protocol/Console.json
M Source/WebCore/inspector/InspectorInstrumentation.cpp
M Source/WebInspectorUI/UserInterface/Controllers/ConsoleManager.js
M Source/WebInspectorUI/UserInterface/Protocol/ConsoleObserver.js
Log Message:
-----------
Web Inspector: Console messages may be lost on main frame navigation depending on timing
https://bugs.webkit.org/show_bug.cgi?id=251659
rdar://104303833
Reviewed by Devin Rousso.
The existing heuristic to determine if console messages are being cleared as the result of a main frame navigation made
the assumption that console messages won't be received between the call to clear messages and the next tick in Web
Inspector. This isn't a safe assumption, and can be observed when logging immediately after a navigation on some
computers/under certain types of loads. Instead of inferring why the console is being cleared, introduce a `reason`
parameter that tells us if the request to clear is the result of a main frame navigation, removing any doubt. For
compatibility with older remote ends, we keep the existing heuristic, since its better than nothing.
* LayoutTests/inspector/console/messagesCleared-expected.txt:
* LayoutTests/inspector/console/messagesCleared.html:
- Ensure that a new session was signalled due to a refresh when the console is cleared.
* Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp:
(Inspector::InspectorConsoleAgent::clearMessages):
(Inspector::InspectorConsoleAgent::mainFrameNavigated):
(Inspector::InspectorConsoleAgent::clearMessages):
(Inspector::InspectorConsoleAgent::reset): Deleted.
- Provide a reason for the clearing of the console.
* Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h:
* Source/JavaScriptCore/inspector/protocol/Console.json:
* Source/WebCore/inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didCommitLoadImpl):
* Source/WebInspectorUI/UserInterface/Controllers/ConsoleManager.js:
(WI.ConsoleManager):
(WI.ConsoleManager.prototype.messagesCleared):
- Use the reason to immediately determine how to handle clearing the console, instead of waiting until the next tick.
(WI.ConsoleManager.prototype._clearMessages):
- Extract the common logic that actually clears the console so we can reuse it for both the new reason-based path as
well as the compatibility path.
(WI.ConsoleManager.prototype._delayedMessagesCleared):
* Source/WebInspectorUI/UserInterface/Protocol/ConsoleObserver.js:
(WI.ConsoleObserver.prototype.messagesCleared):
Canonical link: https://commits.webkit.org/261512@main
More information about the webkit-changes
mailing list