Skip to content

Commit

Permalink
Bug 579779: Installing a new theme should mark it to be enabled. r=ro…
Browse files Browse the repository at this point in the history
…bstrong
  • Loading branch information
Mossop committed Aug 13, 2010
1 parent 443698d commit 6b4bdba
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion browser/base/content/browser.js
Expand Up @@ -750,7 +750,7 @@ const gXPInstallObserver = {
PopupNotifications.remove(notification); PopupNotifications.remove(notification);


var needsRestart = installInfo.installs.some(function(i) { var needsRestart = installInfo.installs.some(function(i) {
return (i.addon.pendingOperations & AddonManager.PENDING_INSTALL) != 0; return i.addon.pendingOperations != AddonManager.PENDING_NONE;
}); });


if (needsRestart) { if (needsRestart) {
Expand Down
30 changes: 30 additions & 0 deletions browser/base/content/test/browser_bug553455.js
Expand Up @@ -406,6 +406,36 @@ function test_reload() {
gBrowser.loadURI(TESTROOT2 + "enabled.html"); 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();
});
});
} }
]; ];


Expand Down
8 changes: 8 additions & 0 deletions toolkit/mozapps/extensions/amWebInstallListener.js
Expand Up @@ -253,6 +253,14 @@ Installer.prototype = {
onInstallEnded: function(aInstall) { onInstallEnded: function(aInstall) {
aInstall.removeListener(this); aInstall.removeListener(this);
this.installed.push(aInstall); 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(); this.checkAllInstalled();
} }
}; };
Expand Down
1 change: 1 addition & 0 deletions toolkit/mozapps/extensions/test/xpinstall/Makefile.in
Expand Up @@ -91,6 +91,7 @@ _BROWSER_FILES = head.js \
signed-no-cn.xpi \ signed-no-cn.xpi \
signed-untrusted.xpi \ signed-untrusted.xpi \
signed-tampered.xpi \ signed-tampered.xpi \
theme.xpi \
restartless.xpi \ restartless.xpi \
incompatible.xpi \ incompatible.xpi \
empty.xpi \ empty.xpi \
Expand Down
Binary file added toolkit/mozapps/extensions/test/xpinstall/theme.xpi
Binary file not shown.

0 comments on commit 6b4bdba

Please sign in to comment.