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
|
"use strict";
// This test expects and checks warnings for unknown permissions.
ExtensionTestUtils.failOnSchemaWarnings(false);
add_task(async function test_unknown_permissions() {
let extension = ExtensionTestUtils.loadExtension({
manifest: {
permissions: [
"activeTab",
"fooUnknownPermission",
"http://*/",
"chrome://favicon/",
],
optional_permissions: ["chrome://favicon/", "https://example.com/"],
},
});
let { messages } = await promiseConsoleOutput(() => extension.startup());
const { WebExtensionPolicy } = Cu.getGlobalForObject(
ChromeUtils.importESModule("resource://gre/modules/Extension.sys.mjs")
);
let policy = WebExtensionPolicy.getByID(extension.id);
Assert.deepEqual(Array.from(policy.permissions).sort(), ["activeTab"]);
Assert.deepEqual(extension.extension.manifest.optional_permissions, [
"https://example.com/",
]);
ok(
messages.some(message =>
/Error processing permissions\.1: Value "fooUnknownPermission" must/.test(
message
)
),
'Got expected error for "fooUnknownPermission"'
);
ok(
messages.some(message =>
/Error processing permissions\.3: Value "chrome:\/\/favicon\/" must/.test(
message
)
),
'Got expected error for "chrome://favicon/"'
);
ok(
messages.some(message =>
/Error processing optional_permissions\.0: Value "chrome:\/\/favicon\/" must/.test(
message
)
),
"Got expected error from optional_permissions"
);
await extension.unload();
});
|