diff --git a/browser/devtools/debugger/debugger-panes.js b/browser/devtools/debugger/debugger-panes.js index a9601cfb769f..0e512791fa86 100644 --- a/browser/devtools/debugger/debugger-panes.js +++ b/browser/devtools/debugger/debugger-panes.js @@ -94,6 +94,8 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, { } return (a in KNOWN_SOURCE_GROUPS) ? 1 : -1; }; + + this._addCommands(); }, /** @@ -112,6 +114,22 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, { this._cbTextbox.removeEventListener("keypress", this._onConditionalTextboxKeyPress, false); }, + /** + * Add commands that XUL can fire. + */ + _addCommands: function() { + utils.addCommands(this._commandset, { + addBreakpointCommand: e => this._onCmdAddBreakpoint(e), + addConditionalBreakpointCommand: e => this._onCmdAddConditionalBreakpoint(e), + blackBoxCommand: () => this.toggleBlackBoxing(), + unBlackBoxButton: () => this._onStopBlackBoxing(), + prettyPrintCommand: () => this.togglePrettyPrint(), + toggleBreakpointsCommand: () =>this.toggleBreakpoints(), + nextSourceCommand: () => this.selectNextItem(), + prevSourceCommand: () => this.selectPrevItem() + }); + }, + /** * Sets the preferred location to be selected in this sources container. * @param string aUrl @@ -1279,6 +1297,8 @@ TracerView.prototype = Heritage.extend(WidgetMethods, { this._traceButton.setAttribute("tooltiptext", this._startTooltip); this.emptyText = this._tracingNotStartedString; + + this._addCommands(); }, /** @@ -1297,6 +1317,17 @@ TracerView.prototype = Heritage.extend(WidgetMethods, { this._search.removeEventListener("input", this._onSearch, false); }, + /** + * Add commands that XUL can fire. + */ + _addCommands: function() { + utils.addCommands(document.getElementById('debuggerCommands'), { + toggleTracing: () => this._onToggleTracing(), + startTracing: () => this._onStartTracing(), + clearTraces: () => this._onClear() + }); + }, + /** * Function invoked by the "toggleTracing" command to switch the tracer state. */ @@ -2205,6 +2236,7 @@ WatchExpressionsView.prototype = Heritage.extend(WidgetMethods, { this.widget.addEventListener("click", this._onClick, false); this.headerText = L10N.getStr("addWatchExpressionText"); + this._addCommands(); }, /** @@ -2216,6 +2248,16 @@ WatchExpressionsView.prototype = Heritage.extend(WidgetMethods, { this.widget.removeEventListener("click", this._onClick, false); }, + /** + * Add commands that XUL can fire. + */ + _addCommands: function() { + utils.addCommands(document.getElementById('debuggerCommands'), { + addWatchExpressionCommand: () => this._onCmdAddExpression(), + removeAllWatchExpressionsCommand: () => this._onCmdRemoveAllExpressions() + }); + }, + /** * Adds a watch expression in this container. * diff --git a/browser/devtools/debugger/debugger-toolbar.js b/browser/devtools/debugger/debugger-toolbar.js index 695bbd68df7c..2be94821b91d 100644 --- a/browser/devtools/debugger/debugger-toolbar.js +++ b/browser/devtools/debugger/debugger-toolbar.js @@ -57,6 +57,7 @@ ToolbarView.prototype = { this._stepOverButton.setAttribute("tooltiptext", this._stepOverTooltip); this._stepInButton.setAttribute("tooltiptext", this._stepInTooltip); this._stepOutButton.setAttribute("tooltiptext", this._stepOutTooltip); + this._addCommands(); }, /** @@ -72,6 +73,18 @@ ToolbarView.prototype = { this._stepOutButton.removeEventListener("mousedown", this._onStepOutPressed, false); }, + /** + * Add commands that XUL can fire. + */ + _addCommands: function() { + utils.addCommands(document.getElementById('debuggerCommands'), { + resumeCommand: () => this._onResumePressed(), + stepOverCommand: () => this._onStepOverPressed(), + stepInCommand: () => this._onStepInPressed(), + stepOutCommand: () => this._onStepOutPressed() + }); + }, + /** * Display a warning when trying to resume a debuggee while another is paused. * Debuggees must be unpaused in a Last-In-First-Out order. @@ -225,8 +238,9 @@ OptionsView.prototype = { this._showVariablesFilterBoxItem.setAttribute("checked", Prefs.variablesSearchboxVisible); this._showOriginalSourceItem.setAttribute("checked", Prefs.sourceMapsEnabled); this._autoBlackBoxItem.setAttribute("checked", Prefs.autoBlackBox); - }, + this._addCommands(); + }, /** * Destruction function, called when the debugger is closed. @@ -236,6 +250,22 @@ OptionsView.prototype = { // Nothing to do here yet. }, + /** + * Add commands that XUL can fire. + */ + _addCommands: function() { + utils.addCommands(document.getElementById('debuggerCommands'), { + toggleAutoPrettyPrint: () => this._toggleAutoPrettyPrint(), + togglePauseOnExceptions: () => this._togglePauseOnExceptions(), + toggleIgnoreCaughtExceptions: () => this._toggleIgnoreCaughtExceptions(), + toggleShowPanesOnStartup: () => this._toggleShowPanesOnStartup(), + toggleShowOnlyEnum: () => this._toggleShowVariablesOnlyEnum(), + toggleShowVariablesFilterBox: () => this._toggleShowVariablesFilterBox(), + toggleShowOriginalSource: () => this._toggleShowOriginalSource(), + toggleAutoBlackBox: () => this._toggleAutoBlackBox() + }); + }, + /** * Listener handling the 'gear menu' popup showing event. */ @@ -784,6 +814,8 @@ FilterView.prototype = { L10N.getFormatStr("searchPanelGoToLine", this._lineSearchKey)); this._variableOperatorLabel.setAttribute("value", L10N.getFormatStr("searchPanelVariable", this._variableSearchKey)); + + this._addCommands(); }, /** @@ -799,6 +831,21 @@ FilterView.prototype = { this._searchbox.removeEventListener("blur", this._onBlur, false); }, + /** + * Add commands that XUL can fire. + */ + _addCommands: function() { + utils.addCommands(document.getElementById('debuggerCommands'), { + fileSearchCommand: () => this._doFileSearch(), + globalSearchCommand: () => this._doGlobalSearch(), + functionSearchCommand: () => this._doFunctionSearch(), + tokenSearchCommand: () => this._doTokenSearch(), + lineSearchCommand: () => this._doLineSearch(), + variableSearchCommand: () => this._doVariableSearch(), + variablesFocusCommand: () => this._doVariablesFocus() + }); + }, + /** * Gets the entered operator and arguments in the searchbox. * @return array diff --git a/browser/devtools/debugger/debugger.xul b/browser/devtools/debugger/debugger.xul index 0a8ddf9806fc..aca118bb4c3f 100644 --- a/browser/devtools/debugger/debugger.xul +++ b/browser/devtools/debugger/debugger.xul @@ -25,6 +25,7 @@