forked from mirrors/gecko-dev
Bug 1906192 - Only enable trending suggestions on 128 for en-US / en-CA users. r=adw a=RyanVM
Differential Revision: https://phabricator.services.mozilla.com/D215699
This commit is contained in:
parent
94e1f6e3db
commit
139c6f03ab
4 changed files with 29 additions and 3 deletions
|
|
@ -430,6 +430,9 @@ pref("browser.urlbar.scotchBonnet.enableOverride", false);
|
|||
|
||||
// Enable trending suggestions and recent searches.
|
||||
pref("browser.urlbar.trending.featureGate", true);
|
||||
#if defined(RELEASE_OR_BETA)
|
||||
pref("browser.urlbar.trending.enabledLocales", "en-US, en-CA");
|
||||
#endif
|
||||
pref("browser.urlbar.trending.requireSearchMode", false);
|
||||
pref("browser.urlbar.recentsearches.featureGate", true);
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ Preferences.addAll([
|
|||
{ id: "browser.search.separatePrivateDefault.ui.enabled", type: "bool" },
|
||||
{ id: "browser.urlbar.suggest.trending", type: "bool" },
|
||||
{ id: "browser.urlbar.trending.featureGate", type: "bool" },
|
||||
{ id: "browser.urlbar.trending.enabledLocales", type: "string" },
|
||||
{ id: "browser.urlbar.recentsearches.featureGate", type: "bool" },
|
||||
{ id: "browser.urlbar.suggest.recentsearches", type: "bool" },
|
||||
]);
|
||||
|
|
@ -283,8 +284,18 @@ var gSearchPane = {
|
|||
let trendingSupported = (
|
||||
await Services.search.getDefault()
|
||||
).supportsResponseType(lazy.SearchUtils.URL_TYPE.TRENDING_JSON);
|
||||
trendingBox.hidden = !Preferences.get("browser.urlbar.trending.featureGate")
|
||||
.value;
|
||||
let trendingEnabled = Preferences.get(
|
||||
"browser.urlbar.trending.featureGate"
|
||||
).value;
|
||||
let enabledLocales = Preferences.get(
|
||||
"browser.urlbar.trending.enabledLocales"
|
||||
).value;
|
||||
if (trendingEnabled && enabledLocales) {
|
||||
trendingEnabled = enabledLocales.includes(
|
||||
Services.locale.appLocaleAsBCP47
|
||||
);
|
||||
}
|
||||
trendingBox.hidden = !trendingEnabled;
|
||||
trendingCheckBox.disabled = suggestDisabled || !trendingSupported;
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -452,6 +452,11 @@ const PREF_URLBAR_DEFAULTS = new Map([
|
|||
// Feature gate pref for trending suggestions in the urlbar.
|
||||
["trending.featureGate", true],
|
||||
|
||||
// Only enable trending suggestions if the users browser locale is contained
|
||||
// in this list; enable in all locales if empty.
|
||||
// (if the value was "en-US", trending would only be enabled for en-US users).
|
||||
["trending.enabledLocales", ""],
|
||||
|
||||
// The maximum number of trending results to show while not in search mode.
|
||||
["trending.maxResultsNoSearchMode", 10],
|
||||
|
||||
|
|
|
|||
|
|
@ -601,9 +601,16 @@ class ProviderSearchSuggestions extends UrlbarProvider {
|
|||
* Whether we should fetch trending results.
|
||||
*/
|
||||
#shouldFetchTrending(queryContext) {
|
||||
let trendingEnabled = lazy.UrlbarPrefs.get("trending.featureGate");
|
||||
let enabledLocales = lazy.UrlbarPrefs.get("trending.enabledLocales");
|
||||
if (trendingEnabled && enabledLocales) {
|
||||
trendingEnabled = enabledLocales.includes(
|
||||
Services.locale.appLocaleAsBCP47
|
||||
);
|
||||
}
|
||||
return !!(
|
||||
queryContext.searchString == "" &&
|
||||
lazy.UrlbarPrefs.get("trending.featureGate") &&
|
||||
trendingEnabled &&
|
||||
lazy.UrlbarPrefs.get("suggest.trending") &&
|
||||
(queryContext.searchMode ||
|
||||
!lazy.UrlbarPrefs.get("trending.requireSearchMode"))
|
||||
|
|
|
|||
Loading…
Reference in a new issue