Bug 790556 - Remember last IP address for remote debugger, r=past

This commit is contained in:
Victor Porof 2012-10-26 23:28:54 +03:00
parent 8cbc3880fc
commit 3035f3e884
2 changed files with 86 additions and 39 deletions

View File

@ -1201,9 +1201,9 @@ 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 NON_ENUM_VISIBLE = "devtools.debugger.ui.non-enum-visible";
const REMOTE_AUTO_CONNECT = "devtools.debugger.remote-autoconnect";
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";
@ -1251,28 +1251,6 @@ let Prefs = {
this._variablesWidth = 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;
},
/**
* Gets the preferred panes visibility state on startup.
* @return boolean
@ -1313,25 +1291,71 @@ let Prefs = {
set nonEnumVisible(value) {
Services.prefs.setBoolPref(NON_ENUM_VISIBLE, value);
this._nonEnumVisible = 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;
}
};
/**
* Gets the preferred default remote debugging host.
* @return string
*/
XPCOMUtils.defineLazyGetter(Prefs, "remoteHost", function() {
return Services.prefs.getCharPref(REMOTE_HOST);
});
/**
* Gets the preferred default remote debugging port.
* @return number
*/
XPCOMUtils.defineLazyGetter(Prefs, "remotePort", function() {
return Services.prefs.getIntPref(REMOTE_PORT);
});
/**
* Gets the max number of attempts to reconnect to a remote server.
* @return number

View File

@ -24,11 +24,34 @@ function test() {
Services.prefs.getCharPref("devtools.debugger.remote-host"));
info("Current remote port: " +
Services.prefs.getIntPref("devtools.debugger.remote-port"));
info("Current remote retries: " +
Services.prefs.getIntPref("devtools.debugger.remote-connection-retries"));
info("Current remote timeout: " +
Services.prefs.getIntPref("devtools.debugger.remote-timeout"));
info("Current autoconnect flag: " +
Services.prefs.getBoolPref("devtools.debugger.remote-autoconnect"));
is(gDebugger.Prefs.remoteHost,
Services.prefs.getCharPref("devtools.debugger.remote-host"),
"Current remote host corresponds to the debugger pref.");
is(gDebugger.Prefs.remotePort,
Services.prefs.getIntPref("devtools.debugger.remote-port"),
"Current remote port corresponds to the debugger pref.");
is(gDebugger.Prefs.remoteConnectionRetries,
Services.prefs.getIntPref("devtools.debugger.remote-connection-retries"),
"Current remote retries corresponds to the debugger pref.");
is(gDebugger.Prefs.remoteTimeout,
Services.prefs.getIntPref("devtools.debugger.remote-timeout"),
"Current remote timeout corresponds to the debugger pref.");
is(gDebugger.Prefs.remoteAutoConnect,
Services.prefs.getBoolPref("devtools.debugger.remote-autoconnect"),
"Current autoconnect flag corresponds to the debugger pref.");
is(gDebugger.document.getElementById("close").getAttribute("hidden"), "true",
"The close button should be hidden in a remote debugger.");