Bug 563562: Do not keep AddonInstall objects for restartless installs. r=robstrong

This commit is contained in:
Dave Townsend 2010-05-06 12:43:58 -07:00
Родитель 2839061c9b
Коммит 517c32e9e4
2 изменённых файлов: 30 добавлений и 21 удалений

Просмотреть файл

@ -3888,6 +3888,9 @@ AddonInstall.prototype = {
createWrapper(this.addon));
}
else {
// The install is completed so it should be removed from the active list
XPIProvider.removeActiveInstall(this);
// TODO We can probably reduce the number of DB operations going on here
// We probably also want to support rolling back failed upgrades etc.
// See bug 553015.

Просмотреть файл

@ -77,30 +77,36 @@ function run_test_1() {
}
function check_test_1() {
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);
do_check_eq(getStartupReason(), ADDON_INSTALL);
do_check_true(b1.hasResource("install.rdf"));
do_check_true(b1.hasResource("bootstrap.js"));
do_check_false(b1.hasResource("foo.bar"));
do_check_in_crash_annotation("bootstrap1@tests.mozilla.org", "1.0");
AddonManager.getAllInstalls(function(installs) {
// There should be no active installs now since the install completed and
// doesn't require a restart.
do_check_eq(installs.length, 0);
let dir = profileDir.clone();
dir.append("bootstrap1@tests.mozilla.org");
dir.append("bootstrap.js");
let uri = Services.io.newFileURI(dir).spec;
do_check_eq(b1.getResourceURL("bootstrap.js"), uri);
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);
do_check_eq(getStartupReason(), ADDON_INSTALL);
do_check_true(b1.hasResource("install.rdf"));
do_check_true(b1.hasResource("bootstrap.js"));
do_check_false(b1.hasResource("foo.bar"));
do_check_in_crash_annotation("bootstrap1@tests.mozilla.org", "1.0");
AddonManager.getAddonsWithOperationsByTypes(null, function(list) {
do_check_eq(list.length, 0);
let dir = profileDir.clone();
dir.append("bootstrap1@tests.mozilla.org");
dir.append("bootstrap.js");
let uri = Services.io.newFileURI(dir).spec;
do_check_eq(b1.getResourceURL("bootstrap.js"), uri);
run_test_2();
AddonManager.getAddonsWithOperationsByTypes(null, function(list) {
do_check_eq(list.length, 0);
run_test_2();
});
});
});
}