Bug 561878: xpinstall.enabled isn't properly blocking installation by webpages. r=robstrong

This commit is contained in:
Dave Townsend 2010-04-29 13:11:28 -07:00
parent 6b67506d41
commit 6c117ba932
2 changed files with 17 additions and 2 deletions

View File

@ -100,6 +100,9 @@ amManager.prototype = {
if (aUris.length == 0)
return false;
if (!AddonManager.isInstallEnabled(aMimetype))
return false;
let retval = true;
if (!AddonManager.isInstallAllowed(aMimetype, aReferer)) {
aCallback = null;

View File

@ -1,7 +1,9 @@
// ----------------------------------------------------------------------------
// Test whether an InstallTrigger.install call fails when xpinstall is disabled
function test() {
waitForExplicitFinish();
Harness.installBlockedCallback = allow_blocked;
Harness.installConfirmCallback = confirm_install;
Harness.setup();
Services.prefs.setBoolPref("xpinstall.enabled", false);
@ -17,12 +19,22 @@ function test() {
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
}
function allow_blocked(installInfo) {
ok(false, "Should never see the blocked install notification");
return false;
}
function confirm_install(window) {
ok(false, "Should never see an install confirmation dialog");
return false;
}
function page_loaded() {
Services.prefs.clearUserPref("xpinstall.enabled");
var doc = gBrowser.contentDocument;
is(doc.getElementById("return").textContent, "false", "installTrigger should have not been enabled");
gBrowser.removeCurrentTab();
finish();
Harness.finish();
}
// ----------------------------------------------------------------------------