Bug 1197420 Part 1 Schema groundwork for optional permissions r=kmag draft
authorAndrew Swan <aswan@mozilla.com>
Fri, 24 Mar 2017 11:10:26 -0700
changeset 538629 511dea13ceacc25a46505165962c1b01dfcc7b6e
parent 504632 4c987b7ed54a630a7de76adcc2eb00dab49d5dfd
child 538630 e24e1b52edd3ddcd353a6407497ec4076039af03
push id50951
push useraswan@mozilla.com
push dateFri, 24 Mar 2017 21:33:07 +0000
reviewerskmag
bugs1197420
milestone55.0a1
Bug 1197420 Part 1 Schema groundwork for optional permissions r=kmag MozReview-Commit-ID: JIfPYjxjFfM
browser/components/extensions/schemas/bookmarks.json
browser/components/extensions/schemas/history.json
browser/components/extensions/schemas/tabs.json
mobile/android/components/extensions/schemas/tabs.json
toolkit/components/extensions/schemas/cookies.json
toolkit/components/extensions/schemas/manifest.json
toolkit/components/extensions/schemas/top_sites.json
toolkit/components/extensions/schemas/web_navigation.json
toolkit/components/extensions/schemas/web_request.json
--- a/browser/components/extensions/schemas/bookmarks.json
+++ b/browser/components/extensions/schemas/bookmarks.json
@@ -2,17 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
 [
   {
     "namespace": "manifest",
     "types": [
       {
-        "$extend": "Permission",
+        "$extend": "OptionalPermission",
         "choices": [{
           "type": "string",
           "enum": [
             "bookmarks"
           ]
         }]
       }
     ]
--- a/browser/components/extensions/schemas/history.json
+++ b/browser/components/extensions/schemas/history.json
@@ -2,17 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
 [
   {
     "namespace": "manifest",
     "types": [
       {
-        "$extend": "Permission",
+        "$extend": "OptionalPermission",
         "choices": [{
           "type": "string",
           "enum": [
             "history"
           ]
         }]
       }
     ]
--- a/browser/components/extensions/schemas/tabs.json
+++ b/browser/components/extensions/schemas/tabs.json
@@ -2,17 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
 [
   {
     "namespace": "manifest",
     "types": [
       {
-        "$extend": "Permission",
+        "$extend": "OptionalPermission",
         "choices": [{
           "type": "string",
           "enum": [
             "activeTab",
             "tabs"
           ]
         }]
       }
--- a/mobile/android/components/extensions/schemas/tabs.json
+++ b/mobile/android/components/extensions/schemas/tabs.json
@@ -2,17 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
 [
   {
     "namespace": "manifest",
     "types": [
       {
-        "$extend": "Permission",
+        "$extend": "OptionalPermission",
         "choices": [{
           "type": "string",
           "enum": [
             "activeTab",
             "tabs"
           ]
         }]
       }
--- a/toolkit/components/extensions/schemas/cookies.json
+++ b/toolkit/components/extensions/schemas/cookies.json
@@ -2,17 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
 [
   {
     "namespace": "manifest",
     "types": [
       {
-        "$extend": "Permission",
+        "$extend": "OptionalPermission",
         "choices": [{
           "type": "string",
           "enum": [
             "cookies"
           ]
         }]
       }
     ]
--- a/toolkit/components/extensions/schemas/manifest.json
+++ b/toolkit/components/extensions/schemas/manifest.json
@@ -174,16 +174,22 @@
                   "type": "string",
                   "deprecated": "Unknown permission ${value}"
                 }
               ]
             },
             "optional": true
           },
 
+          "optional_permissions": {
+            "type": "array",
+            "items": { "$ref": "OptionalPermission" },
+            "optional": true
+          },
+
           "web_accessible_resources": {
             "type": "array",
             "items": { "type": "string" },
             "optional": true
           },
 
           "developer": {
             "type": "object",
@@ -202,31 +208,42 @@
             }
           }
 
         },
 
         "additionalProperties": { "$ref": "UnrecognizedProperty" }
       },
       {
+        "id": "OptionalPermission",
+        "choices": [
+          {
+            "type": "string",
+            "enum": [
+              "clipboardRead",
+              "clipboardWrite",
+              "geolocation",
+              "idle",
+              "notifications"
+            ]
+          },
+          { "$ref": "MatchPattern" }
+        ]
+      },
+      {
         "id": "Permission",
         "choices": [
+          { "$ref": "OptionalPermission" },
           {
             "type": "string",
             "enum": [
               "alarms",
-              "clipboardRead",
-              "clipboardWrite",
-              "geolocation",
-              "idle",
-              "notifications",
               "storage"
             ]
-          },
-          { "$ref": "MatchPattern" }
+          }
         ]
       },
       {
         "id": "HttpURL",
         "type": "string",
         "format": "url",
         "pattern": "^https?://.*$"
       },
--- a/toolkit/components/extensions/schemas/top_sites.json
+++ b/toolkit/components/extensions/schemas/top_sites.json
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 [
   {
     "namespace": "manifest",
     "types": [
       {
-        "$extend": "Permission",
+        "$extend": "OptionalPermission",
         "choices": [{
           "type": "string",
           "enum": [
             "topSites"
           ]
         }]
       }
     ]
--- a/toolkit/components/extensions/schemas/web_navigation.json
+++ b/toolkit/components/extensions/schemas/web_navigation.json
@@ -2,17 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
 [
   {
     "namespace": "manifest",
     "types": [
       {
-        "$extend": "Permission",
+        "$extend": "OptionalPermission",
         "choices": [{
           "type": "string",
           "enum": [
             "webNavigation"
           ]
         }]
       }
     ]
--- a/toolkit/components/extensions/schemas/web_request.json
+++ b/toolkit/components/extensions/schemas/web_request.json
@@ -2,17 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
 [
   {
     "namespace": "manifest",
     "types": [
       {
-        "$extend": "Permission",
+        "$extend": "OptionalPermission",
         "choices": [{
           "type": "string",
           "enum": [
             "webRequest",
             "webRequestBlocking"
           ]
         }]
       }