michael@0: // ---------------------------------------------------------------------------- michael@0: // Tests installing an add-on from a local file with whitelisting disabled. michael@0: // This should be blocked by the whitelist check. michael@0: function test() { michael@0: Harness.installBlockedCallback = allow_blocked; michael@0: Harness.installsCompletedCallback = finish_test; michael@0: Harness.setup(); michael@0: michael@0: // Disable direct request whitelisting, installing from file should be blocked. michael@0: Services.prefs.setBoolPref("xpinstall.whitelist.directRequest", false); michael@0: michael@0: var cr = Components.classes["@mozilla.org/chrome/chrome-registry;1"] michael@0: .getService(Components.interfaces.nsIChromeRegistry); michael@0: michael@0: var chromeroot = extractChromeRoot(gTestPath); michael@0: try { michael@0: var xpipath = cr.convertChromeURL(makeURI(chromeroot + "unsigned.xpi")).spec; michael@0: } catch (ex) { michael@0: var xpipath = chromeroot + "unsigned.xpi"; //scenario where we are running from a .jar and already extracted michael@0: } michael@0: gBrowser.selectedTab = gBrowser.addTab(); michael@0: gBrowser.loadURI(xpipath); michael@0: } michael@0: michael@0: function allow_blocked(installInfo) { michael@0: ok(true, "Seen blocked"); michael@0: return false; michael@0: } michael@0: michael@0: function finish_test(count) { michael@0: is(count, 0, "No add-ons should have been installed"); michael@0: michael@0: Services.prefs.clearUserPref("xpinstall.whitelist.directRequest"); michael@0: michael@0: gBrowser.removeCurrentTab(); michael@0: Harness.finish(); michael@0: }