Bug 1552193 - Restore engine shortName to pre webextensions value. r=Standard8

Differential Revision: https://phabricator.services.mozilla.com/D31876

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Dale Harvey 2019-05-24 21:02:51 +00:00
Родитель daebd4816c
Коммит 481bc67f05
4 изменённых файлов: 13 добавлений и 11 удалений

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

@ -34,7 +34,7 @@ class TestEnginesOnRestart(MarionetteTestCase):
return self.marionette.execute_async_script(textwrap.dedent(script))
def test_engines(self):
self.assertEqual("google", self.get_default_search_engine())
self.assertTrue(self.get_default_search_engine().startswith("google"))
self.marionette.set_pref("intl.locale.requested", "kk_KZ")
self.marionette.restart(clean=False, in_app=True)
self.assertEqual("google", self.get_default_search_engine())
self.assertTrue(self.get_default_search_engine().startswith("google"))

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

@ -389,7 +389,10 @@ function getInternalAliases(engine) {
return [];
}
for (let [name, aliases] of ENGINE_ALIASES) {
if (engine._shortName == name) {
// This may match multiple engines (amazon vs amazondotcom), they
// shouldn't be installed together but if they are the first
// is picked.
if (engine._shortName.startsWith(name)) {
return aliases;
}
}

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

@ -1950,9 +1950,14 @@ SearchService.prototype = {
});
}
let shortName = extension.id.split("@")[0];
if (locale != DEFAULT_TAG) {
shortName += "-" + locale;
}
let params = {
name: searchProvider.name.trim(),
shortName: extension.id.split("@")[0],
shortName,
description: extension.manifest.description,
searchForm: searchProvider.search_form,
// AddonManager will sometimes encode the URL via `new URL()`. We want

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

@ -223,9 +223,6 @@ class SearchConfigTest {
/**
* Helper function to find an engine from within a list.
* Due to Amazon's current complex setup with three different identifiers,
* if the identifier is 'amazon', then we do a startsWith match. Otherwise
* we expect the names to equal.
*
* @param {Array} engines
* The list of engines to check.
@ -235,10 +232,7 @@ class SearchConfigTest {
* Returns the engine if found, null otherwise.
*/
_findEngine(engines, identifier) {
if (identifier == "amazon") {
return engines.find(engine => engine.identifier.startsWith(identifier));
}
return engines.find(engine => engine.identifier == identifier);
return engines.find(engine => engine.identifier.startsWith(identifier));
}
/**