зеркало из https://github.com/mozilla/gecko-dev.git
bug 858868 fix xpcshell test bug and social pref migration. r=markh
This commit is contained in:
Родитель
2fba4d6fe1
Коммит
f989524a41
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче