Bug 579779: Installing a new theme should mark it to be enabled. r=robstrong

This commit is contained in:
Dave Townsend 2010-08-13 10:47:17 -07:00
parent d1e7808a06
commit 77af6a588c
5 changed files with 40 additions and 1 deletions

View File

@ -750,7 +750,7 @@ const gXPInstallObserver = {
PopupNotifications.remove(notification);
var needsRestart = installInfo.installs.some(function(i) {
return (i.addon.pendingOperations & AddonManager.PENDING_INSTALL) != 0;
return i.addon.pendingOperations != AddonManager.PENDING_NONE;
});
if (needsRestart) {

View File

@ -406,6 +406,36 @@ function test_reload() {
gBrowser.loadURI(TESTROOT2 + "enabled.html");
});
});
},
function test_theme() {
var pm = Services.perms;
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
var triggers = encodeURIComponent(JSON.stringify({
"Theme XPI": "theme.xpi"
}));
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
// Wait for the install confirmation dialog
wait_for_install_dialog(function(aWindow) {
aWindow.document.documentElement.acceptDialog();
// Wait for the complete notification
wait_for_notification(function(aPanel) {
let notification = aPanel.childNodes[0];
is(notification.id, "addon-install-complete", "Should have seen the install complete");
is(notification.button.label, "Restart Now", "Should have seen the right button");
is(notification.getAttribute("label"),
"Theme Test will be installed after you restart " + gApp + ".",
"Should have seen the right message");
gBrowser.removeTab(gBrowser.selectedTab);
Services.perms.remove("example.com", "install");
runNextTest();
});
});
}
];

View File

@ -253,6 +253,14 @@ Installer.prototype = {
onInstallEnded: function(aInstall) {
aInstall.removeListener(this);
this.installed.push(aInstall);
// If installing a theme that is disabled and can be enabled then enable it
if (aInstall.addon.type == "theme" &&
aInstall.addon.userDisabled == true &&
aInstall.addon.appDisabled == false) {
aInstall.addon.userDisabled = false;
}
this.checkAllInstalled();
}
};

View File

@ -91,6 +91,7 @@ _BROWSER_FILES = head.js \
signed-no-cn.xpi \
signed-untrusted.xpi \
signed-tampered.xpi \
theme.xpi \
restartless.xpi \
incompatible.xpi \
empty.xpi \

Binary file not shown.