Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 0451b66aa498db7ed3be21309c90bc8bbb6391d2
https://github.com/WebKit/WebKit/commit/0451b66aa498db7ed3be21309c90bc8bbb6391d2
Author: Qianlang Chen <[email protected]>
Date: 2026-09-01 (Tue, 01 Sep 2026)
Changed paths:
M LayoutTests/inspector/debugger/breakpoints/resources/dump.js
M LayoutTests/inspector/debugger/evaluateOnCallFrame-CommandLineAPI.html
M
LayoutTests/inspector/debugger/evaluateOnCallFrame-emulateUserGesture-hasTransientActivation.html
M
LayoutTests/inspector/debugger/evaluateOnCallFrame-emulateUserGesture-userIsInteracting.html
M LayoutTests/inspector/debugger/evaluateOnCallFrame-emulateUserGesture.html
M LayoutTests/inspector/debugger/evaluateOnCallFrame-exception.html
M LayoutTests/inspector/debugger/resources/breakpoint-options-utilities.js
M LayoutTests/inspector/debugger/resources/log-pause-location.js
M Source/WebInspectorUI/UserInterface/Test/Test.js
Log Message:
-----------
[Site Isolation] Web Inspector: inspector/debugger tests use the inert
page-target
rdar://184286862
https://bugs.webkit.org/show_bug.cgi?id=321240
Reviewed by BJ Burg.
Under site isolation FrameInspectorController::createLazyAgents() gives
every frame, including the main frame, its own FrameDebugger and
FrameDebuggerAgent. At the same time PageDebugger::attachDebugger()
returns early and never calls Page::setDebugger(), so the page target
still registers a Debugger domain but that domain owns no scripts and
never pauses. Its commands either fail outright or silently do nothing.
Test.js defines every bare window.*Agent global as
WI.mainTarget._agents[domainName], and WI.mainTarget is the page target,
so every DebuggerAgent.foo() and RuntimeAgent.foo() in a test reaches
the inert agent. This is the concrete failure mode of the existing
FIXME on that block, webkit.org/b/201149.
Add InspectorTest.mainFrameTarget, which finds the frame target whose
execution context belongs to the main frame and falls back to
WI.mainTarget. That fallback is what lets each test change be
unconditional: the expression resolves to the frame target when one
exists and to the page target otherwise, so the same test passes with
site isolation on and off without branching on it. It lives in Test.js
rather than on WI.TargetManager because no production code needs to
resolve a frame to its target yet; it should move once some does.
Where a test already holds the object whose target it needs, use that
object's target instead of the main-frame helper, since it states the
intent more directly and stays correct for subframes: script.target in
the breakpoint dumping helpers and callFrame.target in the
evaluateOnCallFrame tests.
Two further problems surfaced in the shared helpers once the commands
reached the right agent. InspectorBackend.runAfterPendingDispatches()
waits only on WI.mainTarget's connection, so the barrier in dump.js
fired before any frame-target response arrived and every test case
emitted an empty body; it now waits on the script's own connection.
Separately, findScript() gave up as soon as a resource matched by URL,
even when that resource had no associated scripts. Under site isolation
that state can be permanent. WI.Script resolves its resource once, in
its constructor, by searching its parentFrame's resource collection, and
parentFrame comes from the frame target's execution context. Debugger
events arrive on the frame target's connection while Network events
arrive on the UIProcess web-page target's connection, so scriptParsed
can be processed before the frontend can resolve the frame, in which
case _resolveResource() has no collection to search. Nothing calls
WI.Script.associateWithResource() afterwards, so the script stays
unassociated even once the resource is present. findScript() now keeps
looking past a matching-but-empty resource and falls back to the
targets' own script lists, which do not need that association. The
association failure itself is a frontend bug beyond these tests and
needs its own investigation.
No expected results change. Every fix routes a command back to the agent
that used to handle it, so the output is byte-identical to the existing
baselines in both configurations.
Of the 53 unexpected results in the inspector/debugger run with
--site-isolation, 21 now pass. They all share one shape: a Debugger or
Runtime command that only works when it reaches the agent owning the
JavaScript it refers to, which until now went to the inert page-target
agent instead. Among the progressed tests:
- 13 come through breakpoint-options-utilities.js, which covers
breakpoint conditions and actions. It creates a console saved value
and then uses $n in a condition or an evaluate action, so the value
has to be saved in the same target whose InjectedScript later
evaluates it. Those are the eight non-native symbolic-breakpoint-*
variants plus break-on-exception.html,
break-on-uncaught-exception.html, setPauseOnAssertions.html,
setPauseOnDebuggerStatements.html and setPauseOnMicrotasks.html.
- 5 are the evaluateOnCallFrame-* tests, where only the paused target
can evaluate against a call frame.
- 3 install a breakpoint and so need the agent that owns the script:
breakpoints/resolved-dump-all-pause-locations.html,
breakpoints/resolved-dump-all-inline-script-pause-locations.html and
stepping/stepping-pause-in-inner-step-to-parent.html, the only
stepping test that needs a real breakpoint rather than a debugger
statement.
* LayoutTests/inspector/debugger/breakpoints/resources/dump.js:
(TestPage.registerInitializer.addDumpAllPauseLocationsTestCaseForScript):
(TestPage.registerInitializer):
* LayoutTests/inspector/debugger/evaluateOnCallFrame-CommandLineAPI.html:
*
LayoutTests/inspector/debugger/evaluateOnCallFrame-emulateUserGesture-hasTransientActivation.html:
*
LayoutTests/inspector/debugger/evaluateOnCallFrame-emulateUserGesture-userIsInteracting.html:
* LayoutTests/inspector/debugger/evaluateOnCallFrame-emulateUserGesture.html:
* LayoutTests/inspector/debugger/evaluateOnCallFrame-exception.html:
* LayoutTests/inspector/debugger/resources/breakpoint-options-utilities.js:
(TestPage.registerInitializer.async suite):
(TestPage.registerInitializer):
* LayoutTests/inspector/debugger/resources/log-pause-location.js:
(TestPage.registerInitializer.window.findScript):
(TestPage.registerInitializer.window.setBreakpointsOnLinesWithBreakpointComment):
* Source/WebInspectorUI/UserInterface/Test/Test.js:
Canonical link: https://commits.webkit.org/320286@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications