Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: df1a3bdc6d50329c1d9bb29b4a3d3480853ae547
https://github.com/WebKit/WebKit/commit/df1a3bdc6d50329c1d9bb29b4a3d3480853ae547
Author: Brandon Stewart <[email protected]>
Date: 2026-06-17 (Wed, 17 Jun 2026)
Changed paths:
A
LayoutTests/http/tests/site-isolation/inspector/page/resource-tree-resources-cross-origin-iframe-expected.txt
A
LayoutTests/http/tests/site-isolation/inspector/page/resource-tree-resources-cross-origin-iframe.html
A
LayoutTests/http/tests/site-isolation/inspector/page/resources/resource-tree-frame-with-subresource.html
A
LayoutTests/http/tests/site-isolation/inspector/page/resources/resource-tree-subframe-style.css
M Source/JavaScriptCore/inspector/protocol/Page.json
M Source/WebCore/inspector/InspectorResourceUtilities.cpp
M Source/WebCore/inspector/InspectorResourceUtilities.h
M Source/WebCore/inspector/agents/InspectorPageAgent.cpp
M Source/WebCore/inspector/agents/InspectorPageAgent.h
M Source/WebKit/CMakeLists.txt
M Source/WebKit/DerivedSources-input.xcfilelist
M Source/WebKit/DerivedSources.make
M Source/WebKit/Scripts/webkit/messages.py
A Source/WebKit/Shared/InspectorPageTypes.serialization.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/WebKit.xcodeproj/project.pbxproj
M Source/WebKit/WebProcess/Inspector/PageAgentProxy.cpp
M Source/WebKit/WebProcess/Inspector/WebInspectorBackend.cpp
M Source/WebKit/WebProcess/Inspector/WebInspectorBackend.h
M Source/WebKit/WebProcess/Inspector/WebInspectorBackend.messages.in
Log Message:
-----------
[Site Isolation] Aggregate cross-process resources and loaderId in
Page.getResourceTree
https://bugs.webkit.org/show_bug.cgi?id=316667
rdar://179117459
Reviewed by BJ Burg.
Under Site Isolation, Page.getResourceTree returned the cross-origin frame tree
with
correct structure and url/origin (prior changes) but every frame had an empty
loaderId
and no subresources -- it was a frame tree, not a resource tree. The
subresources live in
each frame's hosting WebContent process (CachedResourceLoader), which the
UIProcess
ProxyingPageAgent cannot read directly.
Gather each frame's resources from its hosting process as typed IPC data and
build the
aggregated tree in the proxy:
- Make Page.getResourceTree asynchronous (the proxy must round-trip to the
WebContent
processes before it can answer). Both implementations adopt the callback
form: the
in-process InspectorPageAgent answers synchronously; the proxy answers once
every
process has replied.
- Carry each frame's resources as typed IPC rather than a JSON string. Add
Inspector::FrameResource / Inspector::FrameResourceData (in a new
Shared/InspectorPageTypes.serialization.in), plain serializable mirrors of
Page.FrameResource, so secure decoding is generated rather than hand-rolled.
The
WebContent handler (WebInspectorBackend::GetFrameResourceData) returns this
typed data
and the Page.FrameResource protocol objects are constructed in the UIProcess.
The
CachedResource -> data extraction is shared by both paths via
ResourceUtilities::buildResourceDataForFrame, and buildResourceObject builds
one protocol
object from the data; buildResourceObjectsForFrame (used by the in-process
agent) is
rebuilt on top of these so every path produces identical output.
- Carry loaderId as a WebCore::ScriptExecutionContextIdentifier rather than a
pre-formatted string. PageAgentProxy sends the committed document's
identifier in the
live Page.frameNavigated event; the ProxyingPageAgent caches it and derives
the
deterministic, hosting-process-qualified protocol loaderId
(IdentifierRegistry::protocolLoaderId) only at the protocol boundary.
buildFrameTree
prefers the cached identifier and falls back to the one gathered from the
hosting process
for frames that committed before the inspector connected (e.g. the main
frame). Full
correlation with live network-event loaderIds remains webkit.org/b/308895.
- ProxyingPageAgent::getResourceTree walks the authoritative WebFrameProxy tree
to group
frame ids by their hosting WebContent process, then asks each process
(GetFrameResourceData) only for the frames it hosts. Walking the frame tree
-- rather
than WebPageProxy::forEachWebContentProcess() -- guarantees coverage matches
exactly the
processes hosting frames, and scoping each request to a process's own frames
avoids
fetching every frame's resources from every process. A CallbackAggregator
builds the
stitched tree once every reply has landed.
* Source/JavaScriptCore/inspector/protocol/Page.json:
Mark getResourceTree async.
* Source/WebCore/inspector/InspectorResourceUtilities.h:
* Source/WebCore/inspector/InspectorResourceUtilities.cpp:
(Inspector::ResourceUtilities::buildResourceDataForFrame):
(Inspector::ResourceUtilities::buildResourceObject):
(Inspector::ResourceUtilities::buildResourceObjectsForFrame):
Add Inspector::FrameResource / FrameResourceData, the shared CachedResource ->
data
extraction (buildResourceDataForFrame), and the protocol builder
(buildResourceObject).
Rebuild buildResourceObjectsForFrame on top of them so the in-process and
cross-process
paths produce identical output.
* Source/WebCore/inspector/agents/InspectorPageAgent.h:
* Source/WebCore/inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::getResourceTree):
(WebCore::InspectorPageAgent::buildObjectForFrameTree):
Adopt the async callback signature (answer synchronously); use
buildResourceObjectsForFrame.
* Source/WebKit/Shared/InspectorPageTypes.serialization.in: Added.
* Source/WebKit/CMakeLists.txt:
* Source/WebKit/DerivedSources.make:
* Source/WebKit/DerivedSources-input.xcfilelist:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
Generate secure coders for Inspector::FrameResource / FrameResourceData.
* Source/WebKit/Scripts/webkit/messages.py:
Map the new types to their header for message generation.
* Source/WebKit/WebProcess/Inspector/WebInspectorBackend.h:
* Source/WebKit/WebProcess/Inspector/WebInspectorBackend.cpp:
(WebKit::WebInspectorBackend::getFrameResourceData):
* Source/WebKit/WebProcess/Inspector/WebInspectorBackend.messages.in:
Return each requested local frame's { loaderId, resources } as typed data for
the proxy
to aggregate.
* Source/WebKit/WebProcess/Inspector/PageAgentProxy.cpp:
(WebKit::PageAgentProxy::frameNavigated):
Send the committed document's ScriptExecutionContextIdentifier as the loaderId.
* Source/WebKit/UIProcess/Inspector/Agents/ProxyingPageAgent.h:
* Source/WebKit/UIProcess/Inspector/Agents/ProxyingPageAgent.cpp:
(Inspector::ProxyingPageAgent::frameNavigated):
(Inspector::ProxyingPageAgent::buildFrameTree):
(Inspector::ProxyingPageAgent::getResourceTree):
Cache loaderId as a ScriptExecutionContextIdentifier; walk the frame tree to
gather typed
resources per hosting process and build the aggregated tree asynchronously.
* Source/WebKit/UIProcess/Inspector/Agents/ProxyingPageAgent.messages.in:
Carry loaderId as a ScriptExecutionContextIdentifier in FrameNavigated.
*
LayoutTests/http/tests/site-isolation/inspector/page/resource-tree-resources-cross-origin-iframe.html:
Added.
*
LayoutTests/http/tests/site-isolation/inspector/page/resource-tree-resources-cross-origin-iframe-expected.txt:
Added.
*
LayoutTests/http/tests/site-isolation/inspector/page/resources/resource-tree-frame-with-subresource.html:
Added.
*
LayoutTests/http/tests/site-isolation/inspector/page/resources/resource-tree-subframe-style.css:
Added.
Assert getResourceTree reports loaderId for the main and cross-origin child
frames and
aggregates the child's cached stylesheet subresource cross-process.
Canonical link: https://commits.webkit.org/315428@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications