summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-11-27 12:58:02 +0000
committerMoonchild <moonchild@palemoon.org>2020-11-27 12:58:02 +0000
commitb863bd2edc94c16498edc3274531f57fbfc30d3f (patch)
tree7f23ae89939b79400774643c0e7a658b0ce7cb36
parenta8a397fbceb78d2338e214e583be4f02797637d1 (diff)
downloaduxp-b863bd2edc94c16498edc3274531f57fbfc30d3f.tar.gz
Issue #1684 - Move global user-agent override to networking component.
Since this is a http protocol networking feature, it belongs in the networking branch of our preferences.
-rw-r--r--netwerk/protocol/http/nsHttpHandler.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp
index 7a29e041ba..6e8ccc7bc0 100644
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -80,7 +80,8 @@
#include "mozilla/net/HttpChannelChild.h"
-#define UA_PREF_PREFIX "general.useragent."
+#define UA_PREF_PREFIX "useragent."
+#define GENERAL_UA_PREF_PREFIX "general.useragent."
#ifdef XP_WIN
#define UA_SPARE_PLATFORM
#endif
@@ -95,7 +96,8 @@
#define SECURITY_PREFIX "security."
#define NEW_TAB_REMOTE_MODE "browser.newtabpage.remote.mode"
-#define UA_PREF(_pref) UA_PREF_PREFIX _pref
+#define GUA_PREF(_pref) GENERAL_UA_PREF_PREFIX _pref
+#define UA_PREF(_pref) HTTP_PREF_PREFIX UA_PREF_PREFIX _pref
#define HTTP_PREF(_pref) HTTP_PREF_PREFIX _pref
#define BROWSER_PREF(_pref) BROWSER_PREF_PREFIX _pref
@@ -686,7 +688,7 @@ const nsAFlatCString &
nsHttpHandler::UserAgent()
{
if (mUserAgentOverride) {
- LOG(("using general.useragent.override : %s\n", mUserAgentOverride.get()));
+ LOG(("Using user-agent override : %s\n", mUserAgentOverride.get()));
return mUserAgentOverride;
}
@@ -931,8 +933,8 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
bool cVar = false;
- if (PREF_CHANGED(UA_PREF("appVersionIsBuildID"))) {
- rv = prefs->GetBoolPref(UA_PREF("appVersionIsBuildID"), &cVar);
+ if (PREF_CHANGED(GUA_PREF("appVersionIsBuildID"))) {
+ rv = prefs->GetBoolPref(GUA_PREF("appVersionIsBuildID"), &cVar);
mAppVersionIsBuildID = (NS_SUCCEEDED(rv) && cVar);
// Rebuild application version string.
@@ -941,8 +943,8 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
mUserAgentIsDirty = true;
}
- if (PREF_CHANGED(UA_PREF("compatMode.gecko"))) {
- rv = prefs->GetBoolPref(UA_PREF("compatMode.gecko"), &cVar);
+ if (PREF_CHANGED(GUA_PREF("compatMode.gecko"))) {
+ rv = prefs->GetBoolPref(GUA_PREF("compatMode.gecko"), &cVar);
mCompatGeckoEnabled = (NS_SUCCEEDED(rv) && cVar);
// Rebuild rv: and Goanna slice version
@@ -965,8 +967,8 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
mUserAgentIsDirty = true;
}
- if (PREF_CHANGED(UA_PREF("compatMode.firefox"))) {
- rv = prefs->GetBoolPref(UA_PREF("compatMode.firefox"), &cVar);
+ if (PREF_CHANGED(GUA_PREF("compatMode.firefox"))) {
+ rv = prefs->GetBoolPref(GUA_PREF("compatMode.firefox"), &cVar);
mCompatFirefoxEnabled = (NS_SUCCEEDED(rv) && cVar);
mUserAgentIsDirty = true;
}
@@ -974,8 +976,8 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
// general.useragent.compatMode.version
// This is the version number used in rv: for Gecko compatibility
// and in the Firefox/nn.nn slice when compatMode.firefox is enabled.
- if (PREF_CHANGED(UA_PREF("compatMode.version"))) {
- prefs->GetCharPref(UA_PREF("compatMode.version"),
+ if (PREF_CHANGED(GUA_PREF("compatMode.version"))) {
+ prefs->GetCharPref(GUA_PREF("compatMode.version"),
getter_Copies(mCompatFirefoxVersion));
// rebuild mMisc and compatMode slice
@@ -992,8 +994,8 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
}
// general.useragent.override
- if (PREF_CHANGED(UA_PREF("override"))) {
- prefs->GetCharPref(UA_PREF("override"),
+ if (PREF_CHANGED(UA_PREF("global_override"))) {
+ prefs->GetCharPref(UA_PREF("global_override"),
getter_Copies(mUserAgentOverride));
mUserAgentIsDirty = true;
}