Web Inspector: Debugger: add a global breakpoint for pausing in the next microtask
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Aug 2019 06:58:15 +0000 (06:58 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Aug 2019 06:58:15 +0000 (06:58 +0000)
commit3a897801efc455637d69463fb4c8e14789862364
tree254f7e1477e36e433d7b492adca95d84aab89202
parent906cb797cf8900635e82a4b4cb9d4286ccd81efb
Web Inspector: Debugger: add a global breakpoint for pausing in the next microtask
https://bugs.webkit.org/show_bug.cgi?id=200652

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

* inspector/protocol/Debugger.json:
Add `setPauseOnMicrotasks` command.

* inspector/agents/InspectorDebuggerAgent.h:
* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::InspectorDebuggerAgent::disable):
(Inspector::InspectorDebuggerAgent::setPauseOnMicrotasks): Added.
(Inspector::InspectorDebuggerAgent::willRunMicrotask): Added.
(Inspector::InspectorDebuggerAgent::didRunMicrotask): Added.

* debugger/Debugger.h:
(JSC::Debugger::willRunMicrotask): Added.
(JSC::Debugger::didRunMicrotask): Added.
* inspector/ScriptDebugListener.h:
* inspector/ScriptDebugServer.h:
* inspector/ScriptDebugServer.cpp:
(Inspector::ScriptDebugServer::evaluateBreakpointAction):
(Inspector::ScriptDebugServer::sourceParsed):
(Inspector::ScriptDebugServer::willRunMicrotask): Added.
(Inspector::ScriptDebugServer::didRunMicrotask): Added.
(Inspector::ScriptDebugServer::canDispatchFunctionToListeners const): ADded.
(Inspector::ScriptDebugServer::dispatchFunctionToListeners): ADded.
(Inspector::ScriptDebugServer::handlePause):
(Inspector::ScriptDebugServer::dispatchDidPause): Deleted.
(Inspector::ScriptDebugServer::dispatchBreakpointActionLog): Deleted.
(Inspector::ScriptDebugServer::dispatchBreakpointActionSound): Deleted.
(Inspector::ScriptDebugServer::dispatchBreakpointActionProbe): Deleted.
(Inspector::ScriptDebugServer::dispatchDidContinue): Deleted.
(Inspector::ScriptDebugServer::dispatchDidParseSource): Deleted.
(Inspector::ScriptDebugServer::dispatchFailedToParseSource): Deleted.
Unify the various `dispatch*` functions to use lambdas so state management is centralized.

* runtime/JSMicrotask.cpp:
(JSC::JSMicrotask::run):

* inspector/agents/JSGlobalObjectDebuggerAgent.h:

Source/WebCore:

Test: inspector/debugger/setPauseOnMicrotasks.html

* inspector/agents/page/PageDebuggerAgent.h:
* inspector/agents/worker/WorkerDebuggerAgent.h:

* inspector/agents/InspectorTimelineAgent.h:
(WebCore::InspectorTimelineAgent::willRunMicrotask): Added.
(WebCore::InspectorTimelineAgent::didRunMicrotask): Added.

Source/WebInspectorUI:

* UserInterface/Controllers/DebuggerManager.js:
(WI.DebuggerManager):
(WI.DebuggerManager.prototype.initializeTarget):
(WI.DebuggerManager.prototype.get allMicrotasksBreakpoint): ADded.
(WI.DebuggerManager.prototype.isBreakpointSpecial):
(WI.DebuggerManager.prototype._pauseReasonFromPayload):
(WI.DebuggerManager.prototype._breakpointDisabledStateDidChange):

* UserInterface/Views/DebuggerSidebarPanel.js:
(WI.DebuggerSidebarPanel):
(WI.DebuggerSidebarPanel.prototype.saveStateToCookie):
(WI.DebuggerSidebarPanel.prototype.restoreStateFromCookie):
(WI.DebuggerSidebarPanel.prototype._addBreakpoint):
(WI.DebuggerSidebarPanel.prototype._addTreeElement):
(WI.DebuggerSidebarPanel.prototype._updatePauseReasonSection):
(WI.DebuggerSidebarPanel.prototype._handleBreakpointElementAddedOrRemoved):
(WI.DebuggerSidebarPanel.prototype._populateCreateBreakpointContextMenu):
* UserInterface/Views/SourcesNavigationSidebarPanel.js:
(WI.SourcesNavigationSidebarPanel):
(WI.SourcesNavigationSidebarPanel.prototype._insertDebuggerTreeElement):
(WI.SourcesNavigationSidebarPanel.prototype._addBreakpoint):
(WI.SourcesNavigationSidebarPanel.prototype._updatePauseReasonSection):
(WI.SourcesNavigationSidebarPanel.prototype._handleBreakpointElementAddedOrRemoved):
(WI.SourcesNavigationSidebarPanel.prototype._populateCreateBreakpointContextMenu):

* UserInterface/Views/BreakpointTreeElement.css:
(.breakpoint-microtask-icon .icon): Added.
* UserInterface/Images/Microtask.svg: Added.

* UserInterface/Base/Setting.js:
* Localizations/en.lproj/localizedStrings.js:

LayoutTests:

* inspector/debugger/setPauseOnMicrotasks.html: Added.
* inspector/debugger/setPauseOnMicrotasks-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248894 268f45cc-cd09-0410-ab3c-d52691b4dbfc
25 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/debugger/setPauseOnMicrotasks-expected.txt [new file with mode: 0644]
LayoutTests/inspector/debugger/setPauseOnMicrotasks.html [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/debugger/Debugger.h
Source/JavaScriptCore/inspector/ScriptDebugListener.h
Source/JavaScriptCore/inspector/ScriptDebugServer.cpp
Source/JavaScriptCore/inspector/ScriptDebugServer.h
Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp
Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h
Source/JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.h
Source/JavaScriptCore/inspector/protocol/Debugger.json
Source/JavaScriptCore/runtime/JSMicrotask.cpp
Source/WebCore/ChangeLog
Source/WebCore/inspector/agents/InspectorTimelineAgent.h
Source/WebCore/inspector/agents/page/PageDebuggerAgent.h
Source/WebCore/inspector/agents/worker/WorkerDebuggerAgent.h
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Base/Setting.js
Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js
Source/WebInspectorUI/UserInterface/Images/Microtask.svg [new file with mode: 0644]
Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.css
Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js