diff --git a/toolkit/mozapps/extensions/addonManager.js b/toolkit/mozapps/extensions/addonManager.js index d6de223eb4d..43c797502b0 100644 --- a/toolkit/mozapps/extensions/addonManager.js +++ b/toolkit/mozapps/extensions/addonManager.js @@ -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; diff --git a/toolkit/mozapps/extensions/test/xpinstall/browser_enabled3.js b/toolkit/mozapps/extensions/test/xpinstall/browser_enabled3.js index f195e0fedea..0895f576857 100644 --- a/toolkit/mozapps/extensions/test/xpinstall/browser_enabled3.js +++ b/toolkit/mozapps/extensions/test/xpinstall/browser_enabled3.js @@ -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(); } // ----------------------------------------------------------------------------