mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-23 23:57:31 +09:00
[Pale-Moon] Issue #1925 - Follow-up: Throw errors on invalid values.
Uses defaults for negative values and caps upper limit.
This commit is contained in:
parent
075eebec12
commit
1768eb1930
1 changed files with 9 additions and 3 deletions
|
|
@ -505,14 +505,20 @@ function HistoryMenu(aPopupShowingEvent) {
|
||||||
"@mozilla.org/browser/sessionstore;1",
|
"@mozilla.org/browser/sessionstore;1",
|
||||||
"nsISessionStore");
|
"nsISessionStore");
|
||||||
let maxResults = Services.prefs.getIntPref("browser.history.menuMaxResults", 15);
|
let maxResults = Services.prefs.getIntPref("browser.history.menuMaxResults", 15);
|
||||||
// Workaround so that maxResults = 0 wouldn't create unlimited items
|
if (maxResults < 0) {
|
||||||
|
Components.utils.reportError("Maximum number of history menu entries is invalid! Using defaults.");
|
||||||
|
maxResults = 15;
|
||||||
|
}
|
||||||
if (maxResults > 0) {
|
if (maxResults > 0) {
|
||||||
if (maxResults > 50) {
|
if (maxResults > 50) {
|
||||||
// Return to sanity...
|
// Return to sanity...
|
||||||
maxResults = 15;
|
Components.utils.reportError("Maximum number of history menu entries is too large! Capping to 50.");
|
||||||
|
maxResults = 50;
|
||||||
}
|
}
|
||||||
PlacesMenu.call(this, aPopupShowingEvent,
|
PlacesMenu.call(this, aPopupShowingEvent,
|
||||||
"place:sort=4&maxResults=" + maxResults.toString().trim());
|
"place:sort=4&maxResults=" + maxResults.toString().trim());
|
||||||
|
} else {
|
||||||
|
// maxResults == 0; do nothing. This suppresses the history entries.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue