Bug 790556 - Remember last IP address for remote debugger, r=past
authorVictor Porof <vporof@mozilla.com>
Fri, 26 Oct 2012 23:28:54 +0300
changeset 111644 275f82501a03e545668d0a14e87075818121a664
parent 111643 3f97424506bda958ed64e704fbc03fe054a0fc45
child 111645 86defc974ef8ade2f2bd5dd2f7757b9afa96b165
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewerspast
bugs790556
milestone19.0a1
Bug 790556 - Remember last IP address for remote debugger, r=past
browser/devtools/debugger/debugger-controller.js
browser/devtools/debugger/test/browser_dbg_createRemote.js
--- a/browser/devtools/debugger/debugger-controller.js
+++ b/browser/devtools/debugger/debugger-controller.js
@@ -1196,19 +1196,19 @@ XPCOMUtils.defineLazyGetter(L10N, "strin
 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 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";
 
 /**
  * Shortcuts for accessing various debugger preferences.
  */
 let Prefs = {
   /**
@@ -1247,38 +1247,16 @@ let Prefs = {
    * @param number value
    */
   set variablesWidth(value) {
     Services.prefs.setIntPref(VARIABLES_WIDTH, value);
     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
    */
   get panesVisibleOnStartup() {
     if (this._panesVisible === undefined) {
       this._panesVisible = Services.prefs.getBoolPref(PANES_VISIBLE_ON_STARTUP);
     }
     return this._panesVisible;
@@ -1308,36 +1286,82 @@ let Prefs = {
   /**
    * Sets a flag specifying if the debugger should show non-enumerable
    * properties and variables in the scope view.
    * @param boolean value
    */
   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
  */
 XPCOMUtils.defineLazyGetter(Prefs, "remoteConnectionRetries", function() {
   return Services.prefs.getIntPref(REMOTE_CONNECTION_RETRIES);
 });
 
 /**
--- a/browser/devtools/debugger/test/browser_dbg_createRemote.js
+++ b/browser/devtools/debugger/test/browser_dbg_createRemote.js
@@ -19,21 +19,44 @@ function test() {
     gTab = aTab;
     gWindow = aWindow;
     let gDebugger = gWindow.contentWindow;
 
     info("Current remote host: " +
       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.");
 
     is(gDebugger.DebuggerController.activeThread.paused, false,
       "Should be running after debug_remote.");
 
     gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
       Services.tm.currentThread.dispatch({ run: function() {