SIGN IN SIGN UP

Web Inspector: [SI] Multiple FrameDebuggers in one process can pause at the same time and nest run loops

https://bugs.webkit.org/show_bug.cgi?id=325815
rdar://188827623

Reviewed by Qianlang Chen.

Under site isolation, same-site frames share a process and each has its own FrameDebugger
over the one VM and main thread. While one debugger is paused, JS in another frame can
run inside its nested run loop and pause that frame's debugger too, nesting a second loop.

Add Debugger::isPauseBlockedByAnotherDebugger() so a subclass can hold off pausing
without dropping pending pause state. breakProgram() and didReachDebuggerStatement()
also check it before setting any pause state. FrameDebugger uses it to allow one
paused debugger per process, and now suspends all local frames of the page while
paused, matching PageDebugger.

* Source/JavaScriptCore/debugger/Debugger.cpp:
(JSC::Debugger::breakProgram):
(JSC::Debugger::pauseIfNeeded):
(JSC::Debugger::didReachDebuggerStatement):
* Source/JavaScriptCore/debugger/Debugger.h:
(JSC::Debugger::isPauseBlockedByAnotherDebugger const):
* Source/WebCore/inspector/FrameDebugger.cpp:
(WebCore::FrameDebugger::~FrameDebugger):
(WebCore::FrameDebugger::recompileAllJSFunctions):
(WebCore::FrameDebugger::didPause):
(WebCore::FrameDebugger::didContinue):
(WebCore::FrameDebugger::isPauseBlockedByAnotherDebugger const):
(WebCore::FrameDebugger::setJavaScriptPausedInAllPages):
* Source/WebCore/inspector/FrameDebugger.h:

Canonical link: https://commits.webkit.org/322777@main
A
Anuj Panta committed
ba688904ad4b2c22635c035725db087f53c6489f
Parent: 185f118