Bug 1432508 - Support default_locale in static theme manifests. r=aswan draft
authorTim Nguyen <ntim.bugs@gmail.com>
Wed, 02 May 2018 09:48:14 +0100
changeset 790402 7e77849a6c717416c23c517036f84bb52e0b4d79
parent 789064 4b51c5cf8035e7e18506b2e3a1a8aee66eeed5e8
push id108512
push userbmo:ntim.bugs@gmail.com
push dateWed, 02 May 2018 08:48:47 +0000
reviewersaswan
bugs1432508
milestone61.0a1
Bug 1432508 - Support default_locale in static theme manifests. r=aswan MozReview-Commit-ID: HGbsztYtyjr
toolkit/components/extensions/schemas/theme.json
toolkit/mozapps/extensions/test/xpcshell/test_webextension_theme.js
--- a/toolkit/components/extensions/schemas/theme.json
+++ b/toolkit/components/extensions/schemas/theme.json
@@ -558,16 +558,20 @@
         "id": "ThemeManifest",
         "type": "object",
         "description": "Contents of manifest.json for a static theme",
         "$import": "manifest.ManifestBase",
         "properties": {
           "theme": {
             "$ref": "ThemeType"
           },
+          "default_locale": {
+            "type": "string",
+            "optional": "true"
+          },
           "icons": {
             "type": "object",
             "optional": true,
             "patternProperties": {
               "^[1-9]\\d*$": { "type": "string" }
             }
           }
         }
--- a/toolkit/mozapps/extensions/test/xpcshell/test_webextension_theme.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_webextension_theme.js
@@ -219,8 +219,39 @@ add_task(async function uninstall_offers
   await cancelPromise;
 
   Assert.equal(theme.pendingOperations, AddonManager.PENDING_NONE,
                "PENDING_UNINSTALL flag is cleared when uninstall is canceled");
 
   theme.uninstall();
   await promiseRestartManager();
 });
+
+// Test that default_locale works with WE themes
+add_task(async function default_locale_themes() {
+  let addon = await promiseInstallWebExtension({
+    manifest: {
+      default_locale: "en",
+      name: "__MSG_name__",
+      description: "__MSG_description__",
+      theme: {
+        "accentcolor": "black",
+        "textcolor": "white",
+      }
+    },
+    files: {
+      "_locales/en/messages.json": `{
+        "name": {
+          "message": "the name"
+        },
+        "description": {
+          "message": "the description"
+        }
+      }`
+    }
+  });
+
+  addon = await promiseAddonByID(addon.id);
+  equal(addon.name, "the name");
+  equal(addon.description, "the description");
+  equal(addon.type, "theme");
+  addon.uninstall();
+});