[Pale-Moon] Issue #1925 - Follow-up: Don't show link items when pref is less than 1.

A user setting the pref to 0 most likely wants to get rid of the items, so let's
allow that by simply not calling PlacesMenu.call at all in that case.
This commit is contained in:
Job Bautista 2023-05-18 17:03:08 +08:00 committed by roytam1
commit 075eebec12

View file

@ -504,13 +504,16 @@ function HistoryMenu(aPopupShowingEvent) {
XPCOMUtils.defineLazyServiceGetter(this, "_ss",
"@mozilla.org/browser/sessionstore;1",
"nsISessionStore");
let maxResults = Services.prefs.getIntPref("browser.history.menuMaxResults",15);
if (maxResults < 1 || maxResults > 50) {
// Return to sanity...
maxResults = 15;
let maxResults = Services.prefs.getIntPref("browser.history.menuMaxResults", 15);
// Workaround so that maxResults = 0 wouldn't create unlimited items
if (maxResults > 0) {
if (maxResults > 50) {
// Return to sanity...
maxResults = 15;
}
PlacesMenu.call(this, aPopupShowingEvent,
"place:sort=4&maxResults=" + maxResults.toString().trim());
}
PlacesMenu.call(this, aPopupShowingEvent,
"place:sort=4&maxResults=" + maxResults.toString().trim());
}
HistoryMenu.prototype = {