Bug 1432508 - Support default_locale in static theme manifests. r=aswan
MozReview-Commit-ID: HGbsztYtyjr
--- 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();
+});