Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: fba6f421140273037c3094577e69a60a85b3326a
https://github.com/WebKit/WebKit/commit/fba6f421140273037c3094577e69a60a85b3326a
Author: Qianlang Chen <[email protected]>
Date: 2025-10-27 (Mon, 27 Oct 2025)
Changed paths:
M Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp
M Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h
M Source/WebCore/inspector/FrameInspectorController.cpp
M Source/WebCore/inspector/InspectorController.h
M Source/WebCore/inspector/InspectorFrontendClientLocal.cpp
M Source/WebCore/inspector/InspectorFrontendClientLocal.h
M Source/WebCore/testing/Internals.cpp
Log Message:
-----------
Web Inspector: Support the frame target in protocol tests
rdar://163222919
https://bugs.webkit.org/show_bug.cgi?id=301304
Reviewed by Devin Rousso.
Our current inspector protocol testing infrastructure uses the
InspectorStubFrontend
that sends protocol commands directly into the WebCore Page and its
InspectorController.
As we start moving inspector domains and agents from page/InspectorController
to frame/FrameInspectorController, protocol tests will break due to
commands being still sent to the page and not the frame where they'll
be handled.
Make InspectorStubFrontend send commands to the main frame's
FrameInspectorController
instead. As the frame currently still has no domains or agents, add a
fallback mechanism for BackendDispatcher to let frame forward commands
to its page for missing domains. This allows us to begin moving agents
from page to frame while easily maintaining protocol testing coverage.
InspectorStubFrontend still needs to connect with the page plus its
InspectorController
because that's when lazy agent creation and agent registration happens.
So, it connects to both the page and the main frame.
One caveat of this "connect to page and main frame" solution is that it
still won't work when a protocol test involves more than one frame
(has iframes), as there's no way for the InspectorStubFrontend or
InspectorProtocol
to specify a destination for commands. There exists 8 protocol tests
involving iframes that we may need to rework while re-architecting their
corresponding domains:
1. inspector/console/x-frame-options-message.html
2. inspector/dom/dom-search-caseSensitive.html
3. inspector/dom/dom-search-crash.html
4. inspector/dom/dom-search-with-context.html
5. inspector/dom/dom-search.html
6. inspector/runtime/execution-context-in-scriptless-page.html
7. inspector/runtime/executionContextCreated-isolated-world.html
8. inspector/runtime/executionContextCreated-onEnable.html
Given the small number, it should be worthwhile to include this patch
anyway and address these tests later.
No expected perceived behavior change. Existing protocol tests verify
this change.
* Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp:
(Inspector::BackendDispatcher::BackendDispatcher):
(Inspector::BackendDispatcher::create):
(Inspector::BackendDispatcher::dispatch):
* Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h:
* Source/WebCore/inspector/FrameInspectorController.cpp:
(WebCore::FrameInspectorController::FrameInspectorController):
* Source/WebCore/inspector/InspectorController.h:
Add fallback mechanism for BackendDispatcher so that the frame can
forward commands from unknown domains to its page.
* Source/WebCore/inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorBackendDispatchTask::create):
(WebCore::InspectorBackendDispatchTask::InspectorBackendDispatchTask):
(WebCore::InspectorBackendDispatchTask::dispatchOneMessage):
(WebCore::InspectorFrontendClientLocal::InspectorFrontendClientLocal):
Add a way for InspectorBackendDispatchTask to be able to send to the
main frame instead of the page.
* Source/WebCore/inspector/InspectorFrontendClientLocal.h:
* Source/WebCore/testing/Internals.cpp:
(WebCore::InspectorStubFrontend::InspectorStubFrontend):
(WebCore::InspectorStubFrontend::closeWindow):
(WebCore::Internals::openDummyInspectorFrontend):
Make InspectorStubFrontend, the frontend channel used in protocol
tests, connect with and send commands to the main frame instead.
Canonical link: https://commits.webkit.org/302178@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications