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
Родитель d10111676b
Коммит c927f73498
2 изменённых файлов: 17 добавлений и 2 удалений

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

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

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

@ -1,7 +1,9 @@
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Test whether an InstallTrigger.install call fails when xpinstall is disabled // Test whether an InstallTrigger.install call fails when xpinstall is disabled
function test() { function test() {
waitForExplicitFinish(); Harness.installBlockedCallback = allow_blocked;
Harness.installConfirmCallback = confirm_install;
Harness.setup();
Services.prefs.setBoolPref("xpinstall.enabled", false); Services.prefs.setBoolPref("xpinstall.enabled", false);
@ -17,12 +19,22 @@ function test() {
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers); 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() { function page_loaded() {
Services.prefs.clearUserPref("xpinstall.enabled"); Services.prefs.clearUserPref("xpinstall.enabled");
var doc = gBrowser.contentDocument; var doc = gBrowser.contentDocument;
is(doc.getElementById("return").textContent, "false", "installTrigger should have not been enabled"); is(doc.getElementById("return").textContent, "false", "installTrigger should have not been enabled");
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();
finish(); Harness.finish();
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------