summaryrefslogtreecommitdiffstats
path: root/dom/apps/tests/unit/test_manifestSanitizer.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/apps/tests/unit/test_manifestSanitizer.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/apps/tests/unit/test_manifestSanitizer.js')
-rw-r--r--dom/apps/tests/unit/test_manifestSanitizer.js63
1 files changed, 63 insertions, 0 deletions
diff --git a/dom/apps/tests/unit/test_manifestSanitizer.js b/dom/apps/tests/unit/test_manifestSanitizer.js
new file mode 100644
index 000000000..4b0c999a7
--- /dev/null
+++ b/dom/apps/tests/unit/test_manifestSanitizer.js
@@ -0,0 +1,63 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+function testEntryPoint(aRoot) {
+ do_check_true(aRoot.name == "hello world");
+ do_check_true(aRoot.description == "A bold name");
+ do_check_true(aRoot.developer.name == "Blink Inc.");
+
+ let permissions = aRoot.permissions;
+ do_check_true(permissions.contacts.description == "Required for autocompletion in the share screen");
+ do_check_true(permissions.alarms.description == "Required to schedule notifications");
+}
+
+function run_test() {
+ Components.utils.import("resource:///modules/AppsUtils.jsm");
+
+ do_check_true(!!AppsUtils);
+
+ // Test manifest, with one entry point.
+ let manifest = {
+ name: "hello <b>world</b>",
+ description: "A bold name",
+ developer: {
+ name: "<blink>Blink</blink> Inc.",
+ url: "http://blink.org"
+ },
+ permissions : {
+ "contacts": {
+ "description": "Required for autocompletion in the <a href='http://shareme.com'>share</a> screen",
+ "access": "readcreate"
+ },
+ "alarms": {
+ "description": "Required to schedule notifications"
+ }
+ },
+
+ entry_points: {
+ "subapp": {
+ name: "hello <b>world</b>",
+ description: "A bold name",
+ developer: {
+ name: "<blink>Blink</blink> Inc.",
+ url: "http://blink.org"
+ },
+ permissions : {
+ "contacts": {
+ "description": "Required for autocompletion in the <a href='http://shareme.com'>share</a> screen",
+ "access": "readcreate"
+ },
+ "alarms": {
+ "description": "Required to schedule notifications"
+ }
+ }
+ }
+ }
+ }
+
+ AppsUtils.sanitizeManifest(manifest);
+
+ // Check the main section and the subapp entry point.
+ testEntryPoint(manifest);
+ testEntryPoint(manifest.entry_points.subapp);
+}