зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1280381 - The prompt to enable search suggestions in the awesomebar panel should not be shown more than a few times, r=mak.
This commit is contained in:
Родитель
0521eafa74
Коммит
6e69587659
|
@ -292,6 +292,10 @@ pref("browser.urlbar.suggest.bookmark", true);
|
|||
pref("browser.urlbar.suggest.openpage", true);
|
||||
pref("browser.urlbar.suggest.searches", false);
|
||||
pref("browser.urlbar.userMadeSearchSuggestionsChoice", false);
|
||||
// 4 here means the suggestion notification will be automatically
|
||||
// hidden the 4th day, so it will actually be shown on 3 different days.
|
||||
pref("browser.urlbar.daysBeforeHidingSuggestionsPrompt", 4);
|
||||
pref("browser.urlbar.lastSuggestionsPromptDate", 20160601);
|
||||
|
||||
// Limit the number of characters sent to the current search engine to fetch
|
||||
// suggestions.
|
||||
|
|
|
@ -961,7 +961,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|||
// When _urlbarFocused is true, tabbrowser would close the
|
||||
// popup if it's opened here, so don't show the notification.
|
||||
!gBrowser.selectedBrowser._urlbarFocused &&
|
||||
Services.prefs.getBoolPref("browser.search.suggest.enabled");
|
||||
Services.prefs.getBoolPref("browser.search.suggest.enabled") &&
|
||||
this._prefs.getIntPref("daysBeforeHidingSuggestionsPrompt");
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
|
@ -1300,8 +1301,26 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|||
// to avoid impacting startup / new window performance
|
||||
aInput.popup.hidden = false;
|
||||
|
||||
if (aInput.shouldShowSearchSuggestionsNotification) {
|
||||
let showNotification = aInput.shouldShowSearchSuggestionsNotification;
|
||||
if (showNotification) {
|
||||
let prefs = aInput._prefs;
|
||||
let date = parseInt((new Date()).toLocaleFormat("%Y%m%d"));
|
||||
let previousDate = prefs.getIntPref("lastSuggestionsPromptDate");
|
||||
if (previousDate < date) {
|
||||
let remainingDays =
|
||||
prefs.getIntPref("daysBeforeHidingSuggestionsPrompt") - 1;
|
||||
prefs.setIntPref("daysBeforeHidingSuggestionsPrompt",
|
||||
remainingDays);
|
||||
prefs.setIntPref("lastSuggestionsPromptDate", date);
|
||||
if (!remainingDays)
|
||||
showNotification = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (showNotification) {
|
||||
this._showSearchSuggestionsNotification();
|
||||
} else if (this.classList.contains("showSearchSuggestionsNotification")) {
|
||||
this._hideSearchSuggestionsNotification();
|
||||
}
|
||||
|
||||
this._openAutocompletePopup(aInput, aElement);
|
||||
|
@ -1384,8 +1403,6 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|||
</method>
|
||||
|
||||
<method name="_showSearchSuggestionsNotification">
|
||||
<parameter name="aInput"/>
|
||||
<parameter name="aElement"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
// With the notification shown, the listbox's height can sometimes be
|
||||
|
|
Загрузка…
Ссылка в новой задаче