change prefs to live under extensions.weave
authorDan Mills <thunder@mozilla.com>
Thu, 20 Dec 2007 14:46:12 -0800
changeset 44316 3cfe8ac88102b737d5298efceae4418eb013a5ca
parent 44315 0aad59235c5ca0eb371ba9133d80d236ce0ecaae
child 44317 f77b99e334d2633bcb048d17806292f9b0e85cd5
child 44318 c318464d72f28ac527fdcd8ebde2f2fc3fb57b69
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
change prefs to live under extensions.weave
services/sync/modules/constants.js
services/sync/modules/crypto.js
services/sync/modules/service.js
services/sync/services-sync.js
--- a/services/sync/modules/constants.js
+++ b/services/sync/modules/constants.js
@@ -29,29 +29,33 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-const EXPORTED_SYMBOLS = ['MODE_RDONLY', 'MODE_WRONLY',
+const EXPORTED_SYMBOLS = ['WEAVE_VERSION', 'STORAGE_FORMAT_VERSION',
+			  'PREFS_PRANCH',
+			  'MODE_RDONLY', 'MODE_WRONLY',
 			  'MODE_CREATE', 'MODE_APPEND', 'MODE_TRUNCATE',
 			  'PERMS_FILE', 'PERMS_DIRECTORY',
-			  'STORAGE_FORMAT_VERSION',
 			  'ONE_BYTE', 'ONE_KILOBYTE', 'ONE_MEGABYTE'];
 
+const WEAVE_VERSION = "0.1.12.7";
+const STORAGE_FORMAT_VERSION = 2;
+
+const PREFS_BRANCH = "extensions.weave.";
+
 const MODE_RDONLY   = 0x01;
 const MODE_WRONLY   = 0x02;
 const MODE_CREATE   = 0x08;
 const MODE_APPEND   = 0x10;
 const MODE_TRUNCATE = 0x20;
 
 const PERMS_FILE      = 0644;
 const PERMS_DIRECTORY = 0755;
 
-const STORAGE_FORMAT_VERSION = 2;
-
 const ONE_BYTE = 1;
 const ONE_KILOBYTE = 1024 * ONE_BYTE;
 const ONE_MEGABYTE = 1024 * ONE_KILOBYTE;
 
--- a/services/sync/modules/crypto.js
+++ b/services/sync/modules/crypto.js
@@ -70,57 +70,57 @@ WeaveCrypto.prototype = {
       this.__xxxteaLoaded = true;
     }
     return this.__xxxtea;
   },
 
   get defaultAlgorithm() {
     let branch = Cc["@mozilla.org/preferences-service;1"]
       .getService(Ci.nsIPrefBranch);
-    return branch.getCharPref("browser.places.sync.encryption");
+    return branch.getCharPref("extensions.weave.encryption");
   },
   set defaultAlgorithm(value) {
     let branch = Cc["@mozilla.org/preferences-service;1"]
       .getService(Ci.nsIPrefBranch);
-    let cur = branch.getCharPref("browser.places.sync.encryption");
+    let cur = branch.getCharPref("extensions.weave.encryption");
     if (value != cur)
-      branch.setCharPref("browser.places.sync.encryption", value);
+      branch.setCharPref("extensions.weave.encryption", value);
   },
 
   _init: function Crypto__init() {
     this._log = Log4Moz.Service.getLogger("Service." + this._logName);
     let branch = Cc["@mozilla.org/preferences-service;1"]
       .getService(Ci.nsIPrefBranch2);
-    branch.addObserver("browser.places.sync.encryption", this, false);
+    branch.addObserver("extensions.weave.encryption", this, false);
   },
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupports]),
 
   // nsIObserver
 
   observe: function Sync_observe(subject, topic, data) {
     switch (topic) {
-    case "browser.places.sync.encryption":
+    case "extensions.weave.encryption":
       let branch = Cc["@mozilla.org/preferences-service;1"]
         .getService(Ci.nsIPrefBranch);
 
-      let cur = branch.getCharPref("browser.places.sync.encryption");
+      let cur = branch.getCharPref("extensions.weave.encryption");
       if (cur == data)
 	return;
 
       switch (data) {
       case "none":
         this._log.info("Encryption disabled");
         break;
       case "XXXTEA":
         this._log.info("Using encryption algorithm: " + data);
         break;
       default:
 	this._log.warn("Unknown encryption algorithm, resetting");
-	branch.setCharPref("browser.places.sync.encryption", "XXXTEA");
+	branch.setCharPref("extensions.weave.encryption", "XXXTEA");
 	return; // otherwise we'll send the alg changed event twice
       }
       // FIXME: listen to this bad boy somewhere
       this._os.notifyObservers(null, "weave:encryption:algorithm-changed", "");
       break;
     default:
       this._log.warn("Unknown encryption preference changed - ignoring");
     }
--- a/services/sync/modules/service.js
+++ b/services/sync/modules/service.js
@@ -119,25 +119,25 @@ WeaveSyncService.prototype = {
       this.__cryptoId = new Identity('Mozilla Services Encryption Passphrase',
 				     this.username);
     return this.__cryptoId;
   },
 
   get username() {
     let branch = Cc["@mozilla.org/preferences-service;1"]
       .getService(Ci.nsIPrefBranch);
-    return branch.getCharPref("browser.places.sync.username");
+    return branch.getCharPref("extensions.weave.username");
   },
   set username(value) {
     let branch = Cc["@mozilla.org/preferences-service;1"]
       .getService(Ci.nsIPrefBranch);
     if (value)
-      branch.setCharPref("browser.places.sync.username", value);
+      branch.setCharPref("extensions.weave.username", value);
     else
-      branch.clearUserPref("browser.places.sync.username");
+      branch.clearUserPref("extensions.weave.username");
 
     // fixme - need to loop over all Identity objects - needs some rethinking...
     this._mozId.username = value;
     this._cryptoId.username = value;
   },
 
   get password() { return this._mozId.password; },
   set password(value) { this._mozId.password = value; },
@@ -182,21 +182,21 @@ WeaveSyncService.prototype = {
 
     this._serverURL = 'https://services.mozilla.com/';
     this._user = '';
     let enabled = false;
     let schedule = 0;
     try {
       let branch = Cc["@mozilla.org/preferences-service;1"].
         getService(Ci.nsIPrefBranch2);
-      this._serverURL = branch.getCharPref("browser.places.sync.serverURL");
-      enabled = branch.getBoolPref("browser.places.sync.enabled");
-      schedule = branch.getIntPref("browser.places.sync.schedule");
+      this._serverURL = branch.getCharPref("extensions.weave.serverURL");
+      enabled = branch.getBoolPref("extensions.weave.enabled");
+      schedule = branch.getIntPref("extensions.weave.schedule");
 
-      branch.addObserver("browser.places.sync", this, false);
+      branch.addObserver("extensions.weave", this, false);
     }
     catch (ex) { /* use defaults */ }
 
     if (!enabled) {
       this._log.info("Bookmarks sync disabled");
       return;
     }
 
@@ -443,29 +443,29 @@ WeaveSyncService.prototype = {
   },
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupports]),
 
   // nsIObserver
 
   observe: function WeaveSync__observe(subject, topic, data) {
     switch (topic) {
-    case "browser.places.sync.enabled":
+    case "extensions.weave.enabled":
       switch (data) {
       case false:
         this._log.info("Disabling automagic bookmarks sync");
         this._disableSchedule();
         break;
       case true:
         this._log.info("Enabling automagic bookmarks sync");
         this._enableSchedule();
         break;
       }
       break;
-    case "browser.places.sync.schedule":
+    case "extensions.weave.schedule":
       switch (data) {
       case 0:
         this._log.info("Disabling automagic bookmarks sync");
         this._disableSchedule();
         break;
       case 1:
         this._log.info("Enabling automagic bookmarks sync");
         this._enableSchedule();
--- a/services/sync/services-sync.js
+++ b/services/sync/services-sync.js
@@ -1,9 +1,9 @@
-pref("browser.places.sync.serverURL", "https://services.mozilla.com/");
-pref("browser.places.sync.username", "nobody@mozilla.com");
-pref("browser.places.sync.rememberpassword", true);
-pref("browser.places.sync.autoconnect", true);
-pref("browser.places.sync.enabled", true);
-pref("browser.places.sync.bookmarks", true);
-pref("browser.places.sync.schedule", 1);
-pref("browser.places.sync.lastsync", "0");
-pref("browser.places.sync.encryption", "XXXTEA");
+pref("extensions.weave.serverURL", "https://services.mozilla.com/");
+pref("extensions.weave.username", "nobody@mozilla.com");
+pref("extensions.weave.rememberpassword", true);
+pref("extensions.weave.autoconnect", true);
+pref("extensions.weave.enabled", true);
+pref("extensions.weave.bookmarks", true);
+pref("extensions.weave.schedule", 1);
+pref("extensions.weave.lastsync", "0");
+pref("extensions.weave.encryption", "XXXTEA");