Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1c2a6d971d3224a13e8d2ae80cc0c1b269816ce5
      
https://github.com/WebKit/WebKit/commit/1c2a6d971d3224a13e8d2ae80cc0c1b269816ce5
  Author: Brandon Stewart <[email protected]>
  Date:   2026-06-09 (Tue, 09 Jun 2026)

  Changed paths:
    A 
LayoutTests/http/tests/site-isolation/inspector/page/resource-tree-cross-origin-iframe-expected.txt
    A 
LayoutTests/http/tests/site-isolation/inspector/page/resource-tree-cross-origin-iframe.html
    A 
LayoutTests/http/tests/site-isolation/inspector/page/resources/resource-tree-frame.html
    M Source/JavaScriptCore/inspector/protocol/Page.json
    M Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js
    M Source/WebInspectorUI/UserInterface/Protocol/MultiplexingBackendTarget.js
    M Source/WebKit/UIProcess/Inspector/Agents/ProxyingPageAgent.cpp
    M Source/WebKit/UIProcess/Inspector/Agents/ProxyingPageAgent.h
    M Source/WebKit/UIProcess/WebFrameProxy.cpp
    M Source/WebKit/UIProcess/WebFrameProxy.h

  Log Message:
  -----------
  [Site Isolation] Implement Page.getResourceTree on the UIProcess 
ProxyingPageAgent
https://bugs.webkit.org/show_bug.cgi?id=308896
rdar://170094580

Reviewed by BJ Burg.

Implement Page.getResourceTree on the UIProcess ProxyingPageAgent by
walking WebFrameProxy::childFrames(), which under Site Isolation is the
authoritative cross-process frame tree: it spans every WebContent
process, so a single recursive walk yields the full structure regardless
of which process hosts each frame. The frontend (web-page) target now
exposes the Page domain so the aggregated tree can be requested on demand
via WI.backendTarget.PageAgent.getResourceTree().

Main-frame and tree-structure data (ids, parent linkage, frame name)
return correctly across cross-origin process boundaries. Cross-origin
URL/origin reporting and wiring the aggregated tree into the live
inspector resource sidebar are left as follow-ups (below).

* Source/JavaScriptCore/inspector/protocol/Page.json:
Add "web-page" to targetTypes so the multiplexing backendTarget gets a
PageAgent on the frontend, making getResourceTree reachable on the
UIProcess proxy.

* Source/WebKit/UIProcess/WebFrameProxy.h:
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::documentSecurityOriginData):
Add public accessors for frameName(), childFrames(), and a safe
documentSecurityOriginData() that null-guards m_documentSecurityOrigin
(securityOrigin() ASSERTs on uncommitted frames).

* Source/WebKit/UIProcess/Inspector/Agents/ProxyingPageAgent.h:
* Source/WebKit/UIProcess/Inspector/Agents/ProxyingPageAgent.cpp:
(Inspector::ProxyingPageAgent::buildFrameTree):
(Inspector::ProxyingPageAgent::getResourceTree):
Implement getResourceTree by recursively walking the inspected page's
WebFrameProxy tree from the main frame. Each Frame is populated directly
from WebFrameProxy state (url, mimeType, documentSecurityOriginData,
frameName); the UIProcess tree already aggregates frames across
processes, so no per-process event cache is needed.

* Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js:
(WI.NetworkManager.prototype.initializeTarget):
The page's main-frame resource tree continues to be bootstrapped from
the per-page target. Skip the bootstrap for the multiplexing
backendTarget (TargetType.WebPage), which now also exposes a Page
domain: it is initialized before any load has committed, so letting it
call getResourceTree would clobber the per-page target's tree with an
empty snapshot, and outside Site Isolation it would shadow the per-page
target entirely. The aggregated cross-origin tree is fetched on demand
via WI.backendTarget.PageAgent.getResourceTree().

* Source/WebInspectorUI/UserInterface/Protocol/MultiplexingBackendTarget.js:
Update the agent-set assertion to include the now-present Page domain.

* 
LayoutTests/http/tests/site-isolation/inspector/page/resource-tree-cross-origin-iframe.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/page/resource-tree-cross-origin-iframe-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/page/resources/resource-tree-frame.html:
 Added.
Layout test exercising getResourceTree via WI.backendTarget.PageAgent on
a page with a cross-origin iframe. Asserts main-frame and structural
properties (frame ids, parent linkage, name); the cross-origin URL/origin
assertions are commented out with a FIXME pointing at the follow-ups below.

Follow-ups, each tracked in its own bug and landing on top of this change
in the order listed (each depends on the previous):

* bug 316663 -- [Site Isolation] Make Web Inspector frame protocol IDs
  collision-free and hosting-process-qualified: encode the full
  FrameIdentifier (its low 32 bits collide for main(A) -> child(B) ->
  grandchild(A)) and qualify each id by the frame's hosting process.

* bug 316664 -- [Site Isolation] Emit live Page.frameNavigated/frameDetached
  from cross-origin processes: forward frame lifecycle events from each
  WebContent process to the UIProcess ProxyingPageAgent.

* bug 316665 -- [Site Isolation] Report cross-origin frame url/securityOrigin
  in Page.getResourceTree: cache the committed document info from
  frameNavigated, since the inspectedPage's WebFrameProxy never sees the
  cross-origin child's commit.

* bug 316666 -- [Site Isolation] Show cross-origin frames in the inspector
  frame model: consume those events into WI.networkManager.frames and the
  resource sidebar.

* bug 316667 -- [Site Isolation] Aggregate cross-process resources and
  loaderId in Page.getResourceTree: gather each frame's resources from its
  hosting process (the command becomes asynchronous).

* bug 316668 -- [Site Isolation] Report genuine cross-origin frame removal in
  Page.frameDetached: report removal from the authoritative WebFrameProxy
  destruction path.

* bug 316669 -- [Site Isolation] Expand Page.getResourceTree cross-origin
  test coverage: nested grandchild, siblings, dynamic add/remove, and
  cross-domain frame-id consistency.

Canonical link: https://commits.webkit.org/314825@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to