diff --git a/browser/devtools/debugger/debugger-controller.js b/browser/devtools/debugger/debugger-controller.js index b85ee5c31afb..251a38203057 100644 --- a/browser/devtools/debugger/debugger-controller.js +++ b/browser/devtools/debugger/debugger-controller.js @@ -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 diff --git a/browser/devtools/debugger/test/browser_dbg_createRemote.js b/browser/devtools/debugger/test/browser_dbg_createRemote.js index bc4a84fd71f4..ca5ed4fcd992 100644 --- a/browser/devtools/debugger/test/browser_dbg_createRemote.js +++ b/browser/devtools/debugger/test/browser_dbg_createRemote.js @@ -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.");