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
|
<!DOCTYPE HTML>
<html>
<head>
<title>Test for schema API creation</title>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SpawnTask.js"></script>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/ExtensionTestUtils.js"></script>
<script type="text/javascript" src="chrome_head.js"></script>
<script type="text/javascript" src="head.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="text/javascript">
"use strict";
add_task(function* testEmptySchema() {
function background() {
browser.test.assertEq(undefined, browser.manifest, "browser.manifest is not defined");
browser.test.assertTrue("storage" in browser, "browser.storage should be defined");
browser.test.assertEq(undefined, browser.contextMenus, "browser.contextMenus should not be defined");
browser.test.notifyPass("schema");
}
let extension = ExtensionTestUtils.loadExtension({
background,
manifest: {
permissions: ["storage"],
},
});
yield extension.startup();
yield extension.awaitFinish("schema");
yield extension.unload();
});
add_task(function* testUnknownProperties() {
function background() {
browser.test.notifyPass("loaded");
}
let extension = ExtensionTestUtils.loadExtension({
manifest: {
permissions: ["unknownPermission"],
unknown_property: {},
},
background,
});
let messages = [
{message: /processing permissions\.0: Unknown permission "unknownPermission"/},
{message: /processing unknown_property: An unexpected property was found in the WebExtension manifest/},
];
let waitForConsole = new Promise(resolve => {
SimpleTest.monitorConsole(resolve, messages);
});
yield extension.startup();
yield extension.awaitFinish("loaded");
yield extension.unload();
SimpleTest.endMonitorConsole();
yield waitForConsole;
});
</script>
</body>
</html>
|