Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 73d97f544b965a58c49b45851423103e3a957e1c
https://github.com/WebKit/WebKit/commit/73d97f544b965a58c49b45851423103e3a957e1c
Author: BJ Burg <[email protected]>
Date: 2026-05-13 (Wed, 13 May 2026)
Changed paths:
A
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-network-events-have-correct-frame-id-expected.txt
A
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-network-events-have-correct-frame-id.html
A
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-network-loading-finished-expected.txt
A
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-network-loading-finished.html
A
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-resource-appears-in-network-domain-expected.txt
A
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-resource-appears-in-network-domain.html
A
LayoutTests/http/tests/site-isolation/inspector/network/resources/data.json
A
LayoutTests/http/tests/site-isolation/inspector/network/resources/iframe-with-abort.html
A
LayoutTests/http/tests/site-isolation/inspector/network/resources/iframe-with-fetch.html
A
LayoutTests/http/tests/site-isolation/inspector/network/resources/slow-response.py
M LayoutTests/platform/mac-wk2/TestExpectations
M Source/WebCore/CMakeLists.txt
M Source/WebCore/Headers.cmake
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/inspector/InspectorInstrumentation.cpp
M Source/WebCore/inspector/InspectorInstrumentation.h
M Source/WebCore/inspector/InspectorResourceType.h
M Source/WebCore/inspector/InspectorResourceUtilities.h
M Source/WebCore/inspector/InstrumentingAgents.h
M Source/WebCore/inspector/PageInspectorController.cpp
M Source/WebCore/inspector/PageInspectorController.h
A Source/WebCore/inspector/UncachedLoadType.h
M Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp
M Source/WebCore/inspector/agents/InspectorNetworkAgent.h
M Source/WebCore/inspector/agents/InspectorPageAgent.cpp
M Source/WebCore/inspector/agents/InspectorPageAgent.h
M Source/WebCore/inspector/agents/page/PageNetworkAgent.cpp
M Source/WebCore/inspector/agents/page/PageNetworkAgent.h
M Source/WebCore/inspector/agents/worker/WorkerNetworkAgent.h
A Source/WebCore/inspector/hooks/NetworkAgentInstrumentation.h
M Source/WebCore/loader/PingLoader.cpp
M Source/WebCore/loader/cache/CachedResource.cpp
M Source/WebCore/page/Page.h
M Source/WebKit/CMakeLists.txt
M Source/WebKit/DerivedSources-input.xcfilelist
M Source/WebKit/DerivedSources-output.xcfilelist
M Source/WebKit/DerivedSources.make
M Source/WebKit/Scripts/webkit/messages.py
A Source/WebKit/Shared/InspectorNetworkTypes.serialization.in
M Source/WebKit/Shared/WebPageCreationParameters.h
M Source/WebKit/Shared/WebPageCreationParameters.serialization.in
M Source/WebKit/Sources.txt
M Source/WebKit/SourcesCocoa.txt
A Source/WebKit/UIProcess/Inspector/Agents/ProxyingNetworkAgent.cpp
A Source/WebKit/UIProcess/Inspector/Agents/ProxyingNetworkAgent.h
A Source/WebKit/UIProcess/Inspector/Agents/ProxyingNetworkAgent.messages.in
M Source/WebKit/UIProcess/Inspector/WebPageInspectorController.cpp
M Source/WebKit/UIProcess/Inspector/WebPageInspectorController.h
M Source/WebKit/UIProcess/WebFrameProxy.cpp
M Source/WebKit/UIProcess/WebFrameProxy.h
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/WebKit.xcodeproj/project.pbxproj
M Source/WebKit/WebProcess/Inspector/FrameInspectorTarget.cpp
A Source/WebKit/WebProcess/Inspector/FrameNetworkAgentProxy.cpp
A Source/WebKit/WebProcess/Inspector/FrameNetworkAgentProxy.h
M Source/WebKit/WebProcess/Inspector/WebInspectorBackend.cpp
M Source/WebKit/WebProcess/Inspector/WebInspectorBackend.h
M Source/WebKit/WebProcess/Inspector/WebInspectorBackend.messages.in
M Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp
M Source/WebKit/WebProcess/WebPage/WebFrame.cpp
M Source/WebKit/WebProcess/WebPage/WebPage.cpp
Log Message:
-----------
[Site Isolation] Web Inspector: add ProxyingNetworkAgent for cross-process
network instrumentation
https://bugs.webkit.org/show_bug.cgi?id=310163
Reviewed by Qianlang Chen.
Under Site Isolation, cross-origin iframes run in separate WebContent processes.
The existing InspectorNetworkAgent only sees network activity within its own
process. This patch adds the cross-process plumbing so Web Inspector's Network
panel observes all network activity regardless of which process handles it.
On the WebProcess side, WebInspectorBackend is extended with
enableNetworkInstrumentation / disableNetworkInstrumentation IPC, which create
per-frame FrameNetworkAgentProxy instances and call
connectRemoteInstrumentation() on PageInspectorController to register the
frame's InstrumentingAgents.
NetworkAgentInstrumentation.h defines the abstract interface that both
InspectorNetworkAgent and FrameNetworkAgentProxy implement, allowing
InstrumentingAgents to hold a separate slot for the proxy agent.
Two new classes implement the "octopus agent" pattern used by SI Inspector:
FrameNetworkAgentProxy (WebContent process):
Implements the NetworkAgentInstrumentation interface -- the same hooks that
InspectorNetworkAgent uses (willSendRequest, didReceiveResponse, etc.).
Registered on a per-frame InstrumentingAgents slot so both the in-process
InspectorNetworkAgent and the cross-process proxy can coexist. Serializes
each hook's parameters into IPC messages sent to the UIProcess.
ProxyingNetworkAgent (UIProcess):
Receives IPC from all WebContent processes, translates parameters back into
protocol events, and dispatches them to the frontend via the existing Network
domain dispatcher. Implements NetworkBackendDispatcherHandler for frontend
commands (enable, disable, setExtraHTTPHeaders, getResponseBody).
When Site Isolation is not enabled, ProxyingNetworkAgent::enable() returns
early (siteIsolationEnabled() check). The existing single-process
InspectorNetworkAgent handles everything as before. No IPC is sent, no
proxies are created. WebKitLegacy keeps using InspectorNetworkAgent.
== Process instrumentation lifecycle ==
ProxyingNetworkAgent tracks instrumented (processID, pageID) pairs with a
reference count in m_instrumentedProcessPageCounts. Multiple frames in the
same process share one EnableNetworkInstrumentation IPC; the last
disableInstrumentationForProcess() call tears down the receiver. The
disable() command is a force-teardown path that bypasses refcounting --
it sends DisableNetworkInstrumentation to all processes and clears all
state unconditionally, because disable() means the Network domain is being
torn down entirely.
== Test plan ==
Four new layout tests cover cross-origin iframe network instrumentation.
Three of four tests are expected to fail in this patch because they depend
on deterministic protocol IDs and frontend routing fixes added in the
follow-up patch (https://bugs.webkit.org/show_bug.cgi?id=310164). The
fourth test (request-id-uniqueness) passes because it only checks ID
collision, not frame routing.
* Source/WebCore/inspector/hooks/NetworkAgentInstrumentation.h: Added.
Abstract interface for network instrumentation hooks, parallel to
InspectorNetworkAgent's hook surface. Enables InstrumentingAgents to
hold both the in-process agent and the cross-process proxy simultaneously.
* Source/WebCore/inspector/InstrumentingAgents.h:
Add networkAgentProxy slot alongside existing networkAgent. Since Site
Isolation is runtime-enabled, both agent implementations can be active
simultaneously. This is safe because they use separate resource data
storage systems (NetworkResourcesData vs BackendResourceDataStore).
* Source/WebKit/UIProcess/Inspector/Agents/ProxyingNetworkAgent.h: Added.
* Source/WebKit/UIProcess/Inspector/Agents/ProxyingNetworkAgent.cpp: Added.
UIProcess aggregator agent. Handles enable/disable lifecycle, IPC
receiver registration, and Network protocol event dispatch.
* Source/WebKit/UIProcess/Inspector/Agents/ProxyingNetworkAgent.messages.in:
Added.
IPC messages from FrameNetworkAgentProxy to ProxyingNetworkAgent:
RequestWillBeSent, ResponseReceived, DataReceived, LoadingFinished,
LoadingFailed, RequestServedFromMemoryCache.
* Source/WebKit/WebProcess/Inspector/FrameNetworkAgentProxy.h: Added.
* Source/WebKit/WebProcess/Inspector/FrameNetworkAgentProxy.cpp: Added.
WebContent-side proxy. Implements NetworkAgentInstrumentation hooks and
forwards each event via IPC to the UIProcess ProxyingNetworkAgent.
* Source/WebKit/WebProcess/Inspector/WebInspectorBackend.h:
* Source/WebKit/WebProcess/Inspector/WebInspectorBackend.cpp:
(WebKit::WebInspectorBackend::enableNetworkInstrumentation):
Create FrameNetworkAgentProxy per local frame, call
connectRemoteInstrumentation() to register InstrumentingAgents.
(WebKit::WebInspectorBackend::disableNetworkInstrumentation):
Tear down all proxies, call disconnectRemoteInstrumentation().
(WebKit::WebInspectorBackend::ensureInstrumentationForFrame):
Create proxy for a specific frame with correct WebAgentContext.
* Source/WebKit/WebProcess/Inspector/WebInspectorBackend.messages.in:
Add EnableNetworkInstrumentation, DisableNetworkInstrumentation.
* Source/WebKit/UIProcess/Inspector/WebPageInspectorController.h:
* Source/WebKit/UIProcess/Inspector/WebPageInspectorController.cpp:
Own ProxyingNetworkAgent, wire enable/disable to forEachWebContentProcess.
* Source/WebKit/Sources.txt:
* Source/WebKit/SourcesCocoa.txt:
*
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-resource-appears-in-network-domain.html:
Added.
Verifies a fetch() in a cross-origin iframe produces a Resource in the
Network panel via WI.Frame.Event.ResourceWasAdded. Expected to fail
until deterministic IDs land (bug 310164).
*
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-resource-appears-in-network-domain-expected.txt:
Added.
*
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-network-loading-finished.html:
Added.
Verifies requestWillBeSent -> responseReceived -> loadingFinished event
sequence for a successful fetch, and requestWillBeSent -> loadingFailed
for an aborted fetch. Expected to fail until deterministic IDs land.
*
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-network-loading-finished-expected.txt:
Added.
*
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-network-events-have-correct-frame-id.html:
Added.
Verifies frameId on cross-origin network events differs from the main
frame's ID. Expected to fail until deterministic IDs land.
*
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-network-events-have-correct-frame-id-expected.txt:
Added.
*
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-request-id-uniqueness.html:
Added.
Verifies requestIds from different WebContent processes don't collide.
*
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-request-id-uniqueness-expected.txt:
Added.
*
LayoutTests/http/tests/site-isolation/inspector/network/resources/iframe-with-fetch.html:
Added.
Helper page that triggers a fetch() for cross-origin network tests.
*
LayoutTests/http/tests/site-isolation/inspector/network/resources/iframe-with-abort.html:
Added.
Helper page that triggers an aborted fetch() for loading-finished test.
Canonical link: https://commits.webkit.org/313207@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications