Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // ---------------------------------------------------------------------------- |
michael@0 | 2 | // Tests installing an unsigned add-on through a direct install request from |
michael@0 | 3 | // web content. This should be blocked by the whitelist check because we disable |
michael@0 | 4 | // direct request whitelisting, even though the target URI is whitelisted. |
michael@0 | 5 | function test() { |
michael@0 | 6 | Harness.installBlockedCallback = allow_blocked; |
michael@0 | 7 | Harness.installsCompletedCallback = finish_test; |
michael@0 | 8 | Harness.setup(); |
michael@0 | 9 | |
michael@0 | 10 | // Disable direct request whitelisting, installing should be blocked. |
michael@0 | 11 | Services.prefs.setBoolPref("xpinstall.whitelist.directRequest", false); |
michael@0 | 12 | |
michael@0 | 13 | gBrowser.selectedTab = gBrowser.addTab(); |
michael@0 | 14 | gBrowser.loadURI(TESTROOT + "unsigned.xpi"); |
michael@0 | 15 | } |
michael@0 | 16 | |
michael@0 | 17 | function allow_blocked(installInfo) { |
michael@0 | 18 | ok(true, "Seen blocked"); |
michael@0 | 19 | return false; |
michael@0 | 20 | } |
michael@0 | 21 | |
michael@0 | 22 | function finish_test(count) { |
michael@0 | 23 | is(count, 0, "No add-ons should have been installed"); |
michael@0 | 24 | |
michael@0 | 25 | Services.perms.remove("example.org", "install"); |
michael@0 | 26 | Services.prefs.clearUserPref("xpinstall.whitelist.directRequest"); |
michael@0 | 27 | |
michael@0 | 28 | gBrowser.removeCurrentTab(); |
michael@0 | 29 | Harness.finish(); |
michael@0 | 30 | } |