Bug 940936 - Use profile name in registry sync prefs for WindowsPrefSync.jsm. r=jimm
authorBrian R. Bondy <netzen@gmail.com>
Mon, 02 Dec 2013 09:58:26 -0500
changeset 174080 efd16375788e362ae5e48d7abcbeae005921ce7d
parent 174079 fc259acf93e343e8f611aad77c8fde7dfeb8c746
child 174081 e20c9dd37a86fe074f02e3d688bedf050e54f647
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs940936
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 940936 - Use profile name in registry sync prefs for WindowsPrefSync.jsm. r=jimm
toolkit/modules/WindowsPrefSync.jsm
--- a/toolkit/modules/WindowsPrefSync.jsm
+++ b/toolkit/modules/WindowsPrefSync.jsm
@@ -67,16 +67,25 @@ this.WindowsPrefSync = {
    */
   desktopControlledPrefs: ["app.update.auto",
     "app.update.enabled",
     "app.update.service.enabled",
     "app.update.metro.enabled",
     "browser.sessionstore.resume_session_once"],
 
   /**
+   * Returns the base path where registry sync prefs are stored.
+   */
+  get prefRegistryPath() {
+    let profileService = Cc["@mozilla.org/toolkit/profile-service;1"].
+      createInstance(Ci.nsIToolkitProfileService);
+    return PREF_BASE_KEY + profileService.selectedProfile.name + "\\";
+  },
+
+  /**
    * The following preferences will be pushed to registry from Metro
    * Firefox and pulled in from Desktop Firefox.
    *
    * browser.sessionstore.resume_session_once is mainly for the switch to Metro
    * and switch to Desktop feature.
    */
   metroControlledPrefs: ["browser.sessionstore.resume_session_once"],
 
@@ -107,18 +116,17 @@ this.WindowsPrefSync = {
         prefFunc = "getBoolPref";
       else if (prefType == Ci.nsIPrefBranch.PREF_STRING)
         prefFunc = "getCharPref";
       else
         throw "Unsupported pref type";
 
       let prefValue = Services.prefs[prefFunc](aPrefName);
       registry.create(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
-        PREF_BASE_KEY + prefType,
-        Ci.nsIWindowsRegKey.ACCESS_WRITE);
+        this.prefRegistryPath + prefType, Ci.nsIWindowsRegKey.ACCESS_WRITE);
       // Always write as string, but the registry subfolder will determine
       // how Metro interprets that string value.
       registry.writeStringValue(aPrefName, prefValue);
     } catch (ex) {
       Cu.reportError("Couldn't push pref " + aPrefName + ": " + ex);
     } finally {
       registry.close();
     }
@@ -126,17 +134,17 @@ this.WindowsPrefSync = {
 
   /**
    * Pulls in all shared prefs from the registry
    */
   pullSharedPrefs: function() {
     function pullSharedPrefType(prefType, prefFunc) {
       try {
         registry.create(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
-          PREF_BASE_KEY + prefType,
+          self.prefRegistryPath + prefType,
           Ci.nsIWindowsRegKey.ACCESS_ALL);
         for (let i = 0; i < registry.valueCount; i++) {
           let prefName = registry.getValueName(i);
           let prefValue = registry.readStringValue(prefName);
           if (prefType == Ci.nsIPrefBranch.PREF_BOOL) {
             prefValue = prefValue == "true";
           }
           if (self.prefListToPull.indexOf(prefName) != -1) {