Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 50fdc88f3dde36d88bcdd1776e70014ad9bdc3b0
https://github.com/WebKit/WebKit/commit/50fdc88f3dde36d88bcdd1776e70014ad9bdc3b0
Author: BJ Burg <[email protected]>
Date: 2026-04-16 (Thu, 16 Apr 2026)
Changed paths:
M Source/WebCore/Headers.cmake
M Source/WebCore/SaferCPPExpectations/UncountedLocalVarsCheckerExpectations
M Source/WebCore/Sources.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
A Source/WebCore/inspector/InspectorIdentifierRegistry.cpp
A Source/WebCore/inspector/InspectorIdentifierRegistry.h
M Source/WebCore/inspector/InspectorResourceUtilities.cpp
M Source/WebCore/inspector/InspectorResourceUtilities.h
M Source/WebCore/inspector/InspectorStyleSheet.cpp
M Source/WebCore/inspector/InspectorStyleSheet.h
M Source/WebCore/inspector/PageInspectorController.cpp
M Source/WebCore/inspector/PageInspectorController.h
M Source/WebCore/inspector/agents/InspectorCSSAgent.cpp
M Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
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/PageRuntimeAgent.cpp
Log Message:
-----------
[Site Isolation] Web Inspector: extract frame/loader ID tracking from
InspectorPageAgent into IdentifierRegistry
https://bugs.webkit.org/show_bug.cgi?id=310162
Reviewed by Qianlang Chen.
Introduce an abstract IdentifierRegistry interface and LegacyIdentifierRegistry
implementation to own the frame-to-identifier and loader-to-identifier maps that
were previously private to InspectorPageAgent. PageInspectorController creates
and owns the registry (Ref<>); agents that need frame lookups hold a WeakRef<>.
This is a pure refactoring with no behavioral change for non-SI configurations.
LegacyIdentifierRegistry preserves the existing IdentifiersFactory sequential
counter behavior ("0.1", "0.2", ...) identically. Under Site Isolation, a
BackendIdentifierRegistry subclass (added in a follow-up) produces deterministic
type-prefixed IDs derived from FrameIdentifier so UIProcess and WebContent
processes can independently compute matching IDs.
The frontend treats all protocol frameId and loaderId values as opaque strings.
They flow through NetworkManager._frameIdentifierMap (keyed by frameId),
Frame.loaderIdentifier, and are passed to backend commands like
Page.getResourceTree and Network.getResponseBody. No frontend changes are
needed because the string format is never parsed by the frontend -- only
compared for equality and used as map keys.
Agents that previously required InspectorPageAgent (and thus the Page domain to
be enabled) now access frame/loader IDs through the always-available registry
on PageInspectorController. This means
PageRuntimeAgent::didClearWindowObjectInWorld
can now resolve frameIds even when the Page domain is disabled. This is safe
because the Runtime agent only dispatches executionContextCreated if its own
domain is enabled and a frontend dispatcher is connected. The frameId lookup
is a prerequisite for the notification, not a trigger.
No new tests: this is a mechanical extraction. All existing inspector/ layout
tests validate that the refactored ID paths produce identical behavior.
* Source/WebCore/inspector/InspectorIdentifierRegistry.h: Added.
(Inspector::IdentifierRegistry): Abstract base with frameId/loaderId/
frameForId/assertFrame/takeFrame/takeLoader virtual interface.
(Inspector::LegacyIdentifierRegistry): Concrete impl using
IdentifiersFactory sequential counters and bidirectional hash maps.
* Source/WebCore/inspector/InspectorIdentifierRegistry.cpp: Added.
* Source/WebCore/inspector/PageInspectorController.h:
(WebCore::PageInspectorController::identifierRegistry): Added.
* Source/WebCore/inspector/PageInspectorController.cpp:
Create LegacyIdentifierRegistry in constructor.
* Source/WebCore/inspector/agents/InspectorPageAgent.h:
* Source/WebCore/inspector/agents/InspectorPageAgent.cpp:
Delegate frameId/loaderId/frameForId/assertFrame/takeFrame/takeLoader
to identifierRegistry(). Remove private hash maps.
* Source/WebCore/inspector/InspectorStyleSheet.h:
Change from CheckedPtr<InspectorPageAgent> to WeakRef<IdentifierRegistry>
for frame lookups (decouples from Page agent lifecycle).
* Source/WebCore/inspector/InspectorShaderProgram.h:
Add missing #include <wtf/WeakRef.h>.
* Source/WebCore/Sources.txt:
Canonical link: https://commits.webkit.org/311409@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications