Fix for the regression caused by bug 92447

movinf request for the nsPrefService out of Init()
r=bnesse and sr=alecf
This commit is contained in:
mitesh%netscape.com 2001-09-07 21:12:41 +00:00
Родитель c67e681b26
Коммит c8d19b1415
1 изменённых файлов: 13 добавлений и 8 удалений

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

@ -58,15 +58,7 @@ nsresult nsAutoConfig::Init()
return rv; return rv;
rv = observerService->AddObserver(this,NS_LITERAL_STRING("profile-after-change").get()); rv = observerService->AddObserver(this,NS_LITERAL_STRING("profile-after-change").get());
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIPrefService> prefs =
do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv))
return rv;
rv = prefs->GetBranch(nsnull,getter_AddRefs(mPrefBranch));
return rv; return rv;
} }
@ -250,6 +242,19 @@ nsresult nsAutoConfig::downloadAutoConfig()
if (!mBuf.IsEmpty()) if (!mBuf.IsEmpty())
mBuf.Truncate(0); mBuf.Truncate(0);
// Get the preferences branch and save it to the member variable
if (!mPrefBranch) {
nsCOMPtr<nsIPrefService> prefs =
do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv))
return rv;
rv = prefs->GetBranch(nsnull,getter_AddRefs(mPrefBranch));
if (NS_FAILED(rv))
return rv;
}
// Check to see if the network is online/offline // Check to see if the network is online/offline
nsCOMPtr<nsIIOService> ios = do_GetService(NS_IOSERVICE_CONTRACTID, &rv); nsCOMPtr<nsIIOService> ios = do_GetService(NS_IOSERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv)) if (NS_FAILED(rv))