| Index: Source/devtools/front_end/SourcesPanel.js
|
| diff --git a/Source/devtools/front_end/SourcesPanel.js b/Source/devtools/front_end/SourcesPanel.js
|
| index e6b91497a8ae066e2ad63d22f92fe2819bf3842f..3806df3e2885dc91b5aedac35bbf3c91efbb9300 100644
|
| --- a/Source/devtools/front_end/SourcesPanel.js
|
| +++ b/Source/devtools/front_end/SourcesPanel.js
|
| @@ -214,13 +214,6 @@
|
| window.addEventListener("beforeunload", handleBeforeUnload.bind(this), true);
|
| }
|
|
|
| -/** @type {!Array.<!WebInspector.DebuggerModel.PauseOnExceptionsState>} */
|
| -WebInspector.SourcesPanel.PauseOnExceptionsStates = [
|
| - WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseOnExceptions,
|
| - WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnUncaughtExceptions,
|
| - WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnAllExceptions
|
| -];
|
| -
|
| WebInspector.SourcesPanel.prototype = {
|
| /**
|
| * @return {!Element}
|
| @@ -730,66 +723,21 @@
|
| WebInspector.OpenResourceDialog.show(this, this.editorView.mainElement(), searchText);
|
| },
|
|
|
| - /**
|
| - * @return {!Array.<!WebInspector.StatusBarButton>}
|
| - */
|
| - _createPauseOnExceptionOptions: function()
|
| - {
|
| - this._pauseOnExceptionButton.title = this._pauseOnExceptionStateTitle(this._pauseOnExceptionButton.state);
|
| - var excludedOption = this._pauseOnExceptionButton.state;
|
| - var pauseStates = WebInspector.SourcesPanel.PauseOnExceptionsStates.slice(0);
|
| - var options = [];
|
| - for (var i = 0; i < pauseStates.length; ++i) {
|
| - if (pauseStates[i] === excludedOption)
|
| - continue;
|
| - var button = new WebInspector.StatusBarButton("", "scripts-pause-on-exceptions-status-bar-item", 3);
|
| - button.addEventListener("click", this._togglePauseOnExceptions, this);
|
| - button.state = pauseStates[i];
|
| - button.title = this._pauseOnExceptionStateTitle(pauseStates[i]);
|
| - options.push(button);
|
| - }
|
| - return options;
|
| - },
|
| -
|
| _pauseOnExceptionStateChanged: function()
|
| {
|
| - var state = WebInspector.settings.pauseOnExceptionStateString.get();
|
| - var nextState;
|
| - if (state === WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseOnExceptions)
|
| - nextState = WebInspector.settings.lastPauseOnExceptionState.get();
|
| - else
|
| - nextState = WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseOnExceptions;
|
| - this._pauseOnExceptionButton.title = this._pauseOnExceptionStateTitle(state, nextState);
|
| - this._pauseOnExceptionButton.state = state;
|
| - },
|
| -
|
| - /**
|
| - * @param {!WebInspector.DebuggerModel.PauseOnExceptionsState} state
|
| - * @param {!WebInspector.DebuggerModel.PauseOnExceptionsState=} nextState
|
| - * @return {string}
|
| - */
|
| - _pauseOnExceptionStateTitle: function(state, nextState)
|
| - {
|
| - var states = WebInspector.DebuggerModel.PauseOnExceptionsState;
|
| - var stateDescription;
|
| - if (state === states.DontPauseOnExceptions) {
|
| - stateDescription = WebInspector.UIString("Don't pause on exceptions.");
|
| - } else if (state === states.PauseOnAllExceptions) {
|
| - stateDescription = WebInspector.UIString("Pause on exceptions, including caught exceptions.");
|
| - } else if (state === states.PauseOnUncaughtExceptions) {
|
| - stateDescription = WebInspector.UIString("Pause on exceptions.");
|
| - } else {
|
| - throw "Unexpected state: " + state;
|
| - }
|
| - var nextStateDescription;
|
| - if (nextState === states.DontPauseOnExceptions) {
|
| - nextStateDescription = WebInspector.UIString("Click to Not pause on exceptions.");
|
| - } else if (nextState === states.PauseOnAllExceptions) {
|
| - nextStateDescription = WebInspector.UIString("Click to Pause on exceptions, including caught exceptions.");
|
| - } else if (nextState === states.PauseOnUncaughtExceptions) {
|
| - nextStateDescription = WebInspector.UIString("Click to Pause on exceptions.");
|
| - }
|
| - return nextState ? String.sprintf("%s\n%s", stateDescription, nextStateDescription) : stateDescription;
|
| + var pauseOnExceptionsState = WebInspector.settings.pauseOnExceptionStateString.get();
|
| + switch (pauseOnExceptionsState) {
|
| + case WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseOnExceptions:
|
| + this._pauseOnExceptionButton.title = WebInspector.UIString("Don't pause on exceptions.\nClick to Pause on all exceptions.");
|
| + break;
|
| + case WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnAllExceptions:
|
| + this._pauseOnExceptionButton.title = WebInspector.UIString("Pause on all exceptions.\nClick to Pause on uncaught exceptions.");
|
| + break;
|
| + case WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnUncaughtExceptions:
|
| + this._pauseOnExceptionButton.title = WebInspector.UIString("Pause on uncaught exceptions.\nClick to Not pause on exceptions.");
|
| + break;
|
| + }
|
| + this._pauseOnExceptionButton.state = pauseOnExceptionsState;
|
| },
|
|
|
| _updateDebuggerButtons: function()
|
| @@ -828,24 +776,14 @@
|
| this._updateDebuggerButtons();
|
| },
|
|
|
| - /**
|
| - * @param {!WebInspector.Event} e
|
| - */
|
| - _togglePauseOnExceptions: function(e)
|
| - {
|
| - var target = /** @type {!WebInspector.StatusBarButton} */ (e.target);
|
| - var state = /** @type {!WebInspector.DebuggerModel.PauseOnExceptionsState} */ (target.state);
|
| - var toggle = !e.data;
|
| + _togglePauseOnExceptions: function()
|
| + {
|
| + var nextStateMap = {};
|
| var stateEnum = WebInspector.DebuggerModel.PauseOnExceptionsState;
|
| - if (toggle) {
|
| - if (state !== stateEnum.DontPauseOnExceptions)
|
| - state = stateEnum.DontPauseOnExceptions
|
| - else
|
| - state = WebInspector.settings.lastPauseOnExceptionState.get();
|
| - }
|
| - if (state !== stateEnum.DontPauseOnExceptions)
|
| - WebInspector.settings.lastPauseOnExceptionState.set(state);
|
| - WebInspector.settings.pauseOnExceptionStateString.set(state);
|
| + nextStateMap[stateEnum.DontPauseOnExceptions] = stateEnum.PauseOnAllExceptions;
|
| + nextStateMap[stateEnum.PauseOnAllExceptions] = stateEnum.PauseOnUncaughtExceptions;
|
| + nextStateMap[stateEnum.PauseOnUncaughtExceptions] = stateEnum.DontPauseOnExceptions;
|
| + WebInspector.settings.pauseOnExceptionStateString.set(nextStateMap[this._pauseOnExceptionButton.state]);
|
| },
|
|
|
| /**
|
| @@ -1084,7 +1022,6 @@
|
| // Pause on Exception
|
| this._pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scripts-pause-on-exceptions-status-bar-item", 3);
|
| this._pauseOnExceptionButton.addEventListener("click", this._togglePauseOnExceptions, this);
|
| - this._pauseOnExceptionButton.setLongClickOptionsEnabled(this._createPauseOnExceptionOptions.bind(this));
|
| debugToolbar.appendChild(this._pauseOnExceptionButton.element);
|
|
|
| return debugToolbar;
|
|
|