You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Site Isolation] Web Inspector: Only LocalFrame should require frame target and inspector controller
https://webkit.org/b/299493
rdar://161281114
Reviewed by BJ Burg.
Given only LocalFrame should end up handling inspector commands and
events, it should be worthwhile to tweak the design so that a frame
target corresponds to a local frame rather than any frame. This should
help simplify our architecture as we start implementing domains for the
frame target (so that e.g. we don't need to check whether the inspected
frame is local or remote all the time).
Here's how frame targets are handled now in each process/component:
- In UI process, it was already the case that the number of frame target
proxies (WebFrameInspectorTargetProxy) equals to the number of local
frames there are, due to each proxy associating with a WebFrameProxy.
- In WebCore, only LocalFrame now creates an inspector controller (FrameInspectorController)
to provide the inspector agents.
- In WebKit, WebFrame now only creates an inspector target (WebFrameInspectorTarget)
if it's local. This is now also done lazily as inspection is needed.
With this change, future inspector-related objects working with frames
can start targeting local frames instead. There's currently few use
cases needing to adapt to this change, in WindowProxy, DOMWindow, and
FrameConsoleClient, which are updated by this patch as well.
No new tests as there's no intended noticeable changes in behavior.
Existing inspector tests should cover use cases related to this change.
* Source/WebCore/inspector/FrameInspectorController.cpp:
(WebCore::FrameInspectorController::FrameInspectorController):
* Source/WebCore/inspector/FrameInspectorController.h:
* Source/WebCore/page/Frame.cpp:
(WebCore::Frame::Frame):
(WebCore::Frame::protectedInspectorController): Deleted.
* Source/WebCore/page/Frame.h:
(WebCore::Frame::inspectorController): Deleted.
(WebCore::Frame::console): Deleted.
(WebCore::Frame::console const): Deleted.
* Source/WebCore/page/LocalFrame.cpp:
(WebCore::LocalFrame::LocalFrame):
(WebCore::LocalFrame::protectedInspectorController):
* Source/WebCore/page/LocalFrame.h:
In WebCore, only LocalFrame now has an inspector controller.
* Source/WebCore/page/FrameConsoleClient.cpp:
(WebCore::FrameConsoleClient::FrameConsoleClient):
(WebCore::FrameConsoleClient::addMessage):
(WebCore::FrameConsoleClient::messageWithTypeAndLevel):
(WebCore::FrameConsoleClient::count):
(WebCore::FrameConsoleClient::countReset):
(WebCore::FrameConsoleClient::profile):
(WebCore::FrameConsoleClient::profileEnd):
(WebCore::FrameConsoleClient::takeHeapSnapshot):
(WebCore::FrameConsoleClient::time):
(WebCore::FrameConsoleClient::timeLog):
(WebCore::FrameConsoleClient::timeEnd):
(WebCore::FrameConsoleClient::timeStamp):
(WebCore::FrameConsoleClient::screenshot):
* Source/WebCore/page/FrameConsoleClient.h:
Given FrameConsoleClient only operated on local frames, make it also
now only owned by LocalFrame instead.
* Source/WebCore/bindings/js/WindowProxy.cpp:
(WebCore::WindowProxy::setDOMWindow):
* Source/WebCore/page/DOMWindow.cpp:
(WebCore::DOMWindow::console const):
Adapt to now only LocalFrame has a console client.
* Source/WebKit/WebProcess/Inspector/WebFrameInspectorTarget.cpp:
(WebKit::WebFrameInspectorTarget::connect):
(WebKit::WebFrameInspectorTarget::disconnect):
(WebKit::WebFrameInspectorTarget::sendMessageToTargetBackend):
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::WebFrame):
(WebKit::WebFrame::ensureInspectorTarget):
(WebKit::WebFrame::connectInspector):
(WebKit::WebFrame::disconnectInspector):
(WebKit::WebFrame::sendMessageToInspectorTarget):
* Source/WebKit/WebProcess/WebPage/WebFrame.h:
Make only local WebFrames create an inspector target, which is now
lazily initialized.
Canonical link: https://commits.webkit.org/300543@main
0 commit comments