Web Inspector: Pause Reason Improvements (Breakpoint, Debugger Statement, Pause on Next Statement)
https://bugs.webkit.org/show_bug.cgi?id=138991

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

* debugger/Debugger.cpp:
(JSC::Debugger::Debugger):
(JSC::Debugger::pauseIfNeeded):
(JSC::Debugger::didReachBreakpoint):
When actually pausing, if we hit a breakpoint ensure the reason
is PausedForBreakpoint, otherwise use the current reason.

* debugger/Debugger.h:
Make pause reason and pausing breakpoint ID public.

* inspector/agents/InspectorDebuggerAgent.h:
* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::buildAssertPauseReason):
(Inspector::buildCSPViolationPauseReason):
(Inspector::InspectorDebuggerAgent::buildBreakpointPauseReason):
(Inspector::InspectorDebuggerAgent::buildExceptionPauseReason):
(Inspector::InspectorDebuggerAgent::handleConsoleAssert):
(Inspector::buildObjectForBreakpointCookie):
(Inspector::InspectorDebuggerAgent::setBreakpointByUrl):
(Inspector::InspectorDebuggerAgent::removeBreakpoint):
(Inspector::InspectorDebuggerAgent::resolveBreakpoint):
(Inspector::InspectorDebuggerAgent::pause):
(Inspector::InspectorDebuggerAgent::scriptExecutionBlockedByCSP):
(Inspector::InspectorDebuggerAgent::currentCallFrames):
(Inspector::InspectorDebuggerAgent::clearDebuggerBreakpointState):
Clean up creation of pause reason objects and other cleanup
of PassRefPtr use and InjectedScript use.

(Inspector::InspectorDebuggerAgent::didPause):
Clean up so that we first check for an Exception, and then fall
back to including a Pause Reason derived from the Debugger.

* inspector/protocol/Debugger.json:
Add new DebuggerStatement, Breakpoint, and PauseOnNextStatement reasons.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:
New UI strings for Pause Reasons.

* UserInterface/Controllers/DebuggerManager.js:
(WebInspector.DebuggerManager.prototype.breakpointForIdentifier):
Provide a way to get the breakpoint with an identifier.

* UserInterface/Images/PausedBreakpoint.svg: Added.
* UserInterface/Images/gtk/PausedBreakpoint.svg: Added.
Copy PseudoElement.svg icon and give it a new name.

* UserInterface/Views/BreakpointTreeElement.css:
(.breakpoint-paused-icon .icon):
New icon for a breakpoint causing a pause.

* UserInterface/Views/BreakpointTreeElement.js:
(WebInspector.BreakpointTreeElement.prototype.removeStatusImage):
(WebInspector.BreakpointTreeElement.prototype._updateStatus):
Give API to remove the breakpoint status icon from a BreakpointTreeElement.

* UserInterface/Views/DebuggerSidebarPanel.js:
(WebInspector.DebuggerSidebarPanel):
(WebInspector.DebuggerSidebarPanel.prototype.get hasSelectedElement):
(WebInspector.DebuggerSidebarPanel.prototype.deselectBreakpointContentTreeElements):
(WebInspector.DebuggerSidebarPanel.prototype.deselectPauseReasonContentTreeElements):
(WebInspector.DebuggerSidebarPanel.prototype._treeElementSelected):
Give DebuggerSidebarPanel an optional pause reason tree outline. When available
include it in the pattern of ensuring a single exclusive selection.

(WebInspector.DebuggerSidebarPanel.prototype._breakpointRemoved):
When a breakpoint is removed, check if we should update the pause reason tree outline.

(WebInspector.DebuggerSidebarPanel.prototype._updatePauseReason):
(WebInspector.DebuggerSidebarPanel.prototype._updatePauseReasonSection):
Update Pause Reason section contents depending on the reason.

(WebInspector.DebuggerSidebarPanel.prototype._updatePauseReasonGotoArrow):
Always try to include a goto arrow to jump to the original pause location
if it is available at the time of pausing.

LayoutTests:

Test that the frontend receives expected pause reasons for different kinds of pauses.

* inspector/debugger/pause-reason-expected.txt: Added.
* inspector/debugger/pause-reason.html: Added.
* inspector/debugger/resources/pause-reasons.js: Added.
(triggerBreakpoint):
(triggerException):
(triggerDebuggerStatement):
(triggerAssert):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@178137 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed