fix for bug 59975 - general.useragent.override ignored, r=darin@netscape.com,sr=mscott@netscape.com

This commit is contained in:
neeti%netscape.com 2001-01-11 15:17:30 +00:00
parent be43d5e2a0
commit 7dc2d704b2

View File

@ -774,6 +774,8 @@ nsHTTPHandler::Init()
HTTPPrefsCallback, (void*)this);
mPrefs->RegisterCallback(INTL_ACCEPT_LANGUAGES,
HTTPPrefsCallback, (void*)this);
mPrefs->RegisterCallback(UA_PREF_PREFIX "override",
HTTPPrefsCallback, (void*)this);
mPrefs->RegisterCallback(UA_PREF_PREFIX "locale",
HTTPPrefsCallback, (void*)this);
mPrefs->RegisterCallback(UA_PREF_PREFIX "misc",
@ -844,6 +846,8 @@ nsHTTPHandler::~nsHTTPHandler()
HTTPPrefsCallback, (void*)this);
mPrefs->UnregisterCallback(INTL_ACCEPT_LANGUAGES,
HTTPPrefsCallback, (void*)this);
mPrefs->UnregisterCallback(UA_PREF_PREFIX "override",
HTTPPrefsCallback, (void*)this);
mPrefs->UnregisterCallback(UA_PREF_PREFIX "locale",
HTTPPrefsCallback, (void*)this);
mPrefs->UnregisterCallback(UA_PREF_PREFIX "misc",
@ -1467,6 +1471,19 @@ nsHTTPHandler::PrefsChanged(const char* pref)
#endif
}
// general.useragent.override
if ((bChangedAll) || !PL_strcmp(pref, UA_PREF_PREFIX "override")) {
nsXPIDLCString uval;
nsresult rv = NS_OK;
rv = mPrefs->CopyCharPref(UA_PREF_PREFIX "override",
getter_Copies(uval));
if (NS_SUCCEEDED(rv)) {
mAppUserAgentOverride.Assign(uval);
// rebuild the user agent
BuildUserAgent();
}
}
if ( (bChangedAll)|| !PL_strcmp(pref, UA_PREF_PREFIX "locale") ) {// general.useragent.locale
// 55156: re-Gather locale.
nsXPIDLString uval;