Backed out changeset 06cc2ca85b6c from bug 596336 due to test failures. a=keeping the approval hook happy

This commit is contained in:
Dave Townsend 2010-10-11 17:21:22 -07:00
parent 3688e026d9
commit 45a044f833
3 changed files with 3 additions and 221 deletions

View File

@ -1537,8 +1537,6 @@ var XPIProvider = {
newAddon = loadManifestFromZipFile(file);
else
newAddon = loadManifestFromDir(file);
// Carry over the userDisabled setting for add-ons that just appeared
newAddon.userDisabled = aOldAddon.userDisabled;
}
// The ID in the manifest that was loaded must match the ID of the old
@ -3938,6 +3936,7 @@ var XPIDatabase = {
// Any errors in here should rollback the transaction
try {
this.removeAddonMetadata(aOldAddon);
aNewAddon.userDisabled = aOldAddon.userDisabled;
aNewAddon.installDate = aOldAddon.installDate;
aNewAddon.applyBackgroundUpdates = aOldAddon.applyBackgroundUpdates;
this.addAddonMetadata(aNewAddon, aDescriptor);
@ -4219,8 +4218,6 @@ function AddonInstall(aCallback, aInstallLocation, aUrl, aHash, aName, aType,
this.loadManifest(function() {
XPIDatabase.getVisibleAddonForID(self.addon.id, function(aAddon) {
self.existingAddon = aAddon;
if (aAddon)
self.addon.userDisabled = aAddon.userDisabled;
self.addon.updateDate = Date.now();
self.addon.installDate = aAddon ? aAddon.installDate : self.addon.updateDate;
@ -4869,8 +4866,6 @@ AddonInstall.prototype = {
let self = this;
XPIDatabase.getVisibleAddonForID(this.addon.id, function(aAddon) {
self.existingAddon = aAddon;
if (aAddon)
self.addon.userDisabled = aAddon.userDisabled;
self.addon.updateDate = Date.now();
self.addon.installDate = aAddon ? aAddon.installDate : self.addon.updateDate;
self.state = AddonManager.STATE_DOWNLOADED;

View File

@ -637,79 +637,8 @@ function run_test_14() {
});
}
// Tests that upgrading a disabled bootstrapped extension still calls uninstall
// and install but doesn't startup the new version
function run_test_15() {
installAllFiles([do_get_addon("test_bootstrap1_1")], function() {
AddonManager.getAddonByID("bootstrap1@tests.mozilla.org", function(b1) {
do_check_neq(b1, null);
do_check_eq(b1.version, "1.0");
do_check_false(b1.appDisabled);
do_check_false(b1.userDisabled);
do_check_true(b1.isActive);
do_check_eq(getInstalledVersion(), 1);
do_check_eq(getActiveVersion(), 1);
b1.userDisabled = true;
do_check_false(b1.isActive);
do_check_eq(getInstalledVersion(), 1);
do_check_eq(getActiveVersion(), 0);
prepare_test({ }, [
"onNewInstall"
]);
AddonManager.getInstallForFile(do_get_addon("test_bootstrap1_2"), function(install) {
ensure_test_completed();
do_check_neq(install, null);
do_check_true(install.addon.userDisabled);
prepare_test({
"bootstrap1@tests.mozilla.org": [
["onInstalling", false],
"onInstalled"
]
}, [
"onInstallStarted",
"onInstallEnded",
], check_test_15);
install.install();
});
});
});
}
function check_test_15() {
AddonManager.getAddonByID("bootstrap1@tests.mozilla.org", function(b1) {
do_check_neq(b1, null);
do_check_eq(b1.version, "2.0");
do_check_false(b1.appDisabled);
do_check_true(b1.userDisabled);
do_check_false(b1.isActive);
do_check_eq(getInstalledVersion(), 2);
do_check_eq(getActiveVersion(), 0);
restartManager();
AddonManager.getAddonByID("bootstrap1@tests.mozilla.org", function(b1) {
do_check_neq(b1, null);
do_check_eq(b1.version, "2.0");
do_check_false(b1.appDisabled);
do_check_true(b1.userDisabled);
do_check_false(b1.isActive);
do_check_eq(getInstalledVersion(), 2);
do_check_eq(getActiveVersion(), 0);
b1.uninstall();
run_test_16();
});
});
}
// Tests that bootstrapped extensions don't get loaded when in safe mode
function run_test_16() {
function run_test_15() {
installAllFiles([do_get_addon("test_bootstrap1_1")], function() {
AddonManager.getAddonByID("bootstrap1@tests.mozilla.org", function(b1) {
// Should have installed and started

View File

@ -947,149 +947,7 @@ function check_test_13(install) {
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
do_check_eq(a2.version, "2.0");
a2.uninstall();
restartManager();
run_test_14();
end_test();
});
});
}
// Verify that the userDisabled value carries over to the upgrade by default
function run_test_14() {
let url = "http://localhost:4444/addons/test_install2_1.xpi";
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.addListener({
onInstallStarted: function() {
do_check_false(aInstall.addon.userDisabled);
aInstall.addon.userDisabled = true;
},
onInstallEnded: function() {
restartManager();
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
do_check_true(a2.userDisabled);
do_check_false(a2.isActive);
let url = "http://localhost:4444/addons/test_install2_2.xpi";
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.addListener({
onInstallEnded: function() {
do_check_true(aInstall.addon.userDisabled);
restartManager();
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
do_check_true(a2.userDisabled);
do_check_false(a2.isActive);
a2.uninstall();
restartManager();
run_test_15();
});
}
});
aInstall.install();
}, "application/x-xpinstall");
});
}
});
aInstall.install();
}, "application/x-xpinstall");
}
// Verify that changing the userDisabled value before onInstallEnded works
function run_test_15() {
let url = "http://localhost:4444/addons/test_install2_1.xpi";
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.addListener({
onInstallEnded: function() {
do_check_false(aInstall.addon.userDisabled);
restartManager();
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
do_check_false(a2.userDisabled);
do_check_true(a2.isActive);
let url = "http://localhost:4444/addons/test_install2_2.xpi";
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.addListener({
onInstallStarted: function() {
do_check_false(aInstall.addon.userDisabled);
aInstall.addon.userDisabled = true;
},
onInstallEnded: function() {
restartManager();
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
do_check_true(a2.userDisabled);
do_check_false(a2.isActive);
a2.uninstall();
restartManager();
run_test_16();
});
}
});
aInstall.install();
}, "application/x-xpinstall");
});
}
});
aInstall.install();
}, "application/x-xpinstall");
}
// Verify that changing the userDisabled value before onInstallEnded works
function run_test_16() {
let url = "http://localhost:4444/addons/test_install2_1.xpi";
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.addListener({
onInstallStarted: function() {
do_check_false(aInstall.addon.userDisabled);
aInstall.addon.userDisabled = true;
},
onInstallEnded: function() {
restartManager();
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
do_check_true(a2.userDisabled);
do_check_false(a2.isActive);
let url = "http://localhost:4444/addons/test_install2_2.xpi";
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.addListener({
onInstallStarted: function() {
do_check_true(aInstall.addon.userDisabled);
aInstall.addon.userDisabled = false;
},
onInstallEnded: function() {
restartManager();
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
do_check_false(a2.userDisabled);
do_check_true(a2.isActive);
a2.uninstall();
restartManager();
end_test();
});
}
});
aInstall.install();
}, "application/x-xpinstall");
});
}
});
aInstall.install();
}, "application/x-xpinstall");
}