blob: 3fe8fb2e724b5423c0bf20fd0cfae15ed2c8c5f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
// ----------------------------------------------------------------------------
// Tests installing an unsigned add-on through an InstallTrigger call in web
// content. This should be blocked by the origin allow check.
// This verifies bug 645699
function test() {
// This test depends on InstallTrigger.install availability.
setInstallTriggerPrefs();
Harness.installConfirmCallback = confirm_install;
Harness.installBlockedCallback = allow_blocked;
Harness.installsCompletedCallback = finish_test;
// Prevent the Harness from ending the test on download cancel.
Harness.downloadCancelledCallback = () => {
return false;
};
Harness.setup();
PermissionTestUtils.add(
"http://example.org/",
"install",
Services.perms.ALLOW_ACTION
);
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
BrowserTestUtils.loadURI(gBrowser, TESTROOT + "bug645699.html");
}
function allow_blocked(installInfo) {
is(
installInfo.browser,
gBrowser.selectedBrowser,
"Install should have been triggered by the right browser"
);
is(
installInfo.originatingURI.spec,
gBrowser.currentURI.spec,
"Install should have been triggered by the right uri"
);
return false;
}
function confirm_install(panel) {
ok(false, "Should not see the install dialog");
return false;
}
function finish_test(count) {
is(count, 0, "0 Add-ons should have been successfully installed");
PermissionTestUtils.remove("http://example.org/", "install");
gBrowser.removeCurrentTab();
Harness.finish();
}
// ----------------------------------------------------------------------------
|