1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/mozapps/extensions/test/xpinstall/browser_whitelist7.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,30 @@ 1.4 +// ---------------------------------------------------------------------------- 1.5 +// Tests installing an unsigned add-on through a direct install request from 1.6 +// web content. This should be blocked by the whitelist check because we disable 1.7 +// direct request whitelisting, even though the target URI is whitelisted. 1.8 +function test() { 1.9 + Harness.installBlockedCallback = allow_blocked; 1.10 + Harness.installsCompletedCallback = finish_test; 1.11 + Harness.setup(); 1.12 + 1.13 + // Disable direct request whitelisting, installing should be blocked. 1.14 + Services.prefs.setBoolPref("xpinstall.whitelist.directRequest", false); 1.15 + 1.16 + gBrowser.selectedTab = gBrowser.addTab(); 1.17 + gBrowser.loadURI(TESTROOT + "unsigned.xpi"); 1.18 +} 1.19 + 1.20 +function allow_blocked(installInfo) { 1.21 + ok(true, "Seen blocked"); 1.22 + return false; 1.23 +} 1.24 + 1.25 +function finish_test(count) { 1.26 + is(count, 0, "No add-ons should have been installed"); 1.27 + 1.28 + Services.perms.remove("example.org", "install"); 1.29 + Services.prefs.clearUserPref("xpinstall.whitelist.directRequest"); 1.30 + 1.31 + gBrowser.removeCurrentTab(); 1.32 + Harness.finish(); 1.33 +}