Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 047f3dc902f24c8e1cb0cc9e67afbe22d7e314f6
https://github.com/WebKit/WebKit/commit/047f3dc902f24c8e1cb0cc9e67afbe22d7e314f6
Author: Anuj Panta <[email protected]>
Date: 2026-04-15 (Wed, 15 Apr 2026)
Changed paths:
A
LayoutTests/http/tests/site-isolation/inspector/worker/worker-in-cross-origin-iframe-expected.txt
A
LayoutTests/http/tests/site-isolation/inspector/worker/worker-in-cross-origin-iframe.html
A LayoutTests/inspector/worker/resources/cross-origin-worker.js
A LayoutTests/inspector/worker/resources/iframe-with-worker.html
M LayoutTests/platform/mac-site-isolation/TestExpectations
M Source/JavaScriptCore/inspector/protocol/Worker.json
M Source/WebCore/Sources.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/inspector/FrameInspectorController.cpp
M Source/WebCore/inspector/InspectorInstrumentation.cpp
A Source/WebCore/inspector/agents/frame/FrameWorkerAgent.cpp
A Source/WebCore/inspector/agents/frame/FrameWorkerAgent.h
M Source/WebCore/inspector/agents/page/PageWorkerAgent.cpp
M Source/WebInspectorUI/UserInterface/Controllers/TargetManager.js
Log Message:
-----------
([Site Isolation] Web Inspector: support cross-origin iframes in the Worker
domain)
https://bugs.webkit.org/show_bug.cgi?id=308488
rdar://143596746
Reviewed by Qianlang Chen.
Introducing FrameWorkerAgent to enable worker discovery and inspection in
cross-origin iframes under site isolation. When the iframe spawns a worker,
InspectorInstrumentation resolves the page-level InstrumentingAgents which
has no connected PageWorkerAgent in that process.
FrameWorkerAgent registers in the shared persistentWorkerAgent slot on the
frame's InstrumentingAgents at frontend connect time, matching the existing
PageWorkerAgent lifecycle. This works because page and frame WorkerAgents
never coexist on the same InstrumentingAgents instance, and FrameWorkerAgent
inherits from InspectorWorkerAgent. The PageChannel threading model is
inherited from InspectorWorkerAgent — no changes needed.
Under site isolation, PageWorkerAgent early-returns in
connectToAllWorkerInspectorProxies since every frame (including main) has
its own FrameWorkerAgent. FrameWorkerAgent filters
WorkerInspectorProxy::proxiesForPage to only connect workers whose
scriptExecutionContext Document belongs to the inspected frame. This
prevents double-connection when multiple same-site frames share a WebProcess.
instrumentingAgents(ScriptExecutionContext&) now prefers the frame's
InstrumentingAgents when a document has an associated frame. Since the
frame's agents fall back to the page's agents for unset slots, the existing
workerStarted, workerTerminated, and shouldWaitForDebuggerOnStart Impl
functions work without any routing changes
Adding "frame" to Worker.json targetTypes is sufficient for the frontend —
WorkerManager.initializeTarget already gates on hasDomain("Worker"), which
now returns true for FrameTargets.
TargetManager.targetDestroyed cleans up child WorkerTargets when a
FrameTarget is destroyed, since Worker.workerTerminated messages from the
backend get dropped due to a race in willDestroyFrame.
Tests:
http/tests/site-isolation/inspector/worker/worker-in-cross-origin-iframe.html
http/tests/site-isolation/inspector/worker/worker-resources/iframe-with-worker.html
*
LayoutTests/http/tests/site-isolation/inspector/worker/worker-in-cross-origin-iframe-expected.txt:
Added.
*
LayoutTests/http/tests/site-isolation/inspector/worker/worker-in-cross-origin-iframe.html:
Added.
* LayoutTests/inspector/worker/resources/cross-origin-worker.js: Added.
* LayoutTests/inspector/worker/resources/iframe-with-worker.html: Added.
* LayoutTests/platform/mac-site-isolation/TestExpectations:
* Source/JavaScriptCore/inspector/protocol/Worker.json:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/inspector/FrameInspectorController.cpp:
(WebCore::FrameInspectorController::createLazyAgents):
* Source/WebCore/inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::instrumentingAgents):
* Source/WebCore/inspector/agents/frame/FrameWorkerAgent.cpp: Copied from
Source/WebCore/inspector/agents/page/PageWorkerAgent.cpp.
(WebCore::FrameWorkerAgent::FrameWorkerAgent):
(WebCore::FrameWorkerAgent::didCreateFrontendAndBackend):
(WebCore::FrameWorkerAgent::willDestroyFrontendAndBackend):
(WebCore::FrameWorkerAgent::connectToAllWorkerInspectorProxies):
* Source/WebCore/inspector/agents/frame/FrameWorkerAgent.h: Copied from
Source/WebCore/inspector/agents/page/PageWorkerAgent.cpp.
* Source/WebCore/inspector/agents/page/PageWorkerAgent.cpp:
(WebCore::PageWorkerAgent::connectToAllWorkerInspectorProxies):
* Source/WebInspectorUI/UserInterface/Controllers/TargetManager.js:
(WI.TargetManager.prototype.targetDestroyed):
Canonical link: https://commits.webkit.org/311312@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications