From e6d7762c44ac9b955d5be0e509baf3177b5268c7 Mon Sep 17 00:00:00 2001 From: "reed%reedloden.com" Date: Sat, 23 Feb 2008 09:36:27 +0000 Subject: [PATCH] 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] --- docshell/shistory/src/nsSHistory.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/docshell/shistory/src/nsSHistory.cpp b/docshell/shistory/src/nsSHistory.cpp index e71157f4c4e..f26260b58e6 100644 --- a/docshell/shistory/src/nsSHistory.cpp +++ b/docshell/shistory/src/nsSHistory.cpp @@ -220,14 +220,23 @@ nsSHistory::Startup() { nsCOMPtr 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 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 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,