Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d4e3ca88a09ecc5a89c467bb8a75906d2ecc6f02
https://github.com/WebKit/WebKit/commit/d4e3ca88a09ecc5a89c467bb8a75906d2ecc6f02
Author: Qianlang Chen <[email protected]>
Date: 2026-07-24 (Fri, 24 Jul 2026)
Changed paths:
A
LayoutTests/http/tests/site-isolation/inspector/page/frame-navigated-loader-id-matches-network-cross-origin-iframe-expected.txt
A
LayoutTests/http/tests/site-isolation/inspector/page/frame-navigated-loader-id-matches-network-cross-origin-iframe.html
M Source/WebCore/inspector/InspectorIdentifierRegistry.cpp
M Source/WebCore/inspector/InspectorIdentifierRegistry.h
M Source/WebCore/inspector/InspectorResourceUtilities.h
M Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js
M Source/WebInspectorUI/UserInterface/Models/Frame.js
M Source/WebKit/Shared/InspectorPageTypes.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/UIProcess/Inspector/Agents/ProxyingPageAgent.cpp
M Source/WebKit/UIProcess/Inspector/Agents/ProxyingPageAgent.h
M Source/WebKit/UIProcess/Inspector/Agents/ProxyingPageAgent.messages.in
M Source/WebKit/WebProcess/Inspector/FrameNetworkAgentProxy.cpp
M Source/WebKit/WebProcess/Inspector/PageAgentProxy.cpp
M Source/WebKit/WebProcess/Inspector/WebInspectorBackend.cpp
Log Message:
-----------
Web Inspector: Site Isolation: Page.frameNavigated should include loaderId
from document identifier
https://bugs.webkit.org/show_bug.cgi?id=308895
rdar://171780771
Reviewed by BJ Burg.
Under Site Isolation the loaderId reported on Page.frameNavigated and
Page.getResourceTree did not match the loaderId the Network domain emits
for the same navigation's main resource. The frontend uses loaderId
purely as a correlation key between the Network and Page event streams
(NetworkManager.js): when a main-resource Network.requestWillBeSent
whose loaderId differs from the frame's committed loaderIdentifier
arrives, it starts a provisional load, and Page.frameNavigated commits
that load only when the event's loaderId equals the recorded provisional
loaderId. When the two disagree, the real main-resource load is
discarded and a fresh, empty main resource is synthesized in its place.
Root cause: the loaderId was derived from the frame's current document,
which changes across a navigation's commit. The Network stream computes
it at the main resource's willSendRequest -- before commit, when the
frame still shows the previous document -- while the Page stream
computes it at frameNavigated, after the new document has committed.
Deriving from frame->document()->identifier() therefore yields two
different strings for one load: the previous document's id on the
network event and the new document's id on the navigation. The frontend
never correlated them, so it discarded the real main resource for the
synthesized empty one.
Fix: derive the loaderId from the DocumentLoader's navigationID
(BackendIdentifierRegistry::loaderId). navigationID is assigned when the
load starts, while still provisional, and stays fixed for the load, so
the Network stream's pre-commit computation and the Page stream's
post-commit computation produce the identical string. It is
process-local, so it is qualified with the hosting process
("loader-<pid>.<navigationID>").
The id can only be computed in the frame's hosting WebContent process --
the UIProcess has neither the DocumentLoader nor its navigationID -- so
both proxy paths compute it there (FrameNetworkAgentProxy on the network
side, PageAgentProxy::frameNavigated on the page side) and send the
resulting string over IPC, rather than shipping a raw
ScriptExecutionContextIdentifier and converting it in the UIProcess. A
DocumentLoader never spans processes, so this is consistent.
The obvious alternatives don't work: frame->document()->identifier() is
the source of the bug above, and DocumentLoader::resultingClientId() --
the id the about-to-commit document will adopt -- is populated only for
service-worker-eligible loads, so it is unavailable for the common
navigation.
Because the loaderIds now agree, the frontend takes the provisional-load
commit path (WI.Frame.commitProvisionalLoad) for a cross-origin
navigation instead of synthesizing a fresh main resource via
WI.Frame.initialize. commitProvisionalLoad did not propagate the frame's
name, so make it adopt and dispatch the navigation's name like
initialize does; otherwise a window.name change reported on the
committing navigation would no longer reach the frame model.
Test:
http/tests/site-isolation/inspector/page/frame-navigated-loader-id-matches-network-cross-origin-iframe.html
*
LayoutTests/http/tests/site-isolation/inspector/page/frame-navigated-loader-id-matches-network-cross-origin-iframe-expected.txt:
Added.
*
LayoutTests/http/tests/site-isolation/inspector/page/frame-navigated-loader-id-matches-network-cross-origin-iframe.html:
Added.
* Source/WebCore/inspector/InspectorResourceUtilities.h:
* Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js:
(WI.NetworkManager.prototype.frameDidNavigate):
* Source/WebInspectorUI/UserInterface/Models/Frame.js:
(WI.Frame.prototype.commitProvisionalLoad):
* Source/WebKit/Shared/InspectorPageTypes.serialization.in:
* Source/WebKit/UIProcess/Inspector/Agents/ProxyingNetworkAgent.cpp:
(Inspector::ProxyingNetworkAgent::requestWillBeSent):
(Inspector::ProxyingNetworkAgent::responseReceived):
(Inspector::ProxyingNetworkAgent::requestServedFromMemoryCache):
* Source/WebKit/UIProcess/Inspector/Agents/ProxyingNetworkAgent.h:
* Source/WebKit/UIProcess/Inspector/Agents/ProxyingNetworkAgent.messages.in:
* Source/WebKit/UIProcess/Inspector/Agents/ProxyingPageAgent.cpp:
(Inspector::ProxyingPageAgent::frameNavigated):
(Inspector::ProxyingPageAgent::buildFrameTree const):
* Source/WebKit/UIProcess/Inspector/Agents/ProxyingPageAgent.h:
* Source/WebKit/UIProcess/Inspector/Agents/ProxyingPageAgent.messages.in:
* Source/WebKit/WebProcess/Inspector/FrameNetworkAgentProxy.cpp:
(WebKit::loaderIdForLoader):
(WebKit::FrameNetworkAgentProxy::willSendRequest):
(WebKit::FrameNetworkAgentProxy::willSendRequestOfType):
(WebKit::FrameNetworkAgentProxy::didReceiveResponse):
(WebKit::FrameNetworkAgentProxy::didLoadResourceFromMemoryCache):
(WebKit::contextIdentifier): Deleted.
* Source/WebKit/WebProcess/Inspector/PageAgentProxy.cpp:
(WebKit::PageAgentProxy::frameNavigated):
* Source/WebKit/WebProcess/Inspector/WebInspectorBackend.cpp:
(WebKit::WebInspectorBackend::getFrameResourceData):
* Source/WebCore/inspector/InspectorIdentifierRegistry.cpp:
(Inspector::BackendIdentifierRegistry::loaderId):
* Source/WebCore/inspector/InspectorIdentifierRegistry.h:
(Inspector::IdentifierRegistry::parseProtocolFrameId):
(Inspector::IdentifierRegistry::protocolLoaderId): Deleted.
Canonical link: https://commits.webkit.org/317864@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications