diff --git a/browser/components/search/test/marionette/test_engines_on_restart.py b/browser/components/search/test/marionette/test_engines_on_restart.py index 6560fc170c44..c242aa365cc8 100644 --- a/browser/components/search/test/marionette/test_engines_on_restart.py +++ b/browser/components/search/test/marionette/test_engines_on_restart.py @@ -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")) diff --git a/toolkit/components/search/SearchEngine.jsm b/toolkit/components/search/SearchEngine.jsm index 5d9c5a049f76..977339fa0bbb 100644 --- a/toolkit/components/search/SearchEngine.jsm +++ b/toolkit/components/search/SearchEngine.jsm @@ -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; } } diff --git a/toolkit/components/search/SearchService.jsm b/toolkit/components/search/SearchService.jsm index 7d3c4d2db382..753b3db7329c 100644 --- a/toolkit/components/search/SearchService.jsm +++ b/toolkit/components/search/SearchService.jsm @@ -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 diff --git a/toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js b/toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js index 7ac97593a351..95b080ae7923 100644 --- a/toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js +++ b/toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js @@ -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)); } /**