Merge fx-team to m-c.

This commit is contained in:
Ryan VanderMeulen 2012-11-10 16:53:55 -05:00
commit c8aaa958ab
11 changed files with 202 additions and 233 deletions

View File

@ -1047,11 +1047,14 @@ pref("devtools.debugger.remote-timeout", 20000);
// The default Debugger UI settings
pref("devtools.debugger.ui.height", 250);
pref("devtools.debugger.ui.remote-win.width", 900);
pref("devtools.debugger.ui.remote-win.height", 400);
pref("devtools.debugger.ui.win-x", 0);
pref("devtools.debugger.ui.win-y", 0);
pref("devtools.debugger.ui.win-width", 900);
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

@ -328,7 +328,6 @@ DebuggerPane.prototype = {
Prefs.height = this._frame.height;
this._frame.removeEventListener("Debugger:Unloaded", this.close, true);
this._nbox.removeChild(this._splitter);
this._nbox.removeChild(this._frame);
@ -395,10 +394,7 @@ RemoteDebuggerWindow.prototype = {
this.globalUI._remoteDebugger = this;
this._dbgwin = this.globalUI.chromeWindow.open(DBG_XUL,
L10N.getStr("remoteDebuggerWindowTitle"),
"width=" + Prefs.remoteWinWidth + "," +
"height=" + Prefs.remoteWinHeight + "," +
"chrome,dependent,resizable,centerscreen");
L10N.getStr("remoteDebuggerWindowTitle"), "chrome,dependent,resizable");
let self = this;
@ -426,6 +422,7 @@ RemoteDebuggerWindow.prototype = {
}
delete this.globalUI._remoteDebugger;
this._dbgwin.removeEventListener("Debugger:Unloaded", this.close, true);
this._dbgwin.close();
this._dbgwin = null;
this._win = null;
@ -496,15 +493,40 @@ ChromeDebuggerProcess.prototype = {
let profileService = Cc["@mozilla.org/toolkit/profile-service;1"]
.createInstance(Ci.nsIToolkitProfileService);
let dbgProfileName;
let profileName;
try {
dbgProfileName = profileService.selectedProfile.name + CHROME_DEBUGGER_PROFILE_NAME;
} catch(e) {
dbgProfileName = CHROME_DEBUGGER_PROFILE_NAME;
// Attempt to get the required chrome debugging profile name string.
profileName = profileService.selectedProfile.name + CHROME_DEBUGGER_PROFILE_NAME;
} catch (e) {
// Requested profile string could not be retrieved.
profileName = CHROME_DEBUGGER_PROFILE_NAME;
Cu.reportError(e);
}
this._dbgProfile = profileService.createProfile(null, null, dbgProfileName);
let profileObject;
try {
// Attempt to get the required chrome debugging profile toolkit object.
profileObject = profileService.getProfileByName(profileName);
// The profile exists but the corresponding folder may have been deleted.
var enumerator = Services.dirsvc.get("ProfD", Ci.nsIFile).parent.directoryEntries;
while (enumerator.hasMoreElements()) {
let profileDir = enumerator.getNext().QueryInterface(Ci.nsIFile);
if (profileDir.leafName.contains(profileName)) {
// Requested profile was found and the folder exists.
this._dbgProfile = profileObject;
return;
}
}
// Requested profile was found but the folder was deleted. Cleanup needed.
profileObject.remove(true);
} catch (e) {
// Requested profile object was not found.
Cu.reportError(e);
}
// Create a new chrome debugging profile.
this._dbgProfile = profileService.createProfile(null, null, profileName);
profileService.flush();
},
@ -523,9 +545,7 @@ ChromeDebuggerProcess.prototype = {
let args = [
"-no-remote", "-P", this._dbgProfile.name,
"-chrome", DBG_XUL,
"-width", Prefs.remoteWinWidth,
"-height", Prefs.remoteWinHeight];
"-chrome", DBG_XUL];
process.runwAsync(args, args.length, { observe: this.close.bind(this) });
this._dbgProcess = process;
@ -547,9 +567,6 @@ ChromeDebuggerProcess.prototype = {
if (this._dbgProcess.isRunning) {
this._dbgProcess.kill();
}
if (this._dbgProfile) {
this._dbgProfile.remove(false);
}
if (typeof this._closeCallback == "function") {
this._closeCallback.call({}, this);
}
@ -589,39 +606,17 @@ let Prefs = {
* Gets the preferred height of the debugger pane.
* @return number
*/
get height() {
if (this._height === undefined) {
this._height = Services.prefs.getIntPref("devtools.debugger.ui.height");
}
return this._height;
},
get height()
Services.prefs.getIntPref("devtools.debugger.ui.height"),
/**
* Sets the preferred height of the debugger pane.
* @param number value
* @param number aValue
*/
set height(value) {
Services.prefs.setIntPref("devtools.debugger.ui.height", value);
this._height = value;
}
set height(aValue)
Services.prefs.setIntPref("devtools.debugger.ui.height", aValue)
};
/**
* Gets the preferred width of the remote debugger window.
* @return number
*/
XPCOMUtils.defineLazyGetter(Prefs, "remoteWinWidth", function() {
return Services.prefs.getIntPref("devtools.debugger.ui.remote-win.width");
});
/**
* Gets the preferred height of the remote debugger window.
* @return number
*/
XPCOMUtils.defineLazyGetter(Prefs, "remoteWinHeight", function() {
return Services.prefs.getIntPref("devtools.debugger.ui.remote-win.height");
});
/**
* Gets the preferred default remote debugging host.
* @return string

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);
@ -1247,201 +1250,67 @@ XPCOMUtils.defineLazyGetter(L10N, "ellipsis", function() {
return Services.prefs.getComplexValue("intl.ellipsis", Ci.nsIPrefLocalizedString).data;
});
const STACKFRAMES_WIDTH = "devtools.debugger.ui.stackframes-width";
const VARIABLES_WIDTH = "devtools.debugger.ui.variables-width";
const PANES_VISIBLE_ON_STARTUP = "devtools.debugger.ui.panes-visible-on-startup";
const VARIABLES_NON_ENUM_VISIBLE = "devtools.debugger.ui.variables-non-enum-visible";
const VARIABLES_SEARCHBOX_VISIBLE = "devtools.debugger.ui.variables-searchbox-visible";
const REMOTE_HOST = "devtools.debugger.remote-host";
const REMOTE_PORT = "devtools.debugger.remote-port";
const REMOTE_AUTO_CONNECT = "devtools.debugger.remote-autoconnect";
const REMOTE_CONNECTION_RETRIES = "devtools.debugger.remote-connection-retries";
const REMOTE_TIMEOUT = "devtools.debugger.remote-timeout";
/**
* Shortcuts for accessing various debugger preferences.
*/
let Prefs = {
/**
* Gets the preferred stackframes pane width.
* @return number
* Helper method for getting a pref value.
*
* @param string aType
* @param string aPrefName
* @return any
*/
get stackframesWidth() {
if (this._stackframesWidth === undefined) {
this._stackframesWidth = Services.prefs.getIntPref(STACKFRAMES_WIDTH);
_get: function P__get(aType, aPrefName) {
if (this[aPrefName] === undefined) {
this[aPrefName] = Services.prefs["get" + aType + "Pref"](aPrefName);
}
return this._stackframesWidth;
return this[aPrefName];
},
/**
* Sets the preferred stackframes pane width.
* @param number value
* Helper method for setting a pref value.
*
* @param string aType
* @param string aPrefName
* @param any aValue
*/
set stackframesWidth(value) {
Services.prefs.setIntPref(STACKFRAMES_WIDTH, value);
this._stackframesWidth = value;
_set: function P__set(aType, aPrefName, aValue) {
Services.prefs["set" + aType + "Pref"](aPrefName, aValue);
this[aPrefName] = aValue;
},
/**
* Gets the preferred variables pane width.
* @return number
* Maps a property name to a pref, defining lazy getters and setters.
*
* @param string aType
* @param string aPropertyName
* @param string aPrefName
*/
get variablesWidth() {
if (this._variablesWidth === undefined) {
this._variablesWidth = Services.prefs.getIntPref(VARIABLES_WIDTH);
}
return this._variablesWidth;
},
/**
* Sets the preferred variables pane width.
* @param number value
*/
set variablesWidth(value) {
Services.prefs.setIntPref(VARIABLES_WIDTH, value);
this._variablesWidth = value;
},
/**
* Gets the preferred panes visibility state on startup.
* @return boolean
*/
get panesVisibleOnStartup() {
if (this._panesVisible === undefined) {
this._panesVisible = Services.prefs.getBoolPref(PANES_VISIBLE_ON_STARTUP);
}
return this._panesVisible;
},
/**
* Sets the preferred panes visibility state on startup.
* @param boolean value
*/
set panesVisibleOnStartup(value) {
Services.prefs.setBoolPref(PANES_VISIBLE_ON_STARTUP, value);
this._panesVisible = value;
},
/**
* Gets a flag specifying if the debugger should show non-enumerable
* properties and variables in the scope view.
* @return boolean
*/
get variablesNonEnumVisible() {
if (this._varNonEnum === undefined) {
this._varNonEnum = Services.prefs.getBoolPref(VARIABLES_NON_ENUM_VISIBLE);
}
return this._varNonEnum;
},
/**
* Sets a flag specifying if the debugger should show non-enumerable
* properties and variables in the scope view.
* @param boolean value
*/
set variablesNonEnumVisible(value) {
Services.prefs.setBoolPref(VARIABLES_NON_ENUM_VISIBLE, value);
this._varNonEnum = value;
},
/**
* Gets a flag specifying if the a variables searchbox should be shown.
* @return boolean
*/
get variablesSearchboxVisible() {
if (this._varSearchbox === undefined) {
this._varSearchbox = Services.prefs.getBoolPref(VARIABLES_SEARCHBOX_VISIBLE);
}
return this._varSearchbox;
},
/**
* Sets a flag specifying if the a variables searchbox should be shown.
* @param boolean value
*/
set variablesSearchboxVisible(value) {
Services.prefs.setBoolPref(VARIABLES_SEARCHBOX_VISIBLE, value);
this._varSearchbox = value;
},
/**
* Gets the preferred default remote debugging host.
* @return string
*/
get remoteHost() {
if (this._remoteHost === undefined) {
this._remoteHost = Services.prefs.getCharPref(REMOTE_HOST);
}
return this._remoteHost;
},
/**
* Sets the preferred default remote debugging host.
* @param string value
*/
set remoteHost(value) {
Services.prefs.setCharPref(REMOTE_HOST, value);
this._remoteHost = value;
},
/**
* Gets the preferred default remote debugging port.
* @return number
*/
get remotePort() {
if (this._remotePort === undefined) {
this._remotePort = Services.prefs.getIntPref(REMOTE_PORT);
}
return this._remotePort;
},
/**
* Sets the preferred default remote debugging port.
* @param number value
*/
set remotePort(value) {
Services.prefs.setIntPref(REMOTE_PORT, value);
this._remotePort = value;
},
/**
* Gets a flag specifying if the debugger should automatically connect to
* the default host and port number.
* @return boolean
*/
get remoteAutoConnect() {
if (this._autoConnect === undefined) {
this._autoConnect = Services.prefs.getBoolPref(REMOTE_AUTO_CONNECT);
}
return this._autoConnect;
},
/**
* Sets a flag specifying if the debugger should automatically connect to
* the default host and port number.
* @param boolean value
*/
set remoteAutoConnect(value) {
Services.prefs.setBoolPref(REMOTE_AUTO_CONNECT, value);
this._autoConnect = value;
map: function P_map(aType, aPropertyName, aPrefName) {
Object.defineProperty(this, aPropertyName, {
get: function() this._get(aType, aPrefName),
set: function(aValue) this._set(aType, aPrefName, aValue)
});
}
};
/**
* Gets the max number of attempts to reconnect to a remote server.
* @return number
*/
XPCOMUtils.defineLazyGetter(Prefs, "remoteConnectionRetries", function() {
return Services.prefs.getIntPref(REMOTE_CONNECTION_RETRIES);
});
/**
* Gets the remote debugging connection timeout (in milliseconds).
* @return number
*/
XPCOMUtils.defineLazyGetter(Prefs, "remoteTimeout", function() {
return Services.prefs.getIntPref(REMOTE_TIMEOUT);
});
Prefs.map("Int", "height", "devtools.debugger.ui.height");
Prefs.map("Int", "windowX", "devtools.debugger.ui.win-x");
Prefs.map("Int", "windowY", "devtools.debugger.ui.win-y");
Prefs.map("Int", "windowWidth", "devtools.debugger.ui.win-width");
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");
Prefs.map("Int", "remotePort", "devtools.debugger.remote-port");
Prefs.map("Bool", "remoteAutoConnect", "devtools.debugger.remote-autoconnect");
Prefs.map("Int", "remoteConnectionRetries", "devtools.debugger.remote-connection-retries");
Prefs.map("Int", "remoteTimeout", "devtools.debugger.remote-timeout");
/**
* Returns true if this is a remote debugger instance.

View File

@ -101,7 +101,10 @@ create({ constructor: StackFramesView, proto: MenuContainer.prototype }, {
*/
_onClick: function DVSF__onClick(e) {
let item = this.getItemForElement(e.target);
if (item) {
// The container is not empty and we clicked on an actual item.
DebuggerController.StackFrames.selectFrame(item.attachment.depth);
}
},
/**
@ -512,6 +515,10 @@ create({ constructor: BreakpointsView, proto: MenuContainer.prototype }, {
*/
_onClick: function DVB__onClick(e) {
let breakpointItem = this.getItemForElement(e.target);
if (!breakpointItem) {
// The container is empty or we didn't click on an actual item.
return;
}
let { sourceLocation: url, lineNumber: line } = breakpointItem.attachment;
DebuggerView.updateEditor(url, line, { noDebug: true });
@ -522,13 +529,17 @@ create({ constructor: BreakpointsView, proto: MenuContainer.prototype }, {
* The click listener for a breakpoint checkbox.
*/
_onCheckboxClick: function DVB__onCheckboxClick(e) {
let breakpointItem = this.getItemForElement(e.target);
if (!breakpointItem) {
// The container is empty or we didn't click on an actual item.
return;
}
let { sourceLocation: url, lineNumber: line, enabled } = breakpointItem.attachment;
// Don't update the editor location.
e.preventDefault();
e.stopPropagation();
let breakpointItem = this.getItemForElement(e.target);
let { sourceLocation: url, lineNumber: line, enabled } = breakpointItem.attachment;
this[enabled
? "disableBreakpoint"
: "enableBreakpoint"](url, line, { silent: true });

View File

@ -29,6 +29,10 @@ let DebuggerView = {
*/
initialize: function DV_initialize(aCallback) {
dumpn("Initializing the DebuggerView");
this._initializeWindow();
this._initializePanes();
this.Toolbar.initialize();
this.Options.initialize();
this.ChromeGlobals.initialize();
@ -46,8 +50,7 @@ let DebuggerView = {
this.Variables.eval = DebuggerController.StackFrames.evaluate;
this.Variables.lazyEmpty = true;
this._initializePanes();
this._initializeEditor(aCallback)
this._initializeEditor(aCallback);
},
/**
@ -58,6 +61,7 @@ let DebuggerView = {
*/
destroy: function DV_destroy(aCallback) {
dumpn("Destroying the DebuggerView");
this.Toolbar.destroy();
this.Options.destroy();
this.ChromeGlobals.destroy();
@ -67,11 +71,47 @@ let DebuggerView = {
this.Breakpoints.destroy();
this.GlobalSearch.destroy();
this._destroyWindow();
this._destroyPanes();
this._destroyEditor();
aCallback();
},
/**
* Initializes the UI for the window.
*/
_initializeWindow: function DV__initializeWindow() {
dumpn("Initializing the DebuggerView window");
let isRemote = window._isRemoteDebugger;
let isChrome = window._isChromeDebugger;
if (isRemote || isChrome) {
window.moveTo(Prefs.windowX, Prefs.windowY);
window.resizeTo(Prefs.windowWidth, Prefs.windowHeight);
if (isRemote) {
document.title = L10N.getStr("remoteDebuggerWindowTitle");
} else {
document.title = L10N.getStr("chromeDebuggerWindowTitle");
}
}
},
/**
* Destroys the UI for the window.
*/
_destroyWindow: function DV__initializeWindow() {
dumpn("Destroying the DebuggerView window");
if (window._isRemoteDebugger || window._isChromeDebugger) {
Prefs.windowX = window.screenX;
Prefs.windowY = window.screenY;
Prefs.windowWidth = window.outerWidth;
Prefs.windowHeight = window.outerHeight;
}
},
/**
* Initializes the UI for all the displayed panes.
*/

View File

@ -20,6 +20,32 @@ function test() {
gWindow = aWindow;
let gDebugger = gWindow.contentWindow;
info("Current remote window x: " +
Services.prefs.getIntPref("devtools.debugger.ui.win-x"));
info("Current remote window y: " +
Services.prefs.getIntPref("devtools.debugger.ui.win-y"));
info("Current remote window width: " +
Services.prefs.getIntPref("devtools.debugger.ui.win-width"));
info("Current remote window height: " +
Services.prefs.getIntPref("devtools.debugger.ui.win-height"));
is(gDebugger.Prefs.windowX,
Services.prefs.getIntPref("devtools.debugger.ui.win-x"),
"Current window x pref corresponds to the debugger pref.");
is(gDebugger.Prefs.windowY,
Services.prefs.getIntPref("devtools.debugger.ui.win-y"),
"Current window y pref corresponds to the debugger pref.");
is(gDebugger.Prefs.windowWidth,
Services.prefs.getIntPref("devtools.debugger.ui.win-width"),
"Current window width pref corresponds to the debugger pref.");
is(gDebugger.Prefs.windowHeight,
Services.prefs.getIntPref("devtools.debugger.ui.win-height"),
"Current window height pref corresponds to the debugger pref.");
info("Current remote host: " +
Services.prefs.getCharPref("devtools.debugger.remote-host"));
info("Current remote port: " +

View File

@ -9,7 +9,7 @@ const LAZY_EMPTY_DELAY = 150; // ms
Components.utils.import('resource://gre/modules/Services.jsm');
let EXPORTED_SYMBOLS = ["VariablesView", "create"];
this.EXPORTED_SYMBOLS = ["VariablesView", "create"];
/**
* A tree view for inspecting scopes, objects and properties.
@ -22,7 +22,7 @@ let EXPORTED_SYMBOLS = ["VariablesView", "create"];
* @param nsIDOMNode aParentNode
* The parent node to hold this view.
*/
function VariablesView(aParentNode) {
this.VariablesView = function VariablesView(aParentNode) {
this._store = new Map();
this._prevHierarchy = new Map();
this._currHierarchy = new Map();

View File

@ -19,6 +19,10 @@ confirmTabSwitch.buttonSwitch.accessKey=S
confirmTabSwitch.buttonOpen=Open anyway
confirmTabSwitch.buttonOpen.accessKey=O
# LOCALIZATION NOTE (chromeDebuggerWindowTitle): The title displayed for the
# chrome (browser) debugger window.
chromeDebuggerWindowTitle=Browser Debugger
# LOCALIZATION NOTE (remoteDebuggerWindowTitle): The title displayed for the
# remote debugger window.
remoteDebuggerWindowTitle=Remote Debugger

View File

@ -136,6 +136,7 @@
#stackframes {
background-color: white;
min-height: 30px;
}
.dbg-stackframe {
@ -154,6 +155,12 @@
#breakpoints {
background-color: white;
min-height: 30px;
}
#breakpoints > vbox:not(:empty) {
min-height: 30px;
max-height: 200px;
}
.dbg-breakpoint-info {

View File

@ -138,6 +138,7 @@
#stackframes {
background-color: white;
min-height: 30px;
}
.dbg-stackframe {
@ -156,6 +157,12 @@
#breakpoints {
background-color: white;
min-height: 30px;
}
#breakpoints > vbox:not(:empty) {
min-height: 30px;
max-height: 200px;
}
.dbg-breakpoint-info {

View File

@ -144,6 +144,7 @@
#stackframes {
background-color: white;
min-height: 30px;
}
.dbg-stackframe {
@ -162,6 +163,12 @@
#breakpoints {
background-color: white;
min-height: 30px;
}
#breakpoints > vbox:not(:empty) {
min-height: 30px;
max-height: 200px;
}
.dbg-breakpoint-info {