Bug 808786 - Add a pref to disable sorting the variables when adding them in the view, r=past

This commit is contained in:
Victor Porof 2012-11-10 13:14:40 +02:00
parent b7a94229ea
commit b04bb02548
2 changed files with 8 additions and 3 deletions

View File

@ -1054,6 +1054,7 @@ pref("devtools.debugger.ui.win-height", 400);
pref("devtools.debugger.ui.stackframes-width", 200);
pref("devtools.debugger.ui.variables-width", 300);
pref("devtools.debugger.ui.panes-visible-on-startup", false);
pref("devtools.debugger.ui.variables-sorting-enabled", true);
pref("devtools.debugger.ui.variables-non-enum-visible", true);
pref("devtools.debugger.ui.variables-searchbox-visible", false);

View File

@ -603,11 +603,14 @@ StackFrames.prototype = {
if (!aVariables) {
return;
}
// Sort all of the variables before adding them.
let sortedVariableNames = Object.keys(aVariables).sort();
let variableNames = Object.keys(aVariables);
// Sort all of the variables before adding them if preferred.
if (Prefs.variablesSortingEnabled) {
variableNames.sort();
}
// Add the sorted variables to the specified scope.
for (let name of sortedVariableNames) {
for (let name of variableNames) {
let paramVar = aScope.addVar(name, aVariables[name]);
let paramVal = aVariables[name].value;
this._addExpander(paramVar, paramVal);
@ -1300,6 +1303,7 @@ Prefs.map("Int", "windowHeight", "devtools.debugger.ui.win-height");
Prefs.map("Int", "stackframesWidth", "devtools.debugger.ui.stackframes-width");
Prefs.map("Int", "variablesWidth", "devtools.debugger.ui.variables-width");
Prefs.map("Bool", "panesVisibleOnStartup", "devtools.debugger.ui.panes-visible-on-startup");
Prefs.map("Bool", "variablesSortingEnabled", "devtools.debugger.ui.variables-sorting-enabled");
Prefs.map("Bool", "variablesNonEnumVisible", "devtools.debugger.ui.variables-non-enum-visible");
Prefs.map("Bool", "variablesSearchboxVisible", "devtools.debugger.ui.variables-searchbox-visible");
Prefs.map("Char", "remoteHost", "devtools.debugger.remote-host");