Bug 197466 - "Back button (session history) has 50 entries regardless of setting in prefs.js" [p=zug_treno@yahoo.com r+sr=bzbarsky a1.9=damons]

This commit is contained in:
reed@reedloden.com 2008-02-23 01:36:27 -08:00
Родитель f8e72c6c72
Коммит 851a344036
1 изменённых файлов: 13 добавлений и 4 удалений

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

@ -220,14 +220,23 @@ nsSHistory::Startup()
{
nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs) {
// Session history size is only taken from the default prefs branch.
// This means that it's only configurable on a per-application basis.
nsCOMPtr<nsIPrefBranch> sesHBranch;
prefs->GetBranch(nsnull, getter_AddRefs(sesHBranch));
if (sesHBranch) {
sesHBranch->GetIntPref(PREF_SHISTORY_SIZE, &gHistoryMaxSize);
}
// The goal of this is to unbreak users who have inadvertently set their
// session history size to -1.
// session history size to less than the default value.
PRInt32 defaultHistoryMaxSize = 50;
nsCOMPtr<nsIPrefBranch> defaultBranch;
prefs->GetDefaultBranch(nsnull, getter_AddRefs(defaultBranch));
if (defaultBranch) {
defaultBranch->GetIntPref(PREF_SHISTORY_SIZE, &gHistoryMaxSize);
defaultBranch->GetIntPref(PREF_SHISTORY_SIZE, &defaultHistoryMaxSize);
}
if (gHistoryMaxSize < defaultHistoryMaxSize) {
gHistoryMaxSize = defaultHistoryMaxSize;
}
// Allow the user to override the max total number of cached viewers,