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.
1 // ----------------------------------------------------------------------------
2 // Tests installing an add-on from a local file with whitelisting disabled.
3 // This should be blocked by the whitelist check.
4 function test() {
5 Harness.installBlockedCallback = allow_blocked;
6 Harness.installsCompletedCallback = finish_test;
7 Harness.setup();
9 // Disable direct request whitelisting, installing from file should be blocked.
10 Services.prefs.setBoolPref("xpinstall.whitelist.directRequest", false);
12 var cr = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
13 .getService(Components.interfaces.nsIChromeRegistry);
15 var chromeroot = extractChromeRoot(gTestPath);
16 try {
17 var xpipath = cr.convertChromeURL(makeURI(chromeroot + "unsigned.xpi")).spec;
18 } catch (ex) {
19 var xpipath = chromeroot + "unsigned.xpi"; //scenario where we are running from a .jar and already extracted
20 }
21 gBrowser.selectedTab = gBrowser.addTab();
22 gBrowser.loadURI(xpipath);
23 }
25 function allow_blocked(installInfo) {
26 ok(true, "Seen blocked");
27 return false;
28 }
30 function finish_test(count) {
31 is(count, 0, "No add-ons should have been installed");
33 Services.prefs.clearUserPref("xpinstall.whitelist.directRequest");
35 gBrowser.removeCurrentTab();
36 Harness.finish();
37 }