Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 2bfe8aece710c090c98d8fe093c106b405f97f83
https://github.com/WebKit/WebKit/commit/2bfe8aece710c090c98d8fe093c106b405f97f83
Author: BJ Burg <[email protected]>
Date: 2026-05-20 (Wed, 20 May 2026)
Changed paths:
A
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-request-id-uniqueness-expected.txt
A
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-request-id-uniqueness.html
M LayoutTests/platform/mac-wk2/TestExpectations
M Source/JavaScriptCore/inspector/protocol/Network.json
M Source/WebCore/inspector/InspectorIdentifierRegistry.cpp
M Source/WebCore/inspector/InspectorIdentifierRegistry.h
M Source/WebCore/inspector/PageInspectorController.cpp
M Source/WebCore/inspector/PageInspectorController.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/loader/ResourceLoaderIdentifier.h
M Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js
M Source/WebInspectorUI/UserInterface/Protocol/MultiplexingBackendTarget.js
M Source/WebKit/Scripts/webkit/messages.py
M Source/WebKit/Shared/ProcessQualified.serialization.in
M Source/WebKit/UIProcess/Inspector/Agents/ProxyingNetworkAgent.cpp
M Source/WebKit/UIProcess/Inspector/Agents/ProxyingNetworkAgent.h
M Source/WebKit/UIProcess/Inspector/Agents/ProxyingNetworkAgent.messages.in
M Source/WebKit/WebProcess/Inspector/FrameNetworkAgentProxy.cpp
M Source/WebKit/WebProcess/WebPage/WebPage.cpp
Log Message:
-----------
[Site Isolation] Web Inspector: deterministic Network IDs, event routing, and
frontend fixes for cross-origin iframes
https://bugs.webkit.org/show_bug.cgi?id=310164
Reviewed by Qianlang Chen.
This is the companion to bug 310163 (ProxyingNetworkAgent IPC plumbing). That
patch adds the cross-process forwarding infrastructure; this patch makes the
protocol IDs deterministic and fixes the frontend routing so Network events
from remote processes actually appear in the Network panel. The split keeps
IPC/agent structure separate from ID scheme and frontend integration for
reviewability.
Under the SI Inspector architecture, some domains are per-frame (Console,
Runtime, Debugger -- handled via FrameInspectorController in the WebContent
process and routed through the target system) while others are page-level
"octopus" agents (Network, Page -- aggregated in UIProcess via
ProxyingNetworkAgent/ProxyingPageAgent on the MultiplexingBackendTarget).
Network is an octopus domain because the frontend's NetworkManager maintains
a single unified resource list and frame tree, so all processes' events must
be merged into one coherent stream with non-colliding IDs.
* Source/WebCore/inspector/InspectorIdentifierRegistry.h:
(Inspector::IdentifierRegistry::deterministicFrameId): Added.
Produce "frame-PID.OID" from FrameIdentifier bit-packing so UIProcess
and WebContent independently compute matching frame IDs.
(Inspector::IdentifierRegistry::deterministicRequestId): Added.
Produce "request-PID.OID" from ProcessIdentifier + ResourceLoaderIdentifier.
(Inspector::IdentifierRegistry::deterministicLoaderId): Added.
Produce "loader-PID.OID" from ScriptExecutionContextIdentifier.
* Source/WebCore/inspector/InspectorIdentifierRegistry.cpp:
Add BackendIdentifierRegistry implementation. Uses deterministic IDs for
frameId/requestId, falls back to IdentifiersFactory for loaderId when
the document is not yet available (FIXME rdar://170087346).
* Source/JavaScriptCore/inspector/protocol/Network.json:
Add "web-page" to Network domain targetTypes. This enables the frontend
to initialize NetworkManager on the MultiplexingBackendTarget, which is
the page-level target that octopus agents like ProxyingNetworkAgent use
to dispatch events aggregated from all WebContent processes.
* Source/WebCore/inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::buildObjectForFrame):
Emit RemoteFrame stubs in Page.getResourceTree response so the frontend
creates placeholder frames for cross-origin iframes before Network
events arrive.
* Source/WebCore/inspector/agents/InspectorPageAgent.h:
Add buildObjectForRemoteFrame() helper.
* Source/WebCore/inspector/agents/page/PageNetworkAgent.cpp:
(WebCore::PageNetworkAgent::enable):
Return early under Site Isolation. When SI is active,
ProxyingNetworkAgent handles all network instrumentation across
processes; enabling PageNetworkAgent would produce duplicate events
for the main frame's process.
* Source/WebCore/inspector/agents/page/PageNetworkAgent.h:
Add siteIsolationFirstEnabled() check.
* Source/WebCore/inspector/PageInspectorController.cpp:
(WebCore::PageInspectorController::siteIsolationFirstEnabled):
Track first SI activation to gate one-time initialization paths.
* Source/WebCore/inspector/PageInspectorController.h:
Add m_siteIsolationFirstEnabled flag, accessor.
* Source/WebCore/loader/ResourceLoaderIdentifier.h:
Add toRawValue() for deterministic ID bit-extraction.
* Source/WebKit/Shared/ProcessQualified.serialization.in:
Add IPC serialization for ProcessQualified<ResourceLoaderIdentifier>
(ScopedResourceLoaderIdentifier).
* Source/WebKit/UIProcess/Inspector/Agents/ProxyingNetworkAgent.cpp:
(Inspector::ProxyingNetworkAgent::requestWillBeSent):
(Inspector::ProxyingNetworkAgent::responseReceived):
(Inspector::ProxyingNetworkAgent::dataReceived):
(Inspector::ProxyingNetworkAgent::loadingFinished):
(Inspector::ProxyingNetworkAgent::loadingFailed):
(Inspector::ProxyingNetworkAgent::requestServedFromMemoryCache):
Use deterministicFrameId/RequestId/LoaderId for all protocol events
dispatched to the frontend. Extract ProcessIdentifier from
ScopedResourceLoaderIdentifier for request ID qualification.
* Source/WebKit/UIProcess/Inspector/Agents/ProxyingNetworkAgent.messages.in:
Change ResourceLoaderIdentifier to ScopedResourceLoaderIdentifier in
all IPC messages for process-qualified resource IDs.
* Source/WebKit/WebProcess/Inspector/FrameNetworkAgentProxy.cpp:
Wrap ResourceLoaderIdentifier with ProcessIdentifier to produce
ScopedResourceLoaderIdentifier for IPC transport.
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
Register new frame with WebInspectorBackend when a local frame is
created under SI, triggering FrameNetworkAgentProxy setup.
* Source/WebKit/Scripts/webkit/messages.py:
Add ProcessQualified import for IPC code generation.
* Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js:
(WI.NetworkManager.prototype._addNewResourceToFrameOrTarget):
Lazily create stub WI.Frame objects when Network events arrive for
deterministic "frame-*" IDs not yet in _frameIdentifierMap. This
handles the case where Network events arrive before Page.getResourceTree
completes for dynamically-added cross-origin iframes.
(WI.NetworkManager.prototype.frameDidNavigate):
Handle null loaderIdentifier on RemoteFrame stubs by adopting the
first resource's loaderIdentifier.
(WI.NetworkManager.prototype.initializeTarget):
Defer Network agent initialization on MultiplexingBackendTarget until
the first FrameTarget signals SI is active, preventing premature
enable on non-SI pages.
* Source/WebInspectorUI/UserInterface/Protocol/MultiplexingBackendTarget.js:
(WI.MultiplexingBackendTarget):
Add Network to the set of agents initialized on the web-page target.
*
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-request-id-uniqueness.html:
Add waitForCommittedFrameTarget() helper that handles the provisional
target lifecycle (initial target -> provisional commit -> committed
target with execution context).
Canonical link: https://commits.webkit.org/313621@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications