fixes bug 102332 "9K leaks on tinderbox: cycle relating to HTTP handler"

r=gagan, sr=alecf
This commit is contained in:
darin%netscape.com 2001-10-02 00:40:27 +00:00
Родитель e75df76d7c
Коммит f3dc11cf6f
2 изменённых файлов: 80 добавлений и 72 удалений

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

@ -113,6 +113,7 @@ nsHttpHandler::nsHttpHandler()
, mIdleConnections(0) , mIdleConnections(0)
, mTransactionQ(0) , mTransactionQ(0)
, mUserAgentIsDirty(PR_TRUE) , mUserAgentIsDirty(PR_TRUE)
, mUseCache(PR_TRUE)
{ {
NS_INIT_ISUPPORTS(); NS_INIT_ISUPPORTS();
@ -132,8 +133,10 @@ nsHttpHandler::~nsHttpHandler()
nsHttp::DestroyAtomTable(); nsHttp::DestroyAtomTable();
if (mPrefs) { nsCOMPtr<nsIPrefBranch> prefBranch;
nsCOMPtr<nsIPrefBranchInternal> pbi = do_QueryInterface(mPrefs); GetPrefBranch(getter_AddRefs(prefBranch));
if (prefBranch) {
nsCOMPtr<nsIPrefBranchInternal> pbi = do_QueryInterface(prefBranch);
if (pbi) { if (pbi) {
pbi->RemoveObserver(HTTP_PREF_PREFIX, this); pbi->RemoveObserver(HTTP_PREF_PREFIX, this);
pbi->RemoveObserver(UA_PREF_PREFIX, this); pbi->RemoveObserver(UA_PREF_PREFIX, this);
@ -207,29 +210,20 @@ nsHttpHandler::Init()
InitUserAgentComponents(); InitUserAgentComponents();
// get a root prefs branch
{
nsCOMPtr<nsIPrefService> prefService =
do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
rv = prefService->GetBranch(nsnull, getter_AddRefs(mPrefs));
if (NS_FAILED(rv)) return rv;
}
// monitor some preference changes // monitor some preference changes
{ nsCOMPtr<nsIPrefBranch> prefBranch;
nsCOMPtr<nsIPrefBranchInternal> pbi = do_QueryInterface(mPrefs, &rv); GetPrefBranch(getter_AddRefs(prefBranch));
if (NS_FAILED(rv)) return rv; if (prefBranch) {
nsCOMPtr<nsIPrefBranchInternal> pbi = do_QueryInterface(prefBranch);
pbi->AddObserver(HTTP_PREF_PREFIX, this); if (pbi) {
pbi->AddObserver(UA_PREF_PREFIX, this); pbi->AddObserver(HTTP_PREF_PREFIX, this);
pbi->AddObserver(INTL_ACCEPT_LANGUAGES, this); pbi->AddObserver(UA_PREF_PREFIX, this);
pbi->AddObserver(INTL_ACCEPT_CHARSET, this); pbi->AddObserver(INTL_ACCEPT_LANGUAGES, this);
pbi->AddObserver(INTL_ACCEPT_CHARSET, this);
}
PrefsChanged(prefBranch);
} }
PrefsChanged();
#if DEBUG #if DEBUG
// dump user agent prefs // dump user agent prefs
LOG(("> app-name = %s\n", mAppName.get())); LOG(("> app-name = %s\n", mAppName.get()));
@ -353,18 +347,10 @@ nsresult
nsHttpHandler::GetCacheSession(nsCacheStoragePolicy storagePolicy, nsHttpHandler::GetCacheSession(nsCacheStoragePolicy storagePolicy,
nsICacheSession **result) nsICacheSession **result)
{ {
static PRBool checkedPref = PR_FALSE;
static PRBool useCache = PR_TRUE;
nsresult rv; nsresult rv;
if (!checkedPref) {
// XXX should register a prefs changed callback for this
mPrefs->GetBoolPref("browser.cache.enable", &useCache);
checkedPref = PR_TRUE;
}
// Skip cache if disabled in preferences // Skip cache if disabled in preferences
if (!useCache) if (!mUseCache)
return NS_ERROR_NOT_AVAILABLE; return NS_ERROR_NOT_AVAILABLE;
if (!mCacheSession_ANY) { if (!mCacheSession_ANY) {
@ -1047,13 +1033,8 @@ nsHttpHandler::InitUserAgentComponents()
} }
void void
nsHttpHandler::PrefsChanged(const char *pref) nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
{ {
if (!mPrefs) {
NS_ERROR("not initialized");
return;
}
nsresult rv = NS_OK; nsresult rv = NS_OK;
PRInt32 val; PRInt32 val;
@ -1067,48 +1048,48 @@ nsHttpHandler::PrefsChanged(const char *pref)
// Gather vendor values. // Gather vendor values.
if (PREF_CHANGED(UA_PREF("vendor"))) { if (PREF_CHANGED(UA_PREF("vendor"))) {
mPrefs->GetCharPref(UA_PREF("vendor"), prefs->GetCharPref(UA_PREF("vendor"),
getter_Copies(mVendor)); getter_Copies(mVendor));
mUserAgentIsDirty = PR_TRUE; mUserAgentIsDirty = PR_TRUE;
} }
if (PREF_CHANGED(UA_PREF("vendorSub"))) { if (PREF_CHANGED(UA_PREF("vendorSub"))) {
mPrefs->GetCharPref(UA_PREF("vendorSub"), prefs->GetCharPref(UA_PREF("vendorSub"),
getter_Copies(mVendorSub)); getter_Copies(mVendorSub));
mUserAgentIsDirty = PR_TRUE; mUserAgentIsDirty = PR_TRUE;
} }
if (PREF_CHANGED(UA_PREF("vendorComment"))) { if (PREF_CHANGED(UA_PREF("vendorComment"))) {
mPrefs->GetCharPref(UA_PREF("vendorComment"), prefs->GetCharPref(UA_PREF("vendorComment"),
getter_Copies(mVendorComment)); getter_Copies(mVendorComment));
mUserAgentIsDirty = PR_TRUE; mUserAgentIsDirty = PR_TRUE;
} }
// Gather product values. // Gather product values.
if (PREF_CHANGED(UA_PREF("product"))) { if (PREF_CHANGED(UA_PREF("product"))) {
mPrefs->GetCharPref(UA_PREF_PREFIX "product", prefs->GetCharPref(UA_PREF_PREFIX "product",
getter_Copies(mProduct)); getter_Copies(mProduct));
mUserAgentIsDirty = PR_TRUE; mUserAgentIsDirty = PR_TRUE;
} }
if (PREF_CHANGED(UA_PREF("productSub"))) { if (PREF_CHANGED(UA_PREF("productSub"))) {
mPrefs->GetCharPref(UA_PREF("productSub"), prefs->GetCharPref(UA_PREF("productSub"),
getter_Copies(mProductSub)); getter_Copies(mProductSub));
mUserAgentIsDirty = PR_TRUE; mUserAgentIsDirty = PR_TRUE;
} }
if (PREF_CHANGED(UA_PREF("productComment"))) { if (PREF_CHANGED(UA_PREF("productComment"))) {
mPrefs->GetCharPref(UA_PREF("productComment"), prefs->GetCharPref(UA_PREF("productComment"),
getter_Copies(mProductComment)); getter_Copies(mProductComment));
mUserAgentIsDirty = PR_TRUE; mUserAgentIsDirty = PR_TRUE;
} }
// Gather misc value. // Gather misc value.
if (PREF_CHANGED(UA_PREF("misc"))) { if (PREF_CHANGED(UA_PREF("misc"))) {
mPrefs->GetCharPref(UA_PREF("misc"), prefs->GetCharPref(UA_PREF("misc"),
getter_Copies(mMisc)); getter_Copies(mMisc));
mUserAgentIsDirty = PR_TRUE; mUserAgentIsDirty = PR_TRUE;
} }
// Get Security level supported // Get Security level supported
if (PREF_CHANGED(UA_PREF("security"))) { if (PREF_CHANGED(UA_PREF("security"))) {
mPrefs->GetCharPref(UA_PREF("security"), getter_Copies(mSecurity)); prefs->GetCharPref(UA_PREF("security"), getter_Copies(mSecurity));
if (!mSecurity) if (!mSecurity)
mSecurity.Adopt(nsCRT::strdup(UA_APPSECURITY_FALLBACK)); mSecurity.Adopt(nsCRT::strdup(UA_APPSECURITY_FALLBACK));
mUserAgentIsDirty = PR_TRUE; mUserAgentIsDirty = PR_TRUE;
@ -1117,7 +1098,7 @@ nsHttpHandler::PrefsChanged(const char *pref)
// Gather locale. // Gather locale.
if (PREF_CHANGED(UA_PREF("locale"))) { if (PREF_CHANGED(UA_PREF("locale"))) {
nsCOMPtr<nsIPrefLocalizedString> pls; nsCOMPtr<nsIPrefLocalizedString> pls;
mPrefs->GetComplexValue(UA_PREF("locale"), prefs->GetComplexValue(UA_PREF("locale"),
NS_GET_IID(nsIPrefLocalizedString), NS_GET_IID(nsIPrefLocalizedString),
getter_AddRefs(pls)); getter_AddRefs(pls));
if (pls) { if (pls) {
@ -1131,14 +1112,14 @@ nsHttpHandler::PrefsChanged(const char *pref)
// general.useragent.override // general.useragent.override
if (PREF_CHANGED(UA_PREF("override"))) { if (PREF_CHANGED(UA_PREF("override"))) {
mPrefs->GetCharPref(UA_PREF("override"), prefs->GetCharPref(UA_PREF("override"),
getter_Copies(mUserAgentOverride)); getter_Copies(mUserAgentOverride));
mUserAgentIsDirty = PR_TRUE; mUserAgentIsDirty = PR_TRUE;
} }
// general.useragent.misc // general.useragent.misc
if (PREF_CHANGED(UA_PREF("misc"))) { if (PREF_CHANGED(UA_PREF("misc"))) {
mPrefs->GetCharPref(UA_PREF("misc"), getter_Copies(mMisc)); prefs->GetCharPref(UA_PREF("misc"), getter_Copies(mMisc));
mUserAgentIsDirty = PR_TRUE; mUserAgentIsDirty = PR_TRUE;
} }
@ -1147,50 +1128,50 @@ nsHttpHandler::PrefsChanged(const char *pref)
// //
if (PREF_CHANGED(HTTP_PREF("keep-alive.timeout"))) { if (PREF_CHANGED(HTTP_PREF("keep-alive.timeout"))) {
rv = mPrefs->GetIntPref(HTTP_PREF("keep-alive.timeout"), &val); rv = prefs->GetIntPref(HTTP_PREF("keep-alive.timeout"), &val);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
mIdleTimeout = (PRUint16) CLAMP(val, 1, 0xffff); mIdleTimeout = (PRUint16) CLAMP(val, 1, 0xffff);
} }
if (PREF_CHANGED(HTTP_PREF("request.max-attempts"))) { if (PREF_CHANGED(HTTP_PREF("request.max-attempts"))) {
rv = mPrefs->GetIntPref(HTTP_PREF("request.max-attempts"), &val); rv = prefs->GetIntPref(HTTP_PREF("request.max-attempts"), &val);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
mMaxRequestAttempts = (PRUint16) CLAMP(val, 1, 0xffff); mMaxRequestAttempts = (PRUint16) CLAMP(val, 1, 0xffff);
} }
if (PREF_CHANGED(HTTP_PREF("request.max-start-delay"))) { if (PREF_CHANGED(HTTP_PREF("request.max-start-delay"))) {
rv = mPrefs->GetIntPref(HTTP_PREF("request.max-start-delay"), &val); rv = prefs->GetIntPref(HTTP_PREF("request.max-start-delay"), &val);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
mMaxRequestDelay = (PRUint16) CLAMP(val, 0, 0xffff); mMaxRequestDelay = (PRUint16) CLAMP(val, 0, 0xffff);
} }
if (PREF_CHANGED(HTTP_PREF("max-connections"))) { if (PREF_CHANGED(HTTP_PREF("max-connections"))) {
rv = mPrefs->GetIntPref(HTTP_PREF("max-connections"), &val); rv = prefs->GetIntPref(HTTP_PREF("max-connections"), &val);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
mMaxConnections = (PRUint16) CLAMP(val, 1, 0xffff); mMaxConnections = (PRUint16) CLAMP(val, 1, 0xffff);
} }
if (PREF_CHANGED(HTTP_PREF("max-connections-per-server"))) { if (PREF_CHANGED(HTTP_PREF("max-connections-per-server"))) {
rv = mPrefs->GetIntPref(HTTP_PREF("max-connections-per-server"), &val); rv = prefs->GetIntPref(HTTP_PREF("max-connections-per-server"), &val);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
mMaxConnectionsPerServer = (PRUint8) CLAMP(val, 1, 0xff); mMaxConnectionsPerServer = (PRUint8) CLAMP(val, 1, 0xff);
} }
if (PREF_CHANGED(HTTP_PREF("max-persistent-connections-per-server"))) { if (PREF_CHANGED(HTTP_PREF("max-persistent-connections-per-server"))) {
rv = mPrefs->GetIntPref(HTTP_PREF("max-persistent-connections-per-server"), &val); rv = prefs->GetIntPref(HTTP_PREF("max-persistent-connections-per-server"), &val);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
mMaxPersistentConnectionsPerServer = (PRUint8) CLAMP(val, 1, 0xff); mMaxPersistentConnectionsPerServer = (PRUint8) CLAMP(val, 1, 0xff);
} }
if (PREF_CHANGED(HTTP_PREF("sendRefererHeader"))) { if (PREF_CHANGED(HTTP_PREF("sendRefererHeader"))) {
rv = mPrefs->GetIntPref(HTTP_PREF("sendRefererHeader"), (PRInt32 *) &val); rv = prefs->GetIntPref(HTTP_PREF("sendRefererHeader"), (PRInt32 *) &val);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
mReferrerLevel = (PRUint8) CLAMP(val, 0, 0xff); mReferrerLevel = (PRUint8) CLAMP(val, 0, 0xff);
} }
if (PREF_CHANGED(HTTP_PREF("version"))) { if (PREF_CHANGED(HTTP_PREF("version"))) {
nsXPIDLCString httpVersion; nsXPIDLCString httpVersion;
mPrefs->GetCharPref(HTTP_PREF("version"), getter_Copies(httpVersion)); prefs->GetCharPref(HTTP_PREF("version"), getter_Copies(httpVersion));
if (httpVersion) { if (httpVersion) {
if (!PL_strcmp(httpVersion, "1.1")) if (!PL_strcmp(httpVersion, "1.1"))
@ -1214,7 +1195,7 @@ nsHttpHandler::PrefsChanged(const char *pref)
PRBool cVar = PR_FALSE; PRBool cVar = PR_FALSE;
if (PREF_CHANGED(HTTP_PREF("keep-alive"))) { if (PREF_CHANGED(HTTP_PREF("keep-alive"))) {
rv = mPrefs->GetBoolPref(HTTP_PREF("keep-alive"), &cVar); rv = prefs->GetBoolPref(HTTP_PREF("keep-alive"), &cVar);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
if (cVar) if (cVar)
mCapabilities |= NS_HTTP_ALLOW_KEEPALIVE; mCapabilities |= NS_HTTP_ALLOW_KEEPALIVE;
@ -1224,7 +1205,7 @@ nsHttpHandler::PrefsChanged(const char *pref)
} }
if (PREF_CHANGED(HTTP_PREF("proxy.keep-alive"))) { if (PREF_CHANGED(HTTP_PREF("proxy.keep-alive"))) {
rv = mPrefs->GetBoolPref(HTTP_PREF("proxy.keep-alive"), &cVar); rv = prefs->GetBoolPref(HTTP_PREF("proxy.keep-alive"), &cVar);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
if (cVar) if (cVar)
mProxyCapabilities |= NS_HTTP_ALLOW_KEEPALIVE; mProxyCapabilities |= NS_HTTP_ALLOW_KEEPALIVE;
@ -1234,7 +1215,7 @@ nsHttpHandler::PrefsChanged(const char *pref)
} }
if (PREF_CHANGED(HTTP_PREF("pipelining"))) { if (PREF_CHANGED(HTTP_PREF("pipelining"))) {
rv = mPrefs->GetBoolPref(HTTP_PREF("pipelining"), &cVar); rv = prefs->GetBoolPref(HTTP_PREF("pipelining"), &cVar);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
if (cVar) if (cVar)
mCapabilities |= NS_HTTP_ALLOW_PIPELINING; mCapabilities |= NS_HTTP_ALLOW_PIPELINING;
@ -1245,11 +1226,11 @@ nsHttpHandler::PrefsChanged(const char *pref)
/* /*
mPipelineMaxRequests = DEFAULT_PIPELINE_MAX_REQUESTS; mPipelineMaxRequests = DEFAULT_PIPELINE_MAX_REQUESTS;
rv = mPrefs->GetIntPref("network.http.pipelining.maxrequests", &mPipelineMaxRequests ); rv = prefs->GetIntPref("network.http.pipelining.maxrequests", &mPipelineMaxRequests );
*/ */
if (PREF_CHANGED(HTTP_PREF("proxy.pipelining"))) { if (PREF_CHANGED(HTTP_PREF("proxy.pipelining"))) {
rv = mPrefs->GetBoolPref(HTTP_PREF("proxy.pipelining"), &cVar); rv = prefs->GetBoolPref(HTTP_PREF("proxy.pipelining"), &cVar);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
if (cVar) if (cVar)
mProxyCapabilities |= NS_HTTP_ALLOW_PIPELINING; mProxyCapabilities |= NS_HTTP_ALLOW_PIPELINING;
@ -1260,15 +1241,15 @@ nsHttpHandler::PrefsChanged(const char *pref)
/* /*
if (bChangedAll || PL_strcmp(pref, "network.http.connect.timeout") == 0) if (bChangedAll || PL_strcmp(pref, "network.http.connect.timeout") == 0)
mPrefs->GetIntPref("network.http.connect.timeout", &mConnectTimeout); prefs->GetIntPref("network.http.connect.timeout", &mConnectTimeout);
if (bChangedAll || PL_strcmp(pref, "network.http.request.timeout") == 0) if (bChangedAll || PL_strcmp(pref, "network.http.request.timeout") == 0)
mPrefs->GetIntPref("network.http.request.timeout", &mRequestTimeout); prefs->GetIntPref("network.http.request.timeout", &mRequestTimeout);
*/ */
if (PREF_CHANGED(HTTP_PREF("accept.default"))) { if (PREF_CHANGED(HTTP_PREF("accept.default"))) {
nsXPIDLCString accept; nsXPIDLCString accept;
rv = mPrefs->GetCharPref(HTTP_PREF("accept.default"), rv = prefs->GetCharPref(HTTP_PREF("accept.default"),
getter_Copies(accept)); getter_Copies(accept));
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
SetAccept(accept); SetAccept(accept);
@ -1276,19 +1257,31 @@ nsHttpHandler::PrefsChanged(const char *pref)
if (PREF_CHANGED(HTTP_PREF("accept-encoding"))) { if (PREF_CHANGED(HTTP_PREF("accept-encoding"))) {
nsXPIDLCString acceptEncodings; nsXPIDLCString acceptEncodings;
rv = mPrefs->GetCharPref(HTTP_PREF("accept-encoding"), rv = prefs->GetCharPref(HTTP_PREF("accept-encoding"),
getter_Copies(acceptEncodings)); getter_Copies(acceptEncodings));
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
SetAcceptEncodings(acceptEncodings); SetAcceptEncodings(acceptEncodings);
} }
if (PREF_CHANGED(HTTP_PREF("use-cache"))) {
rv = prefs->GetBoolPref(HTTP_PREF("use-cache"), &cVar);
if (NS_SUCCEEDED(rv)) {
mUseCache = cVar;
if (!mUseCache) {
// release our references to the cache
mCacheSession_ANY = 0;
mCacheSession_MEM = 0;
}
}
}
// //
// INTL options // INTL options
// //
if (PREF_CHANGED(INTL_ACCEPT_LANGUAGES)) { if (PREF_CHANGED(INTL_ACCEPT_LANGUAGES)) {
nsCOMPtr<nsIPrefLocalizedString> pls; nsCOMPtr<nsIPrefLocalizedString> pls;
mPrefs->GetComplexValue(INTL_ACCEPT_LANGUAGES, prefs->GetComplexValue(INTL_ACCEPT_LANGUAGES,
NS_GET_IID(nsIPrefLocalizedString), NS_GET_IID(nsIPrefLocalizedString),
getter_AddRefs(pls)); getter_AddRefs(pls));
if (pls) { if (pls) {
@ -1301,7 +1294,7 @@ nsHttpHandler::PrefsChanged(const char *pref)
if (PREF_CHANGED(INTL_ACCEPT_CHARSET)) { if (PREF_CHANGED(INTL_ACCEPT_CHARSET)) {
nsCOMPtr<nsIPrefLocalizedString> pls; nsCOMPtr<nsIPrefLocalizedString> pls;
mPrefs->GetComplexValue(INTL_ACCEPT_CHARSET, prefs->GetComplexValue(INTL_ACCEPT_CHARSET,
NS_GET_IID(nsIPrefLocalizedString), NS_GET_IID(nsIPrefLocalizedString),
getter_AddRefs(pls)); getter_AddRefs(pls));
if (pls) { if (pls) {
@ -1315,6 +1308,16 @@ nsHttpHandler::PrefsChanged(const char *pref)
#undef PREF_CHANGED #undef PREF_CHANGED
} }
void
nsHttpHandler::GetPrefBranch(nsIPrefBranch **result)
{
*result = nsnull;
nsCOMPtr<nsIPrefService> prefService =
do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefService)
prefService->GetBranch(nsnull, result);
}
/** /**
* Allocates a C string into that contains a ISO 639 language list * Allocates a C string into that contains a ISO 639 language list
* notated with HTTP "q" values for output with a HTTP Accept-Language * notated with HTTP "q" values for output with a HTTP Accept-Language
@ -1815,8 +1818,11 @@ nsHttpHandler::Observe(nsISupports *subject,
// depend on this value. // depend on this value.
mSessionStartTime = NowInSeconds(); mSessionStartTime = NowInSeconds();
} }
else if (!nsCRT::strcmp(topic, NS_LITERAL_STRING("nsPref:changed").get())) else if (!nsCRT::strcmp(topic, NS_LITERAL_STRING("nsPref:changed").get())) {
PrefsChanged(NS_ConvertUCS2toUTF8(data).get()); nsCOMPtr<nsIPrefBranch> prefBranch = do_QueryInterface(subject);
if (prefBranch)
PrefsChanged(prefBranch, NS_ConvertUCS2toUTF8(data).get());
}
return NS_OK; return NS_OK;
} }

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

@ -36,7 +36,6 @@
#include "nsICacheSession.h" #include "nsICacheSession.h"
#include "nsIEventQueueService.h" #include "nsIEventQueueService.h"
#include "nsIMIMEService.h" #include "nsIMIMEService.h"
#include "nsIPrefBranch.h"
#include "nsXPIDLString.h" #include "nsXPIDLString.h"
#include "nsString.h" #include "nsString.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
@ -49,6 +48,7 @@ class nsHttpHeaderArray;
class nsHttpTransaction; class nsHttpTransaction;
class nsHttpAuthCache; class nsHttpAuthCache;
class nsIHttpChannel; class nsIHttpChannel;
class nsIPrefBranch;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// nsHttpHandler - protocol handler for HTTP and HTTPS // nsHttpHandler - protocol handler for HTTP and HTTPS
@ -182,7 +182,8 @@ private:
// //
void BuildUserAgent(); void BuildUserAgent();
void InitUserAgentComponents(); void InitUserAgentComponents();
void PrefsChanged(const char *pref = nsnull); void PrefsChanged(nsIPrefBranch *prefs, const char *pref = nsnull);
void GetPrefBranch(nsIPrefBranch **);
nsresult SetAccept(const char *); nsresult SetAccept(const char *);
nsresult SetAcceptLanguages(const char *); nsresult SetAcceptLanguages(const char *);
@ -196,7 +197,6 @@ private:
// cached services // cached services
nsCOMPtr<nsIIOService> mIOService; nsCOMPtr<nsIIOService> mIOService;
nsCOMPtr<nsIPrefBranch> mPrefs;
nsCOMPtr<nsIProxyObjectManager> mProxyMgr; nsCOMPtr<nsIProxyObjectManager> mProxyMgr;
nsCOMPtr<nsIEventQueueService> mEventQueueService; nsCOMPtr<nsIEventQueueService> mEventQueueService;
nsCOMPtr<nsINetModuleMgr> mNetModuleMgr; nsCOMPtr<nsINetModuleMgr> mNetModuleMgr;
@ -258,6 +258,8 @@ private:
nsCString mUserAgent; nsCString mUserAgent;
nsXPIDLCString mUserAgentOverride; nsXPIDLCString mUserAgentOverride;
PRPackedBool mUserAgentIsDirty; // true if mUserAgent should be rebuilt PRPackedBool mUserAgentIsDirty; // true if mUserAgent should be rebuilt
PRPackedBool mUseCache;
}; };
#endif // nsHttpHandler_h__ #endif // nsHttpHandler_h__