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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const TEST_ORIGIN = "https://example.com";
/* Verifies that items on the page info page are properly disabled
when the corresponding policies are locked */
add_task(async function test_pageinfo_permissions() {
await setupPolicyEngineWithJson({
policies: {
Permissions: {
Camera: {
BlockNewRequests: true,
Locked: true,
},
Microphone: {
BlockNewRequests: true,
Locked: true,
},
Location: {
BlockNewRequests: true,
Locked: true,
},
Notifications: {
BlockNewRequests: true,
Locked: true,
},
VirtualReality: {
BlockNewRequests: true,
Locked: true,
},
Autoplay: {
Default: "block-audio",
Locked: true,
},
},
InstallAddonsPermission: {
Default: false,
},
PopupBlocking: {
Locked: true,
},
Cookies: {
Locked: true,
},
},
});
let permissions = [
"geo",
"autoplay-media",
"install",
"popup",
"desktop-notification",
"cookie",
"camera",
"microphone",
"xr",
];
await BrowserTestUtils.withNewTab(TEST_ORIGIN, async function (browser) {
let pageInfo = BrowserPageInfo(TEST_ORIGIN, "permTab");
await BrowserTestUtils.waitForEvent(pageInfo, "load");
for (let i = 0; i < permissions.length; i++) {
let permission = permissions[i];
let checkbox = await TestUtils.waitForCondition(() =>
pageInfo.document.getElementById(`${permission}Def`)
);
ok(checkbox.disabled, `${permission} checkbox should be disabled`);
}
pageInfo.close();
});
});
|