Web Inspector: Pause Reason Improvements (Breakpoint, Debugger Statement, Pause on...
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Jan 2015 23:16:48 +0000 (23:16 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Jan 2015 23:16:48 +0000 (23:16 +0000)
commitebd14d4f50825808064a8261237be4a42ca69f97
tree8d9ee64b36cc0dd2872496bb6fa82f6fd5ec7328
parent88d86722da207e1b0102897ca1b56aa0fdf0c1af
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: https://svn.webkit.org/repository/webkit/trunk@178137 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/debugger/pause-reason-expected.txt [new file with mode: 0644]
LayoutTests/inspector/debugger/pause-reason.html [new file with mode: 0644]
LayoutTests/inspector/debugger/resources/pause-reasons.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/debugger/Debugger.cpp
Source/JavaScriptCore/debugger/Debugger.h
Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp
Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h
Source/JavaScriptCore/inspector/protocol/Debugger.json
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js
Source/WebInspectorUI/UserInterface/Images/PausedBreakpoint.svg [new file with mode: 0644]
Source/WebInspectorUI/UserInterface/Images/gtk/PausedBreakpoint.svg [new file with mode: 0644]
Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.css
Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js
Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js