Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 1a86de0bf48e776d1b8ad1bbc4a27cf1f6eab79b
https://github.com/WebKit/WebKit/commit/1a86de0bf48e776d1b8ad1bbc4a27cf1f6eab79b
Author: Anuj Panta <[email protected]>
Date: 2026-03-03 (Tue, 03 Mar 2026)
Changed paths:
M Source/JavaScriptCore/inspector/protocol/Runtime.json
M Source/WebCore/Sources.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/inspector/FrameInspectorController.cpp
M Source/WebCore/inspector/FrameInspectorController.h
M Source/WebCore/inspector/InspectorInstrumentation.cpp
M Source/WebCore/inspector/InstrumentingAgents.h
A Source/WebCore/inspector/agents/frame/FrameRuntimeAgent.cpp
A Source/WebCore/inspector/agents/frame/FrameRuntimeAgent.h
M Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
M Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js
M Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js
M Source/WebInspectorUI/UserInterface/Models/ExecutionContext.js
M Source/WebInspectorUI/UserInterface/Protocol/FrameTarget.js
M Source/WebInspectorUI/UserInterface/Protocol/RuntimeObserver.js
M Source/WebInspectorUI/UserInterface/Views/QuickConsole.js
Log Message:
-----------
[Site Isolation] Web Inspector: support cross-origin iframes in Runtime domain
https://bugs.webkit.org/show_bug.cgi?id=307370
rdar://143598571
Reviewed by BJ Burg.
Introducing FrameRuntimeAgent to enable JavaScript evaluation in cross-origin
iframes under site
isolation. When cross-origin iframes run in separate WebProcesses, they need
their own Runtime
agents to handle protocol commands independently since PageRuntimeAgent can
only operate within
a single process.
Each FrameInspectorController creates its own InjectedScriptManager instance
rather than sharing
with the parent PageInspectorController. Even when frames happen to share a
process, isolating
the InjectedScriptManager per frame ensures independent runtime state —
objectId namespaces,
saved result indices, and execution context IDs — so the frontend can treat
each frame target
as a fully independent target. This also prevents entanglement when tearing
down one frame's
inspector state while another remains live.
InspectorInstrumentation routing was updated to direct
didClearWindowObjectInWorld notifications
to the appropriate agent based on frame type. Subframes with
FrameInspectorControllers route to
their FrameRuntimeAgent for context updates and return early, completely
skipping PageRuntimeAgent.
Main frames continue using PageRuntimeAgent for backwards compatibility. The
routing preserves
InspectorPageAgent calls for bootstrap script injection in both code paths.
On the frontend, FrameTarget stores its main execution context directly via the
inherited
_executionContext field on WI.Target rather than going through
ExecutionContextList.pageExecutionContext.
Navigation-reset logic lives in FrameTarget.addExecutionContext, keeping
ExecutionContextList
free of frame-target-specific concerns. RuntimeObserver dispatches context
creation events to
FrameTarget.addExecutionContext for frame-type targets instead of routing
through NetworkManager.
FrameRuntimeAgent stores the FrameIdentifier directly and converts to a
protocol string on demand
in frameIdForProtocol rather than caching the string at construction time.
* Source/JavaScriptCore/inspector/protocol/Runtime.json:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/inspector/FrameInspectorController.cpp:
(WebCore::FrameInspectorController::FrameInspectorController):
(WebCore::FrameInspectorController::createRuntimeAgent):
(WebCore::FrameInspectorController::createLazyAgents):
(WebCore::FrameInspectorController::debugger):
* Source/WebCore/inspector/FrameInspectorController.h:
* Source/WebCore/inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didClearWindowObjectInWorldImpl):
* Source/WebCore/inspector/InstrumentingAgents.h:
* Source/WebCore/inspector/agents/frame/FrameRuntimeAgent.cpp: Added.
(WebCore::FrameRuntimeAgent::FrameRuntimeAgent):
(WebCore::m_frameIdentifier):
(WebCore::FrameRuntimeAgent::enable):
(WebCore::FrameRuntimeAgent::disable):
(WebCore::FrameRuntimeAgent::callFunctionOn):
(WebCore::FrameRuntimeAgent::injectedScriptForEval):
(WebCore::FrameRuntimeAgent::muteConsole):
(WebCore::FrameRuntimeAgent::unmuteConsole):
(WebCore::FrameRuntimeAgent::frameIdForProtocol const):
(WebCore::toProtocol):
(WebCore::FrameRuntimeAgent::reportExecutionContextCreation):
(WebCore::FrameRuntimeAgent::notifyContextCreated):
(WebCore::FrameRuntimeAgent::didClearWindowObjectInWorld):
* Source/WebCore/inspector/agents/frame/FrameRuntimeAgent.h: Added.
* Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js:
* Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js:
(WI.NetworkManager.prototype.executionContextCreated):
* Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js:
(WI.RuntimeManager.prototype.initializeTarget):
* Source/WebInspectorUI/UserInterface/Models/ExecutionContext.js:
(WI.ExecutionContext):
* Source/WebInspectorUI/UserInterface/Protocol/FrameTarget.js:
(WI.FrameTarget.prototype.get executionContextList):
(WI.FrameTarget.prototype.get executionContext):
(WI.FrameTarget.prototype.addExecutionContext):
(WI.FrameTarget.prototype.clearExecutionContexts):
(WI.FrameTarget):
* Source/WebInspectorUI/UserInterface/Protocol/RuntimeObserver.js:
(WI.RuntimeObserver.prototype.executionContextCreated):
(WI.RuntimeObserver):
* Source/WebInspectorUI/UserInterface/Views/QuickConsole.js:
(WI.QuickConsole):
(WI.QuickConsole.prototype.closed):
(WI.QuickConsole.prototype._updateActiveExecutionContextDisplay):
(WI.QuickConsole.prototype._populateActiveExecutionContextNavigationItemContextMenu):
(WI.QuickConsole.prototype._handleFrameTargetExecutionContextAdded):
(WI.QuickConsole.prototype._frameTargetsWithExecutionContext):
Canonical link: https://commits.webkit.org/308589@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications