|
1 // ---------------------------------------------------------------------------- |
|
2 // Tests installing a signed add-on that has been tampered with after signing. |
|
3 function test() { |
|
4 Harness.installConfirmCallback = confirm_install; |
|
5 Harness.downloadFailedCallback = download_failed; |
|
6 Harness.installsCompletedCallback = finish_test; |
|
7 Harness.setup(); |
|
8 |
|
9 var pm = Services.perms; |
|
10 pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION); |
|
11 |
|
12 var triggers = encodeURIComponent(JSON.stringify({ |
|
13 "Tampered Signed XPI": TESTROOT + "signed-tampered.xpi" |
|
14 })); |
|
15 gBrowser.selectedTab = gBrowser.addTab(); |
|
16 gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers); |
|
17 } |
|
18 |
|
19 function confirm_install(window) { |
|
20 ok(false, "Should not offer to install"); |
|
21 } |
|
22 |
|
23 function download_failed(install) { |
|
24 is(install.error, AddonManager.ERROR_CORRUPT_FILE, "Install should fail"); |
|
25 } |
|
26 |
|
27 function finish_test(count) { |
|
28 is(count, 0, "No add-ons should have been installed"); |
|
29 Services.perms.remove("example.com", "install"); |
|
30 |
|
31 gBrowser.removeCurrentTab(); |
|
32 Harness.finish(); |
|
33 } |