mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-14 12:13:22 +00:00
Fix bug #56753. The HTTP handler will now recognize if someone changes the misc field of the user agent after it's been created. r=gagan, sr=mscott
This commit is contained in:
parent
4e5a0a5d8f
commit
6161f6aad2
@ -19,6 +19,7 @@
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
* Christopher Blizzard <blizzard@mozilla.org>
|
||||
*/
|
||||
|
||||
#include "nspr.h"
|
||||
@ -769,6 +770,8 @@ nsHTTPHandler::Init()
|
||||
HTTPPrefsCallback, (void*)this);
|
||||
mPrefs->RegisterCallback(UA_PREF_PREFIX "locale",
|
||||
HTTPPrefsCallback, (void*)this);
|
||||
mPrefs->RegisterCallback(UA_PREF_PREFIX "misc",
|
||||
HTTPPrefsCallback, (void *)this);
|
||||
PrefsChanged();
|
||||
|
||||
rv = InitUserAgentComponents();
|
||||
@ -835,6 +838,8 @@ nsHTTPHandler::~nsHTTPHandler()
|
||||
HTTPPrefsCallback, (void*)this);
|
||||
mPrefs->UnregisterCallback(UA_PREF_PREFIX "locale",
|
||||
HTTPPrefsCallback, (void*)this);
|
||||
mPrefs->UnregisterCallback(UA_PREF_PREFIX "misc",
|
||||
HTTPPrefsCallback, (void *)this);
|
||||
}
|
||||
|
||||
CRTFREEIF (mAcceptLanguages);
|
||||
@ -1471,6 +1476,19 @@ nsHTTPHandler::PrefsChanged(const char* pref)
|
||||
}
|
||||
}
|
||||
|
||||
// general.useragent.misc
|
||||
if ((bChangedAll) || !PL_strcmp(pref, UA_PREF_PREFIX "misc")) {
|
||||
nsXPIDLCString uval;
|
||||
nsresult rv = NS_OK;
|
||||
rv = mPrefs->CopyCharPref(UA_PREF_PREFIX "misc",
|
||||
getter_Copies(uval));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mAppMisc.Assign(uval);
|
||||
// rebuild the user agent
|
||||
BuildUserAgent();
|
||||
}
|
||||
}
|
||||
|
||||
nsXPIDLCString acceptEncodings;
|
||||
rv = mPrefs->CopyCharPref("network.http.accept-encoding", getter_Copies(acceptEncodings));
|
||||
if (NS_SUCCEEDED (rv))
|
||||
|
Loading…
x
Reference in New Issue
Block a user