From 0995c8e19e46f16f8b874bba651ebd9dbb242939 Mon Sep 17 00:00:00 2001 From: "jaggernaut%netscape.com" Date: Thu, 18 Aug 2005 11:16:41 +0000 Subject: [PATCH] Bug 126826: back/forward buttons stop working because of invalid value for sessionhistory.max_entries in prefs.js. r=jrgm, sr=bryner, a=asa git-svn-id: svn://10.0.0.236/trunk@178123 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/shistory/src/nsSHistory.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mozilla/docshell/shistory/src/nsSHistory.cpp b/mozilla/docshell/shistory/src/nsSHistory.cpp index c11bc17d0b1..36b0d77f9b9 100644 --- a/mozilla/docshell/shistory/src/nsSHistory.cpp +++ b/mozilla/docshell/shistory/src/nsSHistory.cpp @@ -35,7 +35,7 @@ #include "nsIDocShellTreeNode.h" #include "nsIDocShellLoadInfo.h" #include "nsIServiceManager.h" -#include "nsIPref.h" +#include "nsIPrefService.h" #define PREF_SHISTORY_SIZE "browser.sessionhistory.max_entries" static PRInt32 gHistoryMaxSize = 50; @@ -84,12 +84,15 @@ NS_INTERFACE_MAP_END NS_IMETHODIMP nsSHistory::Init() { - nsresult res; - nsCOMPtr prefs = do_GetService(NS_PREF_CONTRACTID, &res); - if (NS_SUCCEEDED(res) && prefs) { - prefs->GetIntPref(PREF_SHISTORY_SIZE, &gHistoryMaxSize); + nsCOMPtr prefs = do_GetService(NS_PREFSERVICE_CONTRACTID); + if (prefs) { + nsCOMPtr defaultBranch; + prefs->GetDefaultBranch(nsnull, getter_AddRefs(defaultBranch)); + if (defaultBranch) { + defaultBranch->GetIntPref(PREF_SHISTORY_SIZE, &gHistoryMaxSize); + } } - return res; + return NS_OK; }