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