Commit 577f5a24 authored by commit-queue@webkit.org's avatar commit-queue@webkit.org
Browse files

Web Inspector: Debugger should have Continue to Here Context Menu

https://bugs.webkit.org/show_bug.cgi?id=120189

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2013-08-27
Reviewed by Timothy Hatcher.

When paused in the debugger and presenting a Context Menu in the
gutter, include a "Continue to Here" option. This requires a
script/line/column location combination.

* UserInterface/DebuggerManager.js:
(WebInspector.DebuggerManager.prototype.continueToLocation):
* UserInterface/Resource.js:
(WebInspector.Resource.prototype.scriptForLocation):
* UserInterface/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype.continueToLocation):
(WebInspector.SourceCodeTextEditor.prototype.textEditorGutterContextMenu):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154703 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f9766b13
2013-08-27 Joseph Pecoraro <pecoraro@apple.com>
Web Inspector: Debugger should have Continue to Here Context Menu
https://bugs.webkit.org/show_bug.cgi?id=120189
Reviewed by Timothy Hatcher.
When paused in the debugger and presenting a Context Menu in the
gutter, include a "Continue to Here" option. This requires a
script/line/column location combination.
* UserInterface/DebuggerManager.js:
(WebInspector.DebuggerManager.prototype.continueToLocation):
* UserInterface/Resource.js:
(WebInspector.Resource.prototype.scriptForLocation):
* UserInterface/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype.continueToLocation):
(WebInspector.SourceCodeTextEditor.prototype.textEditorGutterContextMenu):
2013-08-26 Joseph Pecoraro <pecoraro@apple.com>
Web Inspector: We should regenerate InspectorBackendCommands.js for Legacy Inspector.json versions
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -210,6 +210,11 @@ WebInspector.DebuggerManager.prototype = {
return this._scriptURLMap[url] || [];
},
continueToLocation: function(scriptIdentifier, lineNumber, columnNumber)
{
DebuggerAgent.continueToLocation({scriptId: scriptIdentifier, lineNumber: lineNumber, columnNumber: columnNumber});
},
addBreakpoint: function(breakpoint, skipEventDispatch)
{
console.assert(breakpoint);
......
......@@ -417,6 +417,29 @@ WebInspector.Resource.prototype = {
return this._scripts || [];
},
scriptForLocation: function(sourceCodeLocation)
{
console.assert(!(this instanceof WebInspector.SourceMapResource));
console.assert(sourceCodeLocation.sourceCode === this, "SourceCodeLocation must be in this Resource");
if (sourceCodeLocation.sourceCode !== this)
return null;
var lineNumber = sourceCodeLocation.lineNumber;
var columnNumber = sourceCodeLocation.columnNumber;
for (var i = 0; i < this._scripts.length; ++i) {
var script = this._scripts[i];
if (script.range.startLine <= lineNumber && script.range.endLine >= lineNumber) {
if (script.range.startLine === lineNumber && columnNumber < script.range.startColumn)
continue;
if (script.range.endLine === lineNumber && columnNumber > script.range.endColumn)
continue;
return script;
}
}
return null;
},
updateForRedirectResponse: function(url, requestHeaders, timestamp)
{
console.assert(!this._finished);
......
......@@ -683,6 +683,30 @@ WebInspector.SourceCodeTextEditor.prototype = {
event.preventDefault();
var contextMenu = new WebInspector.ContextMenu(event);
// Paused. Add Continue to Here option only if we have a script identifier for the location.
if (WebInspector.debuggerManager.paused) {
var editorLineInfo = {lineNumber:lineNumber, columnNumber:columnNumber};
var unformattedLineInfo = this._unformattedLineInfoForEditorLineInfo(editorLineInfo);
var sourceCodeLocation = this._sourceCode.createSourceCodeLocation(unformattedLineInfo.lineNumber, unformattedLineInfo.columnNumber);
if (sourceCodeLocation.sourceCode instanceof WebInspector.Script)
var script = sourceCodeLocation.sourceCode;
else if (sourceCodeLocation.sourceCode instanceof WebInspector.Resource)
var script = sourceCodeLocation.sourceCode.scriptForLocation(sourceCodeLocation);
if (script) {
function continueToLocation()
{
WebInspector.debuggerManager.continueToLocation(script.id, sourceCodeLocation.lineNumber, sourceCodeLocation.columnNumber);
}
contextMenu.appendItem(WebInspector.UIString("Continue to Here"), continueToLocation);
contextMenu.appendSeparator();
}
}
var breakpoints = [];
for (var i = 0; i < editorBreakpoints.length; ++i) {
var lineInfo = editorBreakpoints[i];
......@@ -700,7 +724,6 @@ WebInspector.SourceCodeTextEditor.prototype = {
this.setBreakpointInfoForLineAndColumn(data.lineNumber, data.columnNumber, data.breakpointInfo);
}
var contextMenu = new WebInspector.ContextMenu(event);
contextMenu.appendItem(WebInspector.UIString("Add Breakpoint"), addBreakpoint.bind(this));
contextMenu.show();
return;
......@@ -717,7 +740,6 @@ WebInspector.SourceCodeTextEditor.prototype = {
treeElement.revealAndSelect();
}
var contextMenu = new WebInspector.ContextMenu(event);
breakpoint.appendContextMenuItems(contextMenu, event.target);
contextMenu.appendSeparator();
contextMenu.appendItem(WebInspector.UIString("Reveal in Debugger Navigation Sidebar"), revealInSidebar);
......@@ -749,7 +771,6 @@ WebInspector.SourceCodeTextEditor.prototype = {
breakpoints[i].disabled = shouldDisable;
}
var contextMenu = new WebInspector.ContextMenu(event);
if (shouldDisable)
contextMenu.appendItem(WebInspector.UIString("Disable Breakpoints"), toggleBreakpoints.bind(this));
else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment