|
1 // ---------------------------------------------------------------------------- |
|
2 // Tests installing an unsigned add-on through an InstallTrigger call in web |
|
3 // content. This should be blocked by the whitelist check because the source |
|
4 // is not whitelisted, even though the target is. |
|
5 function test() { |
|
6 Harness.installBlockedCallback = allow_blocked; |
|
7 Harness.installsCompletedCallback = finish_test; |
|
8 Harness.setup(); |
|
9 |
|
10 var pm = Services.perms; |
|
11 pm.add(makeURI("http://example.org/"), "install", pm.ALLOW_ACTION); |
|
12 |
|
13 var triggers = encodeURIComponent(JSON.stringify({ |
|
14 "Unsigned XPI": TESTROOT2 + "unsigned.xpi" |
|
15 })); |
|
16 gBrowser.selectedTab = gBrowser.addTab(); |
|
17 gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers); |
|
18 } |
|
19 |
|
20 function allow_blocked(installInfo) { |
|
21 is(installInfo.originatingWindow, gBrowser.contentWindow, "Install should have been triggered by the right window"); |
|
22 is(installInfo.originatingURI.spec, gBrowser.currentURI.spec, "Install should have been triggered by the right uri"); |
|
23 return false; |
|
24 } |
|
25 |
|
26 function finish_test() { |
|
27 Services.perms.remove("example.org", "install"); |
|
28 |
|
29 gBrowser.removeCurrentTab(); |
|
30 Harness.finish(); |
|
31 } |