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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mark Banner 2019-04-23 21:10:00 +00:00
Родитель e167dffa80
Коммит c507a11dc6
8 изменённых файлов: 27 добавлений и 15 удалений

Просмотреть файл

@ -33,6 +33,6 @@
"message": "2186620"
},
"extensionIcon": {
"message": "resource://search-plugins/images/yandex-ru.ico"
"message": "yandex-ru.ico"
}
}
}

Просмотреть файл

@ -33,6 +33,6 @@
"message": "2186620"
},
"extensionIcon": {
"message": "resource://search-plugins/images/yandex-ru.ico"
"message": "yandex-ru.ico"
}
}
}

Просмотреть файл

@ -33,6 +33,6 @@
"message": "2186620"
},
"extensionIcon": {
"message": "resource://search-plugins/images/yandex-en.ico"
"message": "yandex-en.ico"
}
}
}

Просмотреть файл

@ -33,6 +33,6 @@
"message": "2186620"
},
"extensionIcon": {
"message": "resource://search-plugins/images/yandex-ru.ico"
"message": "yandex-ru.ico"
}
}
}

Просмотреть файл

@ -33,6 +33,6 @@
"message": "2186620"
},
"extensionIcon": {
"message": "resource://search-plugins/images/yandex-ru.ico"
"message": "yandex-ru.ico"
}
}
}

Просмотреть файл

@ -33,6 +33,6 @@
"message": "2186620"
},
"extensionIcon": {
"message": "resource://search-plugins/images/yandex-en.ico"
"message": "yandex-en.ico"
}
}
}

Просмотреть файл

@ -410,7 +410,8 @@
"id": "ExtensionFileUrl",
"type": "string",
"format": "strictRelativeUrl",
"pattern": "\\S"
"pattern": "\\S",
"preprocess": "localize"
},
{
"id": "ImageDataOrExtensionURL",

Просмотреть файл

@ -125,20 +125,31 @@ add_task(async function testExtractLocalizedManifest() {
"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");