mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 865798 add timestamps to social provider install for proper fhr support, r-felipe
This commit is contained in:
parent
fb39cef48e
commit
a9a7e40c63
@ -57,6 +57,8 @@ function installListener(next, aManifest) {
|
||||
},
|
||||
onInstalled: function(addon) {
|
||||
is(addon.manifest.origin, aManifest.origin, "provider installed");
|
||||
ok(addon.installDate.getTime() > 0, "addon has installDate");
|
||||
ok(addon.updateDate.getTime() > 0, "addon has updateDate");
|
||||
ok(Services.prefs.prefHasUserValue(prefname), "manifest is in user-prefs");
|
||||
expectEvent = "onUninstalling";
|
||||
},
|
||||
|
@ -135,8 +135,10 @@ function migrateSettings() {
|
||||
// ensure any *builtin* provider in activeproviders is in user level prefs
|
||||
for (let origin in ActiveProviders._providers) {
|
||||
let prefname;
|
||||
let manifest;
|
||||
try {
|
||||
prefname = getPrefnameFromOrigin(origin);
|
||||
manifest = JSON.parse(Services.prefs.getComplexValue(prefname, Ci.nsISupportsString).data);
|
||||
} catch(e) {
|
||||
// Our preference is missing or bad, remove from ActiveProviders and
|
||||
// continue. This is primarily an error-case and should only be
|
||||
@ -146,21 +148,14 @@ function migrateSettings() {
|
||||
ActiveProviders.flush();
|
||||
continue;
|
||||
}
|
||||
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;
|
||||
try {
|
||||
manifest = JSON.parse(Services.prefs.getComplexValue(prefname, Ci.nsISupportsString).data);
|
||||
} catch(e) {
|
||||
// see comment in the delete/flush code above.
|
||||
ActiveProviders.delete(origin);
|
||||
ActiveProviders.flush();
|
||||
continue;
|
||||
}
|
||||
// our default manifests have been updated with the builtin flags as of
|
||||
// fx22, delete it so we can set the user-pref
|
||||
if (!manifest.updateDate) {
|
||||
// the provider was installed with an older build, so we will update the
|
||||
// timestamp and ensure the manifest is in user prefs
|
||||
delete manifest.builtin;
|
||||
if (!manifest.updateDate) {
|
||||
manifest.updateDate = Date.now();
|
||||
manifest.installDate = 0; // we don't know when it was installed
|
||||
}
|
||||
|
||||
let string = Cc["@mozilla.org/supports-string;1"].
|
||||
createInstance(Ci.nsISupportsString);
|
||||
@ -196,6 +191,10 @@ function migrateSettings() {
|
||||
// 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;
|
||||
if (!manifest.updateDate) {
|
||||
manifest.updateDate = Date.now();
|
||||
manifest.installDate = 0; // we don't know when it was installed
|
||||
}
|
||||
|
||||
let string = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
|
||||
string.data = JSON.stringify(manifest);
|
||||
@ -836,6 +835,14 @@ function getPrefnameFromOrigin(origin) {
|
||||
}
|
||||
|
||||
function AddonInstaller(sourceURI, aManifest, installCallback) {
|
||||
aManifest.updateDate = Date.now();
|
||||
// get the existing manifest for installDate
|
||||
let manifest = SocialServiceInternal.getManifestByOrigin(aManifest.origin);
|
||||
if (manifest && manifest.installDate)
|
||||
aManifest.installDate = manifest.installDate;
|
||||
else
|
||||
aManifest.installDate = aManifest.updateDate;
|
||||
|
||||
this.sourceURI = sourceURI;
|
||||
this.install = function() {
|
||||
let addon = this.addon;
|
||||
|
@ -48,4 +48,9 @@ function testMigration(manifest, next) {
|
||||
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);
|
||||
|
||||
let userPref = JSON.parse(MANIFEST_PREFS.getCharPref(manifest.origin));
|
||||
do_check_true(parseInt(userPref.updateDate) > 0);
|
||||
// migrated providers wont have an installDate
|
||||
do_check_true(userPref.installDate === 0);
|
||||
}
|
||||
|
@ -60,6 +60,11 @@ function testMigration(manifest, next) {
|
||||
do_check_true(MANIFEST_PREFS.prefHasUserValue(manifest.origin));
|
||||
do_check_true(JSON.parse(DEFAULT_PREFS.getCharPref(manifest.origin)).builtin);
|
||||
|
||||
let userPref = JSON.parse(MANIFEST_PREFS.getCharPref(manifest.origin));
|
||||
do_check_true(parseInt(userPref.updateDate) > 0);
|
||||
// migrated providers wont have an installDate
|
||||
do_check_true(userPref.installDate === 0);
|
||||
|
||||
// bug 859715, this should have been removed during migration
|
||||
do_check_false(!!activeProviders["bad.origin"]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user