Bug 1614651 - Add hidden pref to disable restrictions on Search Tips to help with testing. r=mak

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Harry Twyford 2020-02-14 13:51:35 +00:00
Родитель 255a87c4a6
Коммит 80f63ae251
2 изменённых файлов: 12 добавлений и 4 удалений

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

@ -124,6 +124,11 @@ const PREF_URLBAR_DEFAULTS = new Map([
// The number of times the user has been shown the redirect search tip.
["searchTips.redirect.shownCount", 0],
// Hidden pref. Disables checks that prevent search tips being shown, thus
// showing them every time the newtab page or the default search engine
// homepage is opened.
["searchTips.test.ignoreShowLimits", false],
// Whether speculative connections should be enabled.
["speculativeConnect.enabled", true],

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

@ -280,7 +280,8 @@ class ProviderSearchTips extends UrlbarProvider {
if (
!UrlbarPrefs.get("update1.searchTips") ||
!cfrFeaturesUserPref ||
this.disableTipsForCurrentSession
(this.disableTipsForCurrentSession &&
!UrlbarPrefs.get("searchTips.test.ignoreShowLimits"))
) {
return;
}
@ -298,14 +299,16 @@ class ProviderSearchTips extends UrlbarProvider {
let instance = {};
this._maybeShowTipForUrlInstance = instance;
let ignoreShowLimits = UrlbarPrefs.get("searchTips.test.ignoreShowLimits");
// Don't show a tip if the browser is already showing some other notification.
if (isBrowserShowingNotification()) {
if (isBrowserShowingNotification() && !ignoreShowLimits) {
return;
}
// Don't show a tip if the browser has been updated recently.
let date = await lastBrowserUpdateDate();
if (Date.now() - date <= LAST_UPDATE_THRESHOLD_MS) {
if (Date.now() - date <= LAST_UPDATE_THRESHOLD_MS && !ignoreShowLimits) {
return;
}
@ -332,7 +335,7 @@ class ProviderSearchTips extends UrlbarProvider {
// If we've shown this type of tip the maximum number of times over all
// sessions, don't show it again.
let shownCount = UrlbarPrefs.get(shownCountPrefName);
if (shownCount >= MAX_SHOWN_COUNT) {
if (shownCount >= MAX_SHOWN_COUNT && !ignoreShowLimits) {
return;
}