diff --git a/toolkit/components/social/SocialService.jsm b/toolkit/components/social/SocialService.jsm index 837d7f6f723c..29a1b88f7b35 100644 --- a/toolkit/components/social/SocialService.jsm +++ b/toolkit/components/social/SocialService.jsm @@ -139,10 +139,10 @@ function migrateSettings() { if (!Services.prefs.prefHasUserValue(prefname)) { // if we've got an active *builtin* provider, ensure that the pref // is set at a user-level as that will signify *installed* status. - let manifest = JSON.parse(MANIFEST_PREFS.getComplexValue(prefname, Ci.nsISupportsString).data); - // ensure we override a builtin manifest by having a different value in it - if (manifest.builtin) - delete manifest.builtin; + let manifest = JSON.parse(Services.prefs.getComplexValue(prefname, Ci.nsISupportsString).data); + // our default manifests have been updated with the builtin flags as of + // fx22, delete it so we can set the user-pref + delete manifest.builtin; let string = Cc["@mozilla.org/supports-string;1"]. createInstance(Ci.nsISupportsString); @@ -169,12 +169,14 @@ function migrateSettings() { try { let manifest = JSON.parse(manifestPrefs.getComplexValue(pref, Ci.nsISupportsString).data); if (manifest && typeof(manifest) == "object" && manifest.origin) { - // ensure we override a builtin manifest by having a different value in it - if (manifest.builtin) - delete manifest.builtin; + // our default manifests have been updated with the builtin flags as of + // fx22, delete it so we can set the user-pref + delete manifest.builtin; + let string = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString); string.data = JSON.stringify(manifest); - Services.prefs.setComplexValue(pref, Ci.nsISupportsString, string); + // pref here is just the branch name, set the full pref name + Services.prefs.setComplexValue("social.manifest." + pref, Ci.nsISupportsString, string); ActiveProviders.add(manifest.origin); ActiveProviders.flush(); // social.active was used at a time that there was only one diff --git a/toolkit/components/social/test/xpcshell/test_SocialServiceMigration21.js b/toolkit/components/social/test/xpcshell/test_SocialServiceMigration21.js index 7fb798e49d42..678715d91251 100644 --- a/toolkit/components/social/test/xpcshell/test_SocialServiceMigration21.js +++ b/toolkit/components/social/test/xpcshell/test_SocialServiceMigration21.js @@ -16,6 +16,7 @@ function run_test() { let manifest = { // normal provider name: "provider 1", origin: "https://example1.com", + builtin: true // as of fx22 this should be true for default prefs }; DEFAULT_PREFS.setCharPref(manifest.origin, JSON.stringify(manifest)); @@ -36,16 +37,15 @@ function testMigration(manifest, next) { // we should be set as a user level pref after migration do_check_false(MANIFEST_PREFS.prefHasUserValue(manifest.origin)); // we need to access the providers for everything to initialize - SocialService.getProviderList(function(providers) { - do_check_true(SocialService.enabled); - do_check_true(Services.prefs.prefHasUserValue("social.activeProviders")); + yield SocialService.getProviderList(next); + do_check_true(SocialService.enabled); + do_check_true(Services.prefs.prefHasUserValue("social.activeProviders")); - let activeProviders; - let pref = Services.prefs.getComplexValue("social.activeProviders", - Ci.nsISupportsString); - activeProviders = JSON.parse(pref); - do_check_true(activeProviders.has(manifest.origin)); - do_check_true(MANIFEST_PREFS.prefHasUserValue(manifest.origin)); - }); - yield true; + let activeProviders; + let pref = Services.prefs.getComplexValue("social.activeProviders", + Ci.nsISupportsString); + activeProviders = JSON.parse(pref); + do_check_true(activeProviders[manifest.origin]); + do_check_true(MANIFEST_PREFS.prefHasUserValue(manifest.origin)); + do_check_true(JSON.parse(DEFAULT_PREFS.getCharPref(manifest.origin)).builtin); } diff --git a/toolkit/components/social/test/xpcshell/test_SocialServiceMigration22.js b/toolkit/components/social/test/xpcshell/test_SocialServiceMigration22.js index 37047cc8ebdb..b36489c729ba 100644 --- a/toolkit/components/social/test/xpcshell/test_SocialServiceMigration22.js +++ b/toolkit/components/social/test/xpcshell/test_SocialServiceMigration22.js @@ -16,6 +16,7 @@ function run_test() { let manifest = { // normal provider name: "provider 1", origin: "https://example1.com", + builtin: true // as of fx22 this should be true for default prefs }; DEFAULT_PREFS.setCharPref(manifest.origin, JSON.stringify(manifest)); @@ -45,16 +46,15 @@ function testMigration(manifest, next) { // we should be set as a user level pref after migration do_check_false(MANIFEST_PREFS.prefHasUserValue(manifest.origin)); // we need to access the providers for everything to initialize - SocialService.getProviderList(function(providers) { - do_check_true(SocialService.enabled); - do_check_true(Services.prefs.prefHasUserValue("social.activeProviders")); + yield SocialService.getProviderList(next); + do_check_true(SocialService.enabled); + do_check_true(Services.prefs.prefHasUserValue("social.activeProviders")); - let activeProviders; - let pref = Services.prefs.getComplexValue("social.activeProviders", - Ci.nsISupportsString); - activeProviders = JSON.parse(pref); - do_check_true(activeProviders.has(manifest.origin)); - do_check_true(MANIFEST_PREFS.prefHasUserValue(manifest.origin)); - }); - yield true; + let activeProviders; + let pref = Services.prefs.getComplexValue("social.activeProviders", + Ci.nsISupportsString); + activeProviders = JSON.parse(pref); + do_check_true(activeProviders[manifest.origin]); + do_check_true(MANIFEST_PREFS.prefHasUserValue(manifest.origin)); + do_check_true(JSON.parse(DEFAULT_PREFS.getCharPref(manifest.origin)).builtin); }