Bug 940936 - Use profile name in registry sync prefs for WindowsPrefSync.jsm. r=jimm

This commit is contained in:
Brian R. Bondy 2013-12-02 09:58:26 -05:00
Родитель 49b31cb685
Коммит 82c49a0793
1 изменённых файлов: 11 добавлений и 3 удалений

Просмотреть файл

@ -71,6 +71,15 @@ this.WindowsPrefSync = {
"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.
@ -112,8 +121,7 @@ this.WindowsPrefSync = {
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);
@ -131,7 +139,7 @@ this.WindowsPrefSync = {
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);