Bug 518077 - Add custom settings for "sign in" to set things like server url
authorEdward Lee <edilee@mozilla.com>
Tue, 22 Sep 2009 01:00:43 -0700
changeset 45769 23355b9604c6a942e029c667a7c9b1ccfbb00fbb
parent 45768 f7494a72e424ddf75bd3fe48e9811b79bf4e6680
child 45770 b4d9f0ec3ddeaf697c42566f6dca31477b3d97c1
push id14033
push useredward.lee@engineering.uiuc.edu
push dateWed, 23 Jun 2010 22:21:35 +0000
treeherdermozilla-central@227db4ad8cdf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs518077
Bug 518077 - Add custom settings for "sign in" to set things like server url Provide an initial implementation to read and set preferences: autoconnect, serverURL. For now show them in a "Custom settings" expando tab like the one for create account, but the styling isn't great.
services/sync/modules/service.js
--- a/services/sync/modules/service.js
+++ b/services/sync/modules/service.js
@@ -210,17 +210,25 @@ WeaveSvc.prototype = {
 
   get password password() ID.get("WeaveID").password,
   set password password(value) ID.get("WeaveID").password = value,
 
   get passphrase passphrase() ID.get("WeaveCryptoID").password,
   set passphrase passphrase(value) ID.get("WeaveCryptoID").password = value,
 
   get serverURL() Svc.Prefs.get("serverURL"),
-  set serverURL(value) Svc.Prefs.set("serverURL", value),
+  set serverURL(value) {
+    // Only do work if it's actually changing
+    if (value == this.serverURL)
+      return;
+    
+    // A new server most likely uses a different cluster, so clear that
+    Svc.Prefs.set("serverURL", value);
+    Svc.Prefs.reset("clusterURL");
+  },
 
   get clusterURL() Svc.Prefs.get("clusterURL", ""),
   set clusterURL(value) {
     Svc.Prefs.set("clusterURL", value);
     this._updateCachedURLs();
   },
 
   get miscAPI() {