Bug 1432508 - Support default_locale in static theme manifests. r=aswan
authorTim Nguyen <ntim.bugs@gmail.com>
Wed, 02 May 2018 09:48:14 +0100
changeset 472744 a662fe1cc8bad97245bf194c8707c088a0169304
parent 472743 4dbde138d6305db19fc4b35800fbdaba2fa9d2cf
child 472745 d27330acd8a5005fb073f704ab41876cac0e4a7b
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaswan
bugs1432508
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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();
+});