Bug 1544392 - Allow extension icons to be supplied from localized manifest properties, and fix the Yandex icon in search engines. r=mixedpuppy
authorMark Banner <standard8@mozilla.com>
Tue, 23 Apr 2019 21:10:00 +0000
changeset 470563 c2a0278aa9ec56ff75ba7a96ee68f3d61b6a1a9f
parent 470562 c666c0a0d04208fa315059b45c0521c880ef7c60
child 470564 72dc7deb89f60941a661ab5ff04d9ade077b7a4d
push id35908
push useraciure@mozilla.com
push dateWed, 24 Apr 2019 04:28:40 +0000
treeherdermozilla-central@c9f0730a57a6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmixedpuppy
bugs1544392
milestone68.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 1544392 - Allow extension icons to be supplied from localized manifest properties, and fix the Yandex icon in search engines. r=mixedpuppy Differential Revision: https://phabricator.services.mozilla.com/D28499
browser/components/search/extensions/yandex/_locales/az/messages.json
browser/components/search/extensions/yandex/_locales/by/messages.json
browser/components/search/extensions/yandex/_locales/en/messages.json
browser/components/search/extensions/yandex/_locales/kk/messages.json
browser/components/search/extensions/yandex/_locales/ru/messages.json
browser/components/search/extensions/yandex/_locales/tr/messages.json
toolkit/components/extensions/schemas/manifest.json
toolkit/components/extensions/test/xpcshell/test_locale_data.js
--- a/browser/components/search/extensions/yandex/_locales/az/messages.json
+++ b/browser/components/search/extensions/yandex/_locales/az/messages.json
@@ -28,11 +28,11 @@
   },
   "param_homepage": {
     "message": "2186617"
   },
   "param_newtab": {
     "message": "2186620"
   },
   "extensionIcon": {
-    "message": "resource://search-plugins/images/yandex-ru.ico"
+    "message": "yandex-ru.ico"
   }
-}
\ No newline at end of file
+}
--- a/browser/components/search/extensions/yandex/_locales/by/messages.json
+++ b/browser/components/search/extensions/yandex/_locales/by/messages.json
@@ -28,11 +28,11 @@
   },
   "param_homepage": {
     "message": "2186617"
   },
   "param_newtab": {
     "message": "2186620"
   },
   "extensionIcon": {
-    "message": "resource://search-plugins/images/yandex-ru.ico"
+    "message": "yandex-ru.ico"
   }
-}
\ No newline at end of file
+}
--- a/browser/components/search/extensions/yandex/_locales/en/messages.json
+++ b/browser/components/search/extensions/yandex/_locales/en/messages.json
@@ -28,11 +28,11 @@
   },
   "param_homepage": {
     "message": "2186617"
   },
   "param_newtab": {
     "message": "2186620"
   },
   "extensionIcon": {
-    "message": "resource://search-plugins/images/yandex-en.ico"
+    "message": "yandex-en.ico"
   }
-}
\ No newline at end of file
+}
--- a/browser/components/search/extensions/yandex/_locales/kk/messages.json
+++ b/browser/components/search/extensions/yandex/_locales/kk/messages.json
@@ -28,11 +28,11 @@
   },
   "param_homepage": {
     "message": "2186617"
   },
   "param_newtab": {
     "message": "2186620"
   },
   "extensionIcon": {
-    "message": "resource://search-plugins/images/yandex-ru.ico"
+    "message": "yandex-ru.ico"
   }
-}
\ No newline at end of file
+}
--- a/browser/components/search/extensions/yandex/_locales/ru/messages.json
+++ b/browser/components/search/extensions/yandex/_locales/ru/messages.json
@@ -28,11 +28,11 @@
   },
   "param_homepage": {
     "message": "2186617"
   },
   "param_newtab": {
     "message": "2186620"
   },
   "extensionIcon": {
-    "message": "resource://search-plugins/images/yandex-ru.ico"
+    "message": "yandex-ru.ico"
   }
-}
\ No newline at end of file
+}
--- a/browser/components/search/extensions/yandex/_locales/tr/messages.json
+++ b/browser/components/search/extensions/yandex/_locales/tr/messages.json
@@ -28,11 +28,11 @@
   },
   "param_homepage": {
     "message": "2186617"
   },
   "param_newtab": {
     "message": "2186620"
   },
   "extensionIcon": {
-    "message": "resource://search-plugins/images/yandex-en.ico"
+    "message": "yandex-en.ico"
   }
-}
\ No newline at end of file
+}
--- a/toolkit/components/extensions/schemas/manifest.json
+++ b/toolkit/components/extensions/schemas/manifest.json
@@ -405,17 +405,18 @@
         "id": "ExtensionURL",
         "type": "string",
         "format": "strictRelativeUrl"
       },
       {
         "id": "ExtensionFileUrl",
         "type": "string",
         "format": "strictRelativeUrl",
-        "pattern": "\\S"
+        "pattern": "\\S",
+        "preprocess": "localize"
       },
       {
         "id": "ImageDataOrExtensionURL",
         "type": "string",
         "format": "imageDataOrStrictRelativeUrl"
       },
       {
         "id": "ExtensionID",
--- a/toolkit/components/extensions/test/xpcshell/test_locale_data.js
+++ b/toolkit/components/extensions/test/xpcshell/test_locale_data.js
@@ -120,30 +120,41 @@ add_task(async function testInvalidSynta
      "Got syntax error");
 });
 
 add_task(async function testExtractLocalizedManifest() {
   let extension = await generateAddon({
     "manifest": {
       "name": "__MSG_extensionName__",
       "default_locale": "en_US",
+      "icons": {
+        "16": "__MSG_extensionIcon__",
+      },
     },
 
     "files": {
-      "_locales/en_US/messages.json": '{"extensionName": {"message": "foo"}}',
-      "_locales/de_DE/messages.json": '{"extensionName": {"message": "bar"}}',
+      "_locales/en_US/messages.json": `{
+        "extensionName": {"message": "foo"},
+        "extensionIcon": {"message": "icon-en.png"}
+      }`,
+      "_locales/de_DE/messages.json": `{
+        "extensionName": {"message": "bar"},
+        "extensionIcon": {"message": "icon-de.png"}
+      }`,
     },
   });
 
   await extension.loadManifest();
   equal(extension.manifest.name, "foo", "name localized");
+  equal(extension.manifest.icons["16"], "icon-en.png", "icons localized");
 
   let manifest = await extension.getLocalizedManifest("de-DE");
   ok(extension.localeData.has("de-DE"), "has de_DE locale");
   equal(manifest.name, "bar", "name localized");
+  equal(manifest.icons["16"], "icon-de.png", "icons localized");
 
   await Assert.rejects(extension.getLocalizedManifest("xx-XX"),
                        /does not contain the locale xx-XX/, "xx-XX does not exist");
 });
 
 add_task(async function testRestartThenExtractLocalizedManifest() {
   await AddonTestUtils.promiseStartupManager();