зеркало из 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 (!Services.prefs.prefHasUserValue(prefname)) {
|
||||||
// if we've got an active *builtin* provider, ensure that the pref
|
// if we've got an active *builtin* provider, ensure that the pref
|
||||||
// is set at a user-level as that will signify *installed* status.
|
// is set at a user-level as that will signify *installed* status.
|
||||||
let manifest = JSON.parse(MANIFEST_PREFS.getComplexValue(prefname, Ci.nsISupportsString).data);
|
let manifest = JSON.parse(Services.prefs.getComplexValue(prefname, Ci.nsISupportsString).data);
|
||||||
// ensure we override a builtin manifest by having a different value in it
|
// our default manifests have been updated with the builtin flags as of
|
||||||
if (manifest.builtin)
|
// fx22, delete it so we can set the user-pref
|
||||||
delete manifest.builtin;
|
delete manifest.builtin;
|
||||||
|
|
||||||
let string = Cc["@mozilla.org/supports-string;1"].
|
let string = Cc["@mozilla.org/supports-string;1"].
|
||||||
createInstance(Ci.nsISupportsString);
|
createInstance(Ci.nsISupportsString);
|
||||||
|
@ -169,12 +169,14 @@ function migrateSettings() {
|
||||||
try {
|
try {
|
||||||
let manifest = JSON.parse(manifestPrefs.getComplexValue(pref, Ci.nsISupportsString).data);
|
let manifest = JSON.parse(manifestPrefs.getComplexValue(pref, Ci.nsISupportsString).data);
|
||||||
if (manifest && typeof(manifest) == "object" && manifest.origin) {
|
if (manifest && typeof(manifest) == "object" && manifest.origin) {
|
||||||
// ensure we override a builtin manifest by having a different value in it
|
// our default manifests have been updated with the builtin flags as of
|
||||||
if (manifest.builtin)
|
// fx22, delete it so we can set the user-pref
|
||||||
delete manifest.builtin;
|
delete manifest.builtin;
|
||||||
|
|
||||||
let string = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
|
let string = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
|
||||||
string.data = JSON.stringify(manifest);
|
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.add(manifest.origin);
|
||||||
ActiveProviders.flush();
|
ActiveProviders.flush();
|
||||||
// social.active was used at a time that there was only one
|
// social.active was used at a time that there was only one
|
||||||
|
|
|
@ -16,6 +16,7 @@ function run_test() {
|
||||||
let manifest = { // normal provider
|
let manifest = { // normal provider
|
||||||
name: "provider 1",
|
name: "provider 1",
|
||||||
origin: "https://example1.com",
|
origin: "https://example1.com",
|
||||||
|
builtin: true // as of fx22 this should be true for default prefs
|
||||||
};
|
};
|
||||||
|
|
||||||
DEFAULT_PREFS.setCharPref(manifest.origin, JSON.stringify(manifest));
|
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
|
// we should be set as a user level pref after migration
|
||||||
do_check_false(MANIFEST_PREFS.prefHasUserValue(manifest.origin));
|
do_check_false(MANIFEST_PREFS.prefHasUserValue(manifest.origin));
|
||||||
// we need to access the providers for everything to initialize
|
// we need to access the providers for everything to initialize
|
||||||
SocialService.getProviderList(function(providers) {
|
yield SocialService.getProviderList(next);
|
||||||
do_check_true(SocialService.enabled);
|
do_check_true(SocialService.enabled);
|
||||||
do_check_true(Services.prefs.prefHasUserValue("social.activeProviders"));
|
do_check_true(Services.prefs.prefHasUserValue("social.activeProviders"));
|
||||||
|
|
||||||
let activeProviders;
|
let activeProviders;
|
||||||
let pref = Services.prefs.getComplexValue("social.activeProviders",
|
let pref = Services.prefs.getComplexValue("social.activeProviders",
|
||||||
Ci.nsISupportsString);
|
Ci.nsISupportsString);
|
||||||
activeProviders = JSON.parse(pref);
|
activeProviders = JSON.parse(pref);
|
||||||
do_check_true(activeProviders.has(manifest.origin));
|
do_check_true(activeProviders[manifest.origin]);
|
||||||
do_check_true(MANIFEST_PREFS.prefHasUserValue(manifest.origin));
|
do_check_true(MANIFEST_PREFS.prefHasUserValue(manifest.origin));
|
||||||
});
|
do_check_true(JSON.parse(DEFAULT_PREFS.getCharPref(manifest.origin)).builtin);
|
||||||
yield true;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ function run_test() {
|
||||||
let manifest = { // normal provider
|
let manifest = { // normal provider
|
||||||
name: "provider 1",
|
name: "provider 1",
|
||||||
origin: "https://example1.com",
|
origin: "https://example1.com",
|
||||||
|
builtin: true // as of fx22 this should be true for default prefs
|
||||||
};
|
};
|
||||||
|
|
||||||
DEFAULT_PREFS.setCharPref(manifest.origin, JSON.stringify(manifest));
|
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
|
// we should be set as a user level pref after migration
|
||||||
do_check_false(MANIFEST_PREFS.prefHasUserValue(manifest.origin));
|
do_check_false(MANIFEST_PREFS.prefHasUserValue(manifest.origin));
|
||||||
// we need to access the providers for everything to initialize
|
// we need to access the providers for everything to initialize
|
||||||
SocialService.getProviderList(function(providers) {
|
yield SocialService.getProviderList(next);
|
||||||
do_check_true(SocialService.enabled);
|
do_check_true(SocialService.enabled);
|
||||||
do_check_true(Services.prefs.prefHasUserValue("social.activeProviders"));
|
do_check_true(Services.prefs.prefHasUserValue("social.activeProviders"));
|
||||||
|
|
||||||
let activeProviders;
|
let activeProviders;
|
||||||
let pref = Services.prefs.getComplexValue("social.activeProviders",
|
let pref = Services.prefs.getComplexValue("social.activeProviders",
|
||||||
Ci.nsISupportsString);
|
Ci.nsISupportsString);
|
||||||
activeProviders = JSON.parse(pref);
|
activeProviders = JSON.parse(pref);
|
||||||
do_check_true(activeProviders.has(manifest.origin));
|
do_check_true(activeProviders[manifest.origin]);
|
||||||
do_check_true(MANIFEST_PREFS.prefHasUserValue(manifest.origin));
|
do_check_true(MANIFEST_PREFS.prefHasUserValue(manifest.origin));
|
||||||
});
|
do_check_true(JSON.parse(DEFAULT_PREFS.getCharPref(manifest.origin)).builtin);
|
||||||
yield true;
|
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче