Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 41d4de49d3c684c9f01bdb67262c08d46852f8f5
      
https://github.com/WebKit/WebKit/commit/41d4de49d3c684c9f01bdb67262c08d46852f8f5
  Author: Cameron McCormack <[email protected]>
  Date:   2026-10-08 (Thu, 08 Oct 2026)

  Changed paths:
    M LayoutTests/TestExpectations
    A 
LayoutTests/http/tests/site-isolation/inspector/canvas/canvas-in-iframe-expected.txt
    A 
LayoutTests/http/tests/site-isolation/inspector/canvas/canvas-in-iframe.html
    A 
LayoutTests/http/tests/site-isolation/inspector/canvas/console-record-canvas-moved-from-iframe-expected.txt
    A 
LayoutTests/http/tests/site-isolation/inspector/canvas/console-record-canvas-moved-from-iframe.html
    A 
LayoutTests/http/tests/site-isolation/inspector/canvas/resources/iframe-with-canvas.html
    M LayoutTests/inspector/canvas/recording-2d-saves.html
    M LayoutTests/inspector/canvas/recording-offscreen-canvas-2d-saves.html
    M LayoutTests/inspector/canvas/recording.html
    M LayoutTests/inspector/canvas/requestClientNodes.html
    M LayoutTests/inspector/canvas/requestContent-2d.html
    M LayoutTests/inspector/canvas/requestContent-bitmaprenderer.html
    M LayoutTests/inspector/canvas/requestContent-webgl.html
    M LayoutTests/inspector/canvas/requestContent-webgl2.html
    M LayoutTests/inspector/canvas/requestNode.html
    M LayoutTests/inspector/canvas/requestShaderSource-webgl.html
    M LayoutTests/inspector/canvas/requestShaderSource.html
    M LayoutTests/inspector/canvas/resolveContext-2d.html
    M LayoutTests/inspector/canvas/resolveContext-bitmaprenderer.html
    M LayoutTests/inspector/canvas/resolveContext-webgl.html
    M LayoutTests/inspector/canvas/resolveContext-webgl2.html
    M LayoutTests/inspector/canvas/resources/recording-utilities.js
    M LayoutTests/inspector/canvas/setRecordingAutoCaptureFrameCount.html
    M LayoutTests/inspector/canvas/setShaderProgramDisabled.html
    M LayoutTests/inspector/canvas/setShaderProgramHighlighted.html
    M LayoutTests/inspector/canvas/updateShader-webgl.html
    M LayoutTests/inspector/canvas/updateShader.html
    M Source/JavaScriptCore/inspector/protocol/Canvas.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
    M Source/WebCore/inspector/InstrumentingAgents.cpp
    M Source/WebCore/inspector/InstrumentingAgents.h
    M Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp
    M Source/WebCore/inspector/agents/InspectorCanvasAgent.h
    A Source/WebCore/inspector/agents/frame/FrameCanvasAgent.cpp
    A Source/WebCore/inspector/agents/frame/FrameCanvasAgent.h
    M Source/WebCore/inspector/agents/page/PageCanvasAgent.cpp
    M Source/WebCore/inspector/agents/page/PageCanvasAgent.h
    M Source/WebInspectorUI/UserInterface/Controllers/DOMManager.js

  Log Message:
  -----------
  [Site Isolation] Web Inspector: Add Canvas support for frame targets
https://bugs.webkit.org/show_bug.cgi?id=325761
rdar://188777092

Reviewed by Qianlang Chen.

Under site isolation, the frontend has two targets for the top-level
document: the page target and the main frame's frame target. Because
PageDebugger does not attach to frames under site isolation, the
document's scripts are reported by the frame target's Debugger domain,
but its canvases were reported by the page target's Canvas domain. The
frontend resolves a canvas's stack trace against the scripts of the
target that reported the canvas, so call frames without a URL, such as
code run through Runtime.evaluate, were shown as native code. The same
applied to same-site iframes, whose scripts are reported by their own
frame targets. Canvases in cross-origin iframes, whose process has no
page-level Canvas agent, were not reported at all.

Add FrameCanvasAgent, which reports the canvases created by its own
frame's documents. When enabled it takes the frame's shared Canvas slot
in InstrumentingAgents, so canvas instrumentation for that frame reaches
it instead of falling back to the page's agent. Under site isolation
PageCanvasAgent stays out of InstrumentingAgents and binds no canvases,
matching PageDebugger.

FrameCanvasAgent pushes nodes through FrameDOMAgent, which reports a CSS
canvas element as a detached root, so DOMManager now keeps detached
roots pushed by frame targets.

Tests that sent Canvas commands through the global CanvasAgent, which is
the page target's, now use the target of the canvas or shader program
they operate on, or InspectorTest.mainFrameTarget when there is none.

Tests: http/tests/site-isolation/inspector/canvas/canvas-in-iframe.html
       
http/tests/site-isolation/inspector/canvas/console-record-canvas-moved-from-iframe.html

* 
LayoutTests/http/tests/site-isolation/inspector/canvas/canvas-in-iframe-expected.txt:
 Added.
* LayoutTests/http/tests/site-isolation/inspector/canvas/canvas-in-iframe.html: 
Added.
* 
LayoutTests/http/tests/site-isolation/inspector/canvas/resources/iframe-with-canvas.html:
 Added.
* LayoutTests/inspector/canvas/recording-2d-saves.html:
* LayoutTests/inspector/canvas/recording-offscreen-canvas-2d-saves.html:
* LayoutTests/inspector/canvas/recording.html:
* LayoutTests/inspector/canvas/requestClientNodes.html:
* LayoutTests/inspector/canvas/requestContent-2d.html:
* LayoutTests/inspector/canvas/requestContent-bitmaprenderer.html:
* LayoutTests/inspector/canvas/requestContent-webgl.html:
* LayoutTests/inspector/canvas/requestContent-webgl2.html:
* LayoutTests/inspector/canvas/requestNode.html:
* LayoutTests/inspector/canvas/requestShaderSource-webgl.html:
* LayoutTests/inspector/canvas/requestShaderSource.html:
* LayoutTests/inspector/canvas/resolveContext-2d.html:
* LayoutTests/inspector/canvas/resolveContext-bitmaprenderer.html:
* LayoutTests/inspector/canvas/resolveContext-webgl.html:
* LayoutTests/inspector/canvas/resolveContext-webgl2.html:
* LayoutTests/inspector/canvas/resources/recording-utilities.js:
* LayoutTests/inspector/canvas/setRecordingAutoCaptureFrameCount.html:
* LayoutTests/inspector/canvas/setShaderProgramDisabled.html:
* LayoutTests/inspector/canvas/setShaderProgramHighlighted.html:
* LayoutTests/inspector/canvas/updateShader-webgl.html:
* LayoutTests/inspector/canvas/updateShader.html:
* Source/JavaScriptCore/inspector/protocol/Canvas.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::didCommitLoadImpl):
(WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodesImpl):
* Source/WebCore/inspector/InstrumentingAgents.cpp:
* Source/WebCore/inspector/InstrumentingAgents.h:
* Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp:
(WebCore::InspectorCanvasAgent::didChangeCSSCanvasClientNodes): Moved from 
PageCanvasAgent.
(WebCore::InspectorCanvasAgent::dispatchNodesChanged): Moved from 
PageCanvasAgent.
(WebCore::InspectorCanvasAgent::dispatchCSSCanvasClientNodesChanged): Moved 
from PageCanvasAgent.
(WebCore::InspectorCanvasAgent::dispatchCSSCanvasNamesChanged): Moved from 
PageCanvasAgent.
(WebCore::InspectorCanvasAgent::recordAction):
* Source/WebCore/inspector/agents/InspectorCanvasAgent.h:
* Source/WebCore/inspector/agents/frame/FrameCanvasAgent.cpp: Added.
(WebCore::FrameCanvasAgent::FrameCanvasAgent):
(WebCore::FrameCanvasAgent::enabled const):
(WebCore::FrameCanvasAgent::internalEnable):
(WebCore::FrameCanvasAgent::internalDisable):
(WebCore::FrameCanvasAgent::requestNodes):
(WebCore::FrameCanvasAgent::requestCSSCanvasClientNodes):
(WebCore::FrameCanvasAgent::frameNavigated):
(WebCore::FrameCanvasAgent::didChangeGPUDeviceClientNodes):
(WebCore::FrameCanvasAgent::matchesCurrentContext const):
* Source/WebCore/inspector/agents/frame/FrameCanvasAgent.h: Added.
* Source/WebCore/inspector/agents/page/PageCanvasAgent.cpp:
(WebCore::PageCanvasAgent::isSiteIsolationEnabled const):
(WebCore::PageCanvasAgent::enabled const):
(WebCore::PageCanvasAgent::internalEnable):
(WebCore::PageCanvasAgent::internalDisable):
(WebCore::PageCanvasAgent::didChangeCSSCanvasClientNodes): Deleted.
(WebCore::PageCanvasAgent::dispatchNodesChanged): Deleted.
(WebCore::PageCanvasAgent::dispatchCSSCanvasClientNodesChanged): Deleted.
(WebCore::PageCanvasAgent::dispatchCSSCanvasNamesChanged): Deleted.
* Source/WebCore/inspector/agents/page/PageCanvasAgent.h:
* Source/WebInspectorUI/UserInterface/Controllers/DOMManager.js:
(WI.DOMManager.prototype._frameTargetSetChildNodes):
* LayoutTests/TestExpectations:
* 
LayoutTests/http/tests/site-isolation/inspector/canvas/console-record-canvas-moved-from-iframe-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/canvas/console-record-canvas-moved-from-iframe.html:
 Added.

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



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

Reply via email to