Bug 1277686 - Reject manifests with any "incognito" property other than "spanning", r?kmag draft
authorBob Silverberg <bsilverberg@mozilla.com>
Thu, 09 Jun 2016 08:16:18 -0400
changeset 376948 88c595861c0d97b147a5ae26844f59cb9dc59129
parent 376743 daadc8567a11c6165986c05719fa44a7ed8af839
child 523291 9369a7d5065021b34019d9371011d7981ff82099
push id20725
push userbmo:bob.silverberg@gmail.com
push dateThu, 09 Jun 2016 12:21:03 +0000
reviewerskmag
bugs1277686
milestone50.0a1
Bug 1277686 - Reject manifests with any "incognito" property other than "spanning", r?kmag MozReview-Commit-ID: 7DJ6EMQ5jnX
toolkit/components/extensions/schemas/manifest.json
toolkit/components/extensions/test/xpcshell/test_ext_manifest_incognito.js
toolkit/components/extensions/test/xpcshell/xpcshell.ini
--- a/toolkit/components/extensions/schemas/manifest.json
+++ b/toolkit/components/extensions/schemas/manifest.json
@@ -74,16 +74,22 @@
           "icons": {
             "type": "object",
             "optional": true,
             "patternProperties": {
               "^[1-9]\\d*$": { "type": "string" }
             }
           },
 
+          "incognito": {
+            "type": "string",
+            "enum": ["spanning"],
+            "optional": true
+          },
+
           "background": {
             "choices": [
               {
                 "type": "object",
                 "properties": {
                   "page": { "$ref": "ExtensionURL" },
                   "persistent": {
                     "optional": true,
new file mode 100644
--- /dev/null
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_manifest_incognito.js
@@ -0,0 +1,23 @@
+/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set sts=2 sw=2 et tw=80: */
+"use strict";
+
+
+add_task(function* test_manifest_incognito() {
+  let normalized = yield normalizeManifest({
+    "incognito": "spanning",
+  });
+
+  equal(normalized.error, undefined, "Should not have an error");
+  equal(normalized.errors.length, 0, "Should not have warnings");
+  equal(normalized.value.incognito,
+        "spanning",
+        "Should have the expected incognito string");
+
+  normalized = yield normalizeManifest({
+    "incognito": "split",
+  });
+
+  equal(normalized.error, 'Error processing incognito: Invalid enumeration value "split"', "Should have the expected error");
+  equal(normalized.errors.length, 0, "Should not have warnings");
+});
--- a/toolkit/components/extensions/test/xpcshell/xpcshell.ini
+++ b/toolkit/components/extensions/test/xpcshell/xpcshell.ini
@@ -6,13 +6,14 @@ skip-if = toolkit == 'gonk' || appname =
 
 [test_csp_custom_policies.js]
 [test_csp_validator.js]
 [test_locale_data.js]
 [test_locale_converter.js]
 [test_ext_contexts.js]
 [test_ext_json_parser.js]
 [test_ext_manifest_content_security_policy.js]
+[test_ext_manifest_incognito.js]
 [test_ext_schemas.js]
 [test_getAPILevelForWindow.js]
 [test_native_messaging.js]
 # Re-enable for Windows with bug 1270359.
 skip-if = os != "mac" && os != "linux"