Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 240e5121f5b0a30128a19b86fdd4e25ed0159b09
      
https://github.com/WebKit/WebKit/commit/240e5121f5b0a30128a19b86fdd4e25ed0159b09
  Author: Basuke Suzuki <[email protected]>
  Date:   2026-10-08 (Thu, 08 Oct 2026)

  Changed paths:
    A 
LayoutTests/http/tests/site-isolation/inspector/debugger/pause-holds-documents-created-during-pause-expected.txt
    A 
LayoutTests/http/tests/site-isolation/inspector/debugger/pause-holds-documents-created-during-pause.html
    A 
LayoutTests/http/tests/site-isolation/inspector/debugger/pause-holds-same-process-pages-expected.txt
    A 
LayoutTests/http/tests/site-isolation/inspector/debugger/pause-holds-same-process-pages.html
    M 
LayoutTests/http/tests/site-isolation/inspector/debugger/resources/same-process-frame.html
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/dom/Document.cpp
    A Source/WebCore/inspector/DebuggerSuspensionController.cpp
    A Source/WebCore/inspector/DebuggerSuspensionController.h
    M Source/WebCore/inspector/FrameDebugger.cpp
    M Source/WebCore/inspector/FrameDebugger.h
    M Source/WebCore/inspector/PageInspectorController.cpp
    M Source/WebCore/inspector/PageInspectorController.h

  Log Message:
  -----------
  [Site Isolation] Web Inspector: Documents that become current while a 
same-process frame is paused are not held
https://bugs.webkit.org/show_bug.cgi?id=326582
rdar://189344129

Reviewed by Qianlang Chen.

When a FrameDebugger pauses, 322777@main suspends every LocalFrame of every 
Page in the
process, but only the documents that are current at that moment. A document 
that became
current during the pause, such as a newly inserted iframe or a same-process 
sibling whose
navigation committed, started unsuspended, so its timers ran while the rest of 
the process
was held.

Add DebuggerSuspensionController, owned by each Page's PageInspectorController, 
and move the
holding there. While a FrameDebugger in the process is paused, every page's 
controller holds
the documents of its page, and holds a document that becomes current in its 
page (called from
Document::didBecomeCurrentDocumentInFrame()). The pause still holds every page 
in the process,
as 322777@main did, because the main thread is shared by all of them and an 
opener and its
same-site popup can make synchronous calls into each other. FrameDebugger keeps
only the process-wide guard against a second nested pause, and tells the 
controllers when a
pause begins and ends. The controller is per page so that the cross-process 
pause session
planned for global debugger pause (webkit.org/b/325545), which is per page, can 
add its holds
to it later.

Holding and releasing are idempotent, and recomputed from that state instead of 
toggled:
- Documents are tracked per document, so only a document that was held gets 
released.
- Frames whose ScriptController was paused are tracked separately, and are all 
unpaused when
  the pause ends. Before, a held frame that navigated during the pause to a 
document that
  cannot run scripts kept its ScriptController paused, so the event listeners 
of every later
  document in that frame were dropped.
- A document that is already suspended for another reason is not held. When a 
page comes back
  from the back/forward cache, its documents are made current before the cache 
resumes them,
  so the debugger's suspension would have been dropped while its 
animation-frame suspension was
  still counted.

The new pause-holds-documents-created-during-pause test pauses one same-origin 
iframe, then
inserts another iframe, navigates a sibling, and navigates a cross-site iframe 
to the paused
frame's site, and checks that their intervals do not advance until the pause 
ends. The
cross-site iframe moves into the paused process through 
WebFrame::commitProvisionalFrame(),
which replaces its RemoteFrame with a new LocalFrame. Without the call in
Document::didBecomeCurrentDocumentInFrame(), all three checks fail. Its last 
case navigates the sibling to a sandboxed document during the pause and
checks that an event listener runs in the next document; it fails when frames 
are unpaused
only through the documents that were held. The new 
pause-holds-same-process-pages test checks
that a same-origin popup in the same process is held along with the paused page.

The first test cancels the pause request that DebuggerManager sends to the 
target of a frame
that appears during the pause. 
InspectorDebuggerAgent::clearDebuggerBreakpointState() forgets
that request when the frame's global object is replaced but leaves it scheduled 
in
JSC::Debugger, so without the cancel the frame pauses at its next statement 
once the other
pause ends.

* 
LayoutTests/http/tests/site-isolation/inspector/debugger/pause-holds-documents-created-during-pause-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/debugger/pause-holds-documents-created-during-pause.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/debugger/pause-holds-same-process-pages-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/debugger/pause-holds-same-process-pages.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/debugger/resources/same-process-frame.html:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::didBecomeCurrentDocumentInFrame):
* Source/WebCore/inspector/DebuggerSuspensionController.cpp: Added.
(WebCore::DebuggerSuspensionController::DebuggerSuspensionController):
(WebCore::DebuggerSuspensionController::frameDebuggerDidPause):
(WebCore::DebuggerSuspensionController::frameDebuggerDidContinue):
(WebCore::DebuggerSuspensionController::updateHeldDocumentsInAllPages):
(WebCore::DebuggerSuspensionController::documentDidBecomeCurrent):
(WebCore::DebuggerSuspensionController::shouldHoldDocuments const):
(WebCore::DebuggerSuspensionController::updateHeldDocuments):
(WebCore::DebuggerSuspensionController::holdDocument):
(WebCore::DebuggerSuspensionController::releaseDocument):
* Source/WebCore/inspector/DebuggerSuspensionController.h: Added.
* Source/WebCore/inspector/FrameDebugger.cpp:
(WebCore::FrameDebugger::~FrameDebugger):
(WebCore::FrameDebugger::didPause):
(WebCore::FrameDebugger::didContinue):
(WebCore::FrameDebugger::setJavaScriptPausedInAllPages): Deleted.
(WebCore::FrameDebugger::setJavaScriptPaused): Deleted.
* Source/WebCore/inspector/FrameDebugger.h:
* Source/WebCore/inspector/PageInspectorController.cpp:
(WebCore::PageInspectorController::PageInspectorController):
* Source/WebCore/inspector/PageInspectorController.h:
(WebCore::PageInspectorController::debuggerSuspensionController const):

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



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

Reply via email to