зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
daebd4816c
Коммит
481bc67f05
|
@ -34,7 +34,7 @@ class TestEnginesOnRestart(MarionetteTestCase):
|
||||||
return self.marionette.execute_async_script(textwrap.dedent(script))
|
return self.marionette.execute_async_script(textwrap.dedent(script))
|
||||||
|
|
||||||
def test_engines(self):
|
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.set_pref("intl.locale.requested", "kk_KZ")
|
||||||
self.marionette.restart(clean=False, in_app=True)
|
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 [];
|
return [];
|
||||||
}
|
}
|
||||||
for (let [name, aliases] of ENGINE_ALIASES) {
|
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;
|
return aliases;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1950,9 +1950,14 @@ SearchService.prototype = {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let shortName = extension.id.split("@")[0];
|
||||||
|
if (locale != DEFAULT_TAG) {
|
||||||
|
shortName += "-" + locale;
|
||||||
|
}
|
||||||
|
|
||||||
let params = {
|
let params = {
|
||||||
name: searchProvider.name.trim(),
|
name: searchProvider.name.trim(),
|
||||||
shortName: extension.id.split("@")[0],
|
shortName,
|
||||||
description: extension.manifest.description,
|
description: extension.manifest.description,
|
||||||
searchForm: searchProvider.search_form,
|
searchForm: searchProvider.search_form,
|
||||||
// AddonManager will sometimes encode the URL via `new URL()`. We want
|
// 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.
|
* 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
|
* @param {Array} engines
|
||||||
* The list of engines to check.
|
* The list of engines to check.
|
||||||
|
@ -235,11 +232,8 @@ class SearchConfigTest {
|
||||||
* Returns the engine if found, null otherwise.
|
* Returns the engine if found, null otherwise.
|
||||||
*/
|
*/
|
||||||
_findEngine(engines, identifier) {
|
_findEngine(engines, identifier) {
|
||||||
if (identifier == "amazon") {
|
|
||||||
return engines.find(engine => engine.identifier.startsWith(identifier));
|
return engines.find(engine => engine.identifier.startsWith(identifier));
|
||||||
}
|
}
|
||||||
return engines.find(engine => engine.identifier == identifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asserts whether the engines rules defined in the configuration are met.
|
* Asserts whether the engines rules defined in the configuration are met.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче