Bug 906963 - Add a "ignore caught exceptions" checkbox to the UI; r=dcamp

This commit is contained in:
Eddy Bruel 2013-09-09 19:02:41 +02:00
parent 80038c3baf
commit 6a86294515
7 changed files with 47 additions and 3 deletions

View File

@ -1100,6 +1100,7 @@ pref("devtools.debugger.chrome-debugging-port", 6080);
pref("devtools.debugger.remote-host", "localhost");
pref("devtools.debugger.remote-timeout", 20000);
pref("devtools.debugger.pause-on-exceptions", false);
pref("devtools.debugger.ignore-caught-exceptions", true);
pref("devtools.debugger.source-maps-enabled", true);
// The default Debugger UI settings

View File

@ -384,7 +384,8 @@ ThreadState.prototype = {
dumpn("ThreadState is connecting...");
this.activeThread.addListener("paused", this._update);
this.activeThread.addListener("resumed", this._update);
this.activeThread.pauseOnExceptions(Prefs.pauseOnExceptions);
this.activeThread.pauseOnExceptions(Prefs.pauseOnExceptions,
Prefs.ignoreCaughtExceptions);
this._handleTabNavigation();
},
@ -1557,6 +1558,7 @@ let Prefs = new ViewHelpers.Prefs("devtools.debugger", {
variablesOnlyEnumVisible: ["Bool", "ui.variables-only-enum-visible"],
variablesSearchboxVisible: ["Bool", "ui.variables-searchbox-visible"],
pauseOnExceptions: ["Bool", "pause-on-exceptions"],
ignoreCaughtExceptions: ["Bool", "ignore-caught-exceptions"],
sourceMapsEnabled: ["Bool", "source-maps-enabled"]
});

View File

@ -190,6 +190,7 @@ function OptionsView() {
dumpn("OptionsView was instantiated");
this._togglePauseOnExceptions = this._togglePauseOnExceptions.bind(this);
this._toggleIgnoreCaughtExceptions = this._toggleIgnoreCaughtExceptions.bind(this);
this._toggleShowPanesOnStartup = this._toggleShowPanesOnStartup.bind(this);
this._toggleShowVariablesOnlyEnum = this._toggleShowVariablesOnlyEnum.bind(this);
this._toggleShowVariablesFilterBox = this._toggleShowVariablesFilterBox.bind(this);
@ -205,12 +206,14 @@ OptionsView.prototype = {
this._button = document.getElementById("debugger-options");
this._pauseOnExceptionsItem = document.getElementById("pause-on-exceptions");
this._ignoreCaughtExceptionsItem = document.getElementById("ignore-caught-exceptions");
this._showPanesOnStartupItem = document.getElementById("show-panes-on-startup");
this._showVariablesOnlyEnumItem = document.getElementById("show-vars-only-enum");
this._showVariablesFilterBoxItem = document.getElementById("show-vars-filter-box");
this._showOriginalSourceItem = document.getElementById("show-original-source");
this._pauseOnExceptionsItem.setAttribute("checked", Prefs.pauseOnExceptions);
this._ignoreCaughtExceptionsItem.setAttribute("checked", Prefs.ignoreCaughtExceptions);
this._showPanesOnStartupItem.setAttribute("checked", Prefs.panesVisibleOnStartup);
this._showVariablesOnlyEnumItem.setAttribute("checked", Prefs.variablesOnlyEnumVisible);
this._showVariablesFilterBoxItem.setAttribute("checked", Prefs.variablesSearchboxVisible);
@ -250,10 +253,21 @@ OptionsView.prototype = {
* Listener handling the 'pause on exceptions' menuitem command.
*/
_togglePauseOnExceptions: function() {
let pref = Prefs.pauseOnExceptions =
Prefs.pauseOnExceptions =
this._pauseOnExceptionsItem.getAttribute("checked") == "true";
DebuggerController.activeThread.pauseOnExceptions(pref);
DebuggerController.activeThread.pauseOnExceptions(
Prefs.pauseOnExceptions,
Prefs.ignoreCaughtExceptions);
},
_toggleIgnoreCaughtExceptions: function() {
Prefs.ignoreCaughtExceptions =
this._ignoreCaughtExceptionsItem.getAttribute("checked") == "true";
DebuggerController.activeThread.pauseOnExceptions(
Prefs.pauseOnExceptions,
Prefs.ignoreCaughtExceptions);
},
/**

View File

@ -70,6 +70,8 @@
oncommand="DebuggerView.WatchExpressions._onCmdRemoveAllExpressions()"/>
<command id="togglePauseOnExceptions"
oncommand="DebuggerView.Options._togglePauseOnExceptions()"/>
<command id="toggleIgnoreCaughtExceptions"
oncommand="DebuggerView.Options._toggleIgnoreCaughtExceptions()"/>
<command id="toggleShowPanesOnStartup"
oncommand="DebuggerView.Options._toggleShowPanesOnStartup()"/>
<command id="toggleShowOnlyEnum"
@ -160,6 +162,11 @@
label="&debuggerUI.pauseExceptions;"
accesskey="&debuggerUI.pauseExceptions.key;"
command="togglePauseOnExceptions"/>
<menuitem id="ignore-caught-exceptions"
type="checkbox"
label="&debuggerUI.ignoreCaughtExceptions;"
accesskey="&debuggerUI.ignoreCaughtExceptions.key;"
command="toggleIgnoreCaughtExceptions"/>
<menuitem id="show-panes-on-startup"
type="checkbox"
label="&debuggerUI.showPanesOnInit;"

View File

@ -38,6 +38,10 @@ function testWithFrame()
is(gDebugger.DebuggerView.Options._pauseOnExceptionsItem.getAttribute("checked"), "true",
"Pause on exceptions should be enabled from startup. ")
// Disable ignore caught exceptions
gDebugger.DebuggerView.Options._ignoreCaughtExceptionsItem.setAttribute("checked", "false");
gDebugger.DebuggerView.Options._toggleIgnoreCaughtExceptions();
let count = 0;
gPane.panelWin.gClient.addOneTimeListener("paused", function() {
gDebugger.addEventListener("Debugger:FetchedVariables", function testA() {
@ -103,6 +107,10 @@ function resumeAndFinish() {
gDebugger.DebuggerView.Options._pauseOnExceptionsItem.setAttribute("checked", "false");
gDebugger.DebuggerView.Options._togglePauseOnExceptions();
// Enable ignore caught exceptions
gDebugger.DebuggerView.Options._ignoreCaughtExceptionsItem.setAttribute("checked", "true");
gDebugger.DebuggerView.Options._toggleIgnoreCaughtExceptions();
is(gDebugger.Prefs.pauseOnExceptions, false,
"The pause-on-exceptions pref should have been set to false.");

View File

@ -58,6 +58,10 @@ function testWithFrame()
is(gDebugger.DebuggerView.Options._pauseOnExceptionsItem.getAttribute("checked"), "true",
"Pause on exceptions should be enabled from startup. ")
// Disable ignore caught exceptions
gDebugger.DebuggerView.Options._ignoreCaughtExceptionsItem.setAttribute("checked", "false");
gDebugger.DebuggerView.Options._toggleIgnoreCaughtExceptions();
count = 0;
gPane.panelWin.gClient.addOneTimeListener("resumed", function() {
gDebugger.addEventListener("Debugger:FetchedVariables", function testB() {
@ -94,6 +98,9 @@ function testWithFrame()
gDebugger.DebuggerView.Options._pauseOnExceptionsItem.setAttribute("checked", "false");
gDebugger.DebuggerView.Options._togglePauseOnExceptions();
gDebugger.DebuggerView.Options._ignoreCaughtExceptionsItem.setAttribute("checked", "true");
gDebugger.DebuggerView.Options._toggleIgnoreCaughtExceptions();
is(gDebugger.Prefs.pauseOnExceptions, false,
"The pause-on-exceptions pref should have been set to false.");

View File

@ -38,6 +38,11 @@
<!ENTITY debuggerUI.pauseExceptions "Pause on exceptions">
<!ENTITY debuggerUI.pauseExceptions.key "E">
<!-- LOCALIZATION NOTE (debuggerUI.pauseExceptions): This is the label for the
- checkbox that toggles ignoring caught exceptions. -->
<!ENTITY debuggerUI.ignoreCaughtExceptions "Ignore caught exceptions">
<!ENTITY debuggerUI.ignoreCaughtExceptions.key "C">
<!-- LOCALIZATION NOTE (debuggerUI.showPanesOnInit): This is the label for the
- checkbox that toggles visibility of panes when opening the debugger. -->
<!ENTITY debuggerUI.showPanesOnInit "Show panes on startup">