Bug 1469318 - Do not require 'theme' permission for theme.getCurrent() and theme.onUpdated. r=jaws draft
authorTim Nguyen <ntim.bugs@gmail.com>
Mon, 18 Jun 2018 21:26:00 +0100
changeset 808233 d2bb55d29084
parent 808232 db80d5a4d8e9
push id113324
push userbmo:ntim.bugs@gmail.com
push dateMon, 18 Jun 2018 20:26:45 +0000
reviewersjaws
bugs1469318
milestone62.0a1
Bug 1469318 - Do not require 'theme' permission for theme.getCurrent() and theme.onUpdated. r=jaws MozReview-Commit-ID: JFGm2xzlsJ1
toolkit/components/extensions/schemas/theme.json
toolkit/components/extensions/test/browser/browser_ext_themes_getCurrent_differentExt.js
toolkit/components/extensions/test/browser/browser_ext_themes_static_onUpdated.js
toolkit/components/extensions/test/mochitest/test_ext_all_apis.js
--- a/toolkit/components/extensions/schemas/theme.json
+++ b/toolkit/components/extensions/schemas/theme.json
@@ -580,17 +580,16 @@
           }
         }
       }
     ]
   },
   {
     "namespace": "theme",
     "description": "The theme API allows customizing of visual elements of the browser.",
-    "permissions": ["theme"],
     "types": [
       {
         "id": "ThemeUpdateInfo",
         "type": "object",
         "description": "Info provided in the onUpdated listener.",
         "properties": {
           "theme": {
             "type": "object",
@@ -633,16 +632,17 @@
           }
         ]
       },
       {
         "name": "update",
         "type": "function",
         "async": true,
         "description": "Make complete updates to the theme. Resolves when the update has completed.",
+        "permissions": ["theme"],
         "parameters": [
           {
             "type": "integer",
             "name": "windowId",
             "optional": true,
             "description": "The id of the window to update. No id updates all windows."
           },
           {
@@ -652,16 +652,17 @@
           }
         ]
       },
       {
         "name": "reset",
         "type": "function",
         "async": true,
         "description": "Removes the updates made to the theme.",
+        "permissions": ["theme"],
         "parameters": [
           {
             "type": "integer",
             "name": "windowId",
             "optional": true,
             "description": "The id of the window to reset. No id resets all windows."
           }
         ]
--- a/toolkit/components/extensions/test/browser/browser_ext_themes_getCurrent_differentExt.js
+++ b/toolkit/components/extensions/test/browser/browser_ext_themes_getCurrent_differentExt.js
@@ -24,19 +24,16 @@ add_task(async function test_getcurrent(
   const extension = ExtensionTestUtils.loadExtension({
     background() {
       browser.theme.onUpdated.addListener(() => {
         browser.theme.getCurrent().then(theme => {
           browser.test.sendMessage("theme-updated", theme);
         });
       });
     },
-    manifest: {
-      permissions: ["theme"],
-    },
   });
 
   await extension.startup();
 
   info("Testing getCurrent after static theme startup");
   let updatedPromise = extension.awaitMessage("theme-updated");
   await theme.startup();
   let receivedTheme = await updatedPromise;
--- a/toolkit/components/extensions/test/browser/browser_ext_themes_static_onUpdated.js
+++ b/toolkit/components/extensions/test/browser/browser_ext_themes_static_onUpdated.js
@@ -22,19 +22,16 @@ add_task(async function test_on_updated(
   });
 
   const extension = ExtensionTestUtils.loadExtension({
     background() {
       browser.theme.onUpdated.addListener(updateInfo => {
         browser.test.sendMessage("theme-updated", updateInfo);
       });
     },
-    manifest: {
-      permissions: ["theme"],
-    },
   });
 
   await extension.startup();
 
   info("Testing update event on static theme startup");
   let updatedPromise = extension.awaitMessage("theme-updated");
   await theme.startup();
   const {theme: receivedTheme, windowId} = await updatedPromise;
--- a/toolkit/components/extensions/test/mochitest/test_ext_all_apis.js
+++ b/toolkit/components/extensions/test/mochitest/test_ext_all_apis.js
@@ -88,16 +88,18 @@ let expectedBackgroundApis = [
   "runtime.onConnectExternal",
   "runtime.onInstalled",
   "runtime.onMessageExternal",
   "runtime.onStartup",
   "runtime.onUpdateAvailable",
   "runtime.openOptionsPage",
   "runtime.reload",
   "runtime.setUninstallURL",
+  "theme.getCurrent",
+  "theme.onUpdated",
   "types.LevelOfControl",
   "types.SettingScope",
 ];
 
 function sendAllApis() {
   function isEvent(key, val) {
     if (!/^on[A-Z]/.test(key)) {
       return false;