Bug 1432508 - Support default_locale in static theme manifests. r=aswan
☠☠ backed out by 9d3b1d2dd32e ☠ ☠
authorTim Nguyen <ntim.bugs@gmail.com>
Sun, 29 Apr 2018 19:20:42 +0100
changeset 472738 b74e2721b7f067a0dd0e44f50f31d339192d3187
parent 472554 d28c45ebedccae786507d357b725c889170653b8
child 472739 9d3b1d2dd32e6f606cd590b82032c8bbf0cc8156
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: J5desAN98GQ
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" }
             }
           }
         }
@@ -634,17 +638,17 @@
           {
             "type": "integer",
             "name": "windowId",
             "optional": true,
             "description": "The id of the window to update. No id updates all windows."
           },
           {
             "name": "details",
-            "$ref": "manifest.ThemeType",
+            "$ref": "ThemeType",
             "description": "The properties of the theme to update."
           }
         ]
       },
       {
         "name": "reset",
         "type": "function",
         "async": true,
--- 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();
+});