mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 564030: Updating an add-on that is incompatible to a version that is compatible requires more restarts. r=robstrong
This commit is contained in:
parent
bc100d717d
commit
253ae29fe0
@ -2320,7 +2320,7 @@ var XPIDatabase = {
|
||||
":maxVersion)",
|
||||
|
||||
clearVisibleAddons: "UPDATE addon SET visible=0 WHERE id=:id",
|
||||
deactivateThemes: "UPDATE addon SET active=:active WHERE " +
|
||||
updateAddonActive: "UPDATE addon SET active=:active WHERE " +
|
||||
"internal_id=:internal_id",
|
||||
|
||||
getActiveAddons: "SELECT " + FIELDS_ADDON + " FROM addon WHERE active=1 AND " +
|
||||
@ -3079,6 +3079,9 @@ var XPIDatabase = {
|
||||
return row;
|
||||
}
|
||||
|
||||
aAddon.active = (aAddon.visible && !aAddon.userDisabled &&
|
||||
!aAddon.appDisabled);
|
||||
|
||||
if (aAddon.visible) {
|
||||
let stmt = this.getStatement("clearVisibleAddons");
|
||||
stmt.params.id = aAddon.id;
|
||||
@ -3097,8 +3100,7 @@ var XPIDatabase = {
|
||||
"bootstrap"].forEach(function(aProp) {
|
||||
stmt.params[aProp] = aAddon[aProp] ? 1 : 0;
|
||||
});
|
||||
stmt.params.active = (aAddon.visible && !aAddon.userDisabled &&
|
||||
!aAddon.appDisabled) ? 1 : 0;
|
||||
stmt.params.active = aAddon.active ? 1 : 0;
|
||||
stmt.execute();
|
||||
let internal_id = this.connection.lastInsertRowID;
|
||||
|
||||
@ -3236,7 +3238,7 @@ var XPIDatabase = {
|
||||
updateAddonActive: function XPIDB_updateAddonActive(aAddon) {
|
||||
LOG("Updating add-on state");
|
||||
|
||||
stmt = this.getStatement("deactivateThemes");
|
||||
stmt = this.getStatement("updateAddonActive");
|
||||
stmt.params.internal_id = aAddon._internal_id;
|
||||
stmt.params.active = aAddon.active ? 1 : 0;
|
||||
stmt.execute();
|
||||
|
65
toolkit/mozapps/extensions/test/xpcshell/test_bug564030.js
Normal file
65
toolkit/mozapps/extensions/test/xpcshell/test_bug564030.js
Normal file
@ -0,0 +1,65 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Tests that upgrading an incompatible add-on to a compatible one forces an
|
||||
// EM restart
|
||||
|
||||
const profileDir = gProfD.clone();
|
||||
profileDir.append("extensions");
|
||||
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "1.9.2");
|
||||
|
||||
dest = profileDir.clone();
|
||||
dest.append("addon1@tests.mozilla.org");
|
||||
writeInstallRDFToDir({
|
||||
id: "addon1@tests.mozilla.org",
|
||||
version: "1.0",
|
||||
name: "Test",
|
||||
targetApplications: [{
|
||||
id: "xpcshell@tests.mozilla.org",
|
||||
minVersion: "1",
|
||||
maxVersion: "1"
|
||||
}]
|
||||
}, dest);
|
||||
// Attempt to make this look like it was added some time in the past so
|
||||
// the update makes the last modified time change.
|
||||
dest.lastModifiedTime -= 5000;
|
||||
|
||||
startupManager(1);
|
||||
|
||||
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a) {
|
||||
do_check_neq(a, null);
|
||||
do_check_eq(a.version, "1.0");
|
||||
do_check_false(a.userDisabled);
|
||||
do_check_true(a.appDisabled);
|
||||
do_check_false(a.isActive);
|
||||
do_check_false(isExtensionInAddonsList(profileDir, a.id));
|
||||
|
||||
writeInstallRDFToDir({
|
||||
id: "addon1@tests.mozilla.org",
|
||||
version: "2.0",
|
||||
name: "Test",
|
||||
targetApplications: [{
|
||||
id: "xpcshell@tests.mozilla.org",
|
||||
minVersion: "1",
|
||||
maxVersion: "2"
|
||||
}]
|
||||
}, dest);
|
||||
|
||||
restartManager(1);
|
||||
|
||||
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a) {
|
||||
do_check_neq(a, null);
|
||||
do_check_eq(a.version, "2.0");
|
||||
do_check_false(a.userDisabled);
|
||||
do_check_false(a.appDisabled);
|
||||
do_check_true(a.isActive);
|
||||
do_check_true(isExtensionInAddonsList(profileDir, a.id));
|
||||
|
||||
do_test_finished();
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user