Bug 1375485 - Update the extension manifest schema to distinguish between permissions and origins. r=aswan draft
authorIan Moody <moz-ian@perix.co.uk>
Sat, 23 Sep 2017 17:41:08 +0100
changeset 671224 0d2f4b0e7736dbb41169c2690e716b5f48b43d92
parent 671089 35fbf14b96a633c3f66ea13c1a163a3f3a4219b9
child 671225 3be2e679b7f85ebffb416438663182413b205936
push id81875
push usermoz-ian@perix.co.uk
push dateWed, 27 Sep 2017 16:31:29 +0000
reviewersaswan
bugs1375485
milestone58.0a1
Bug 1375485 - Update the extension manifest schema to distinguish between permissions and origins. r=aswan The manifest of an extension has two fields, permissions and optional_permissions, which both take an array of strings consisting of permissions or origins. The permissions API accepts the same values but within distinct origins and permissions fields of an object. This patch modifies the schema to reflect this difference. MozReview-Commit-ID: 3V3YeWEIVnf
toolkit/components/extensions/schemas/manifest.json
--- a/toolkit/components/extensions/schemas/manifest.json
+++ b/toolkit/components/extensions/schemas/manifest.json
@@ -163,26 +163,26 @@
             "format": "contentSecurityPolicy",
             "onError": "warn"
           },
 
           "permissions": {
             "type": "array",
             "default": [],
             "items": {
-              "$ref": "Permission",
+              "$ref": "PermissionOrOrigin",
               "onError": "warn"
             },
             "optional": true
           },
 
           "optional_permissions": {
             "type": "array",
             "items": {
-              "$ref": "OptionalPermission",
+              "$ref": "OptionalPermissionOrOrigin",
               "onError": "warn"
             },
             "optional": true,
             "default": []
           },
 
           "web_accessible_resources": {
             "type": "array",
@@ -369,17 +369,23 @@
             "type": "string",
             "enum": [
               "clipboardRead",
               "clipboardWrite",
               "geolocation",
               "idle",
               "notifications"
             ]
-          },
+          }
+        ]
+      },
+      {
+        "id": "OptionalPermissionOrOrigin",
+        "choices": [
+          { "$ref": "OptionalPermission" },
           { "$ref": "MatchPattern" }
         ]
       },
       {
         "id": "Permission",
         "choices": [
           { "$ref": "OptionalPermission" },
           {
@@ -388,16 +394,23 @@
               "alarms",
               "storage",
               "unlimitedStorage"
             ]
           }
         ]
       },
       {
+        "id": "PermissionOrOrigin",
+        "choices": [
+          { "$ref": "Permission" },
+          { "$ref": "MatchPattern" }
+        ]
+      },
+      {
         "id": "HttpURL",
         "type": "string",
         "format": "url",
         "pattern": "^https?://.*$"
       },
       {
         "id": "ExtensionURL",
         "type": "string",