Bug 1197420 Part 1 Schema groundwork for optional permissions draft
authorAndrew Swan <aswan@mozilla.com>
Sat, 25 Feb 2017 09:25:00 -0800
changeset 490085 4232cbc11710c9c9e9eb8757b54140e87307274f
parent 489279 6f2117c0b9895dfeb06fa74d2dc91bff660386ce
child 490086 e4c13d11e401ae3bd40be3a5a7fb0aaf95c992bb
push id46991
push useraswan@mozilla.com
push dateMon, 27 Feb 2017 17:02:25 +0000
bugs1197420
milestone54.0a1
Bug 1197420 Part 1 Schema groundwork for optional permissions 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
@@ -173,16 +173,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",
@@ -201,31 +207,42 @@
             }
           }
 
         },
 
         "additionalProperties": { "$ref": "UnrecognizedProperty" }
       },
       {
+        "id": "OptionalPermission",
+        "choices": [
+          {
+            "type": "string",
+            "enum": [
+              "clipboardRead",
+              "clipboardWrite",
+              "idle",
+              "notifications"
+            ]
+          },
+          { "$ref": "MatchPattern" }
+        ]
+      },
+      {
         "id": "Permission",
         "choices": [
+          { "$ref": "OptionalPermission" },
           {
             "type": "string",
             "enum": [
               "alarms",
-              "clipboardRead",
-              "clipboardWrite",
               "geolocation",
-              "idle",
-              "notifications",
               "storage"
             ]
-          },
-          { "$ref": "MatchPattern" }
+          }
         ]
       },
       {
         "id": "ExtensionURL",
         "type": "string",
         "format": "strictRelativeUrl"
       },
       {
--- 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"
           ]
         }]
       }