summaryrefslogtreecommitdiffstats
path: root/netwerk/protocol
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-11-15 23:10:49 +0000
committerMoonchild <moonchild@palemoon.org>2020-11-15 23:11:24 +0000
commit3abb8e28add1be2c2ec2f53a20bd105bde64a5b2 (patch)
tree465194ef093f1dd4cdc1fc8ec848b9361b0555a3 /netwerk/protocol
parent18df01eb5498c954044f96c346026da0238d2e61 (diff)
downloadUXP-3abb8e28add1be2c2ec2f53a20bd105bde64a5b2.tar
UXP-3abb8e28add1be2c2ec2f53a20bd105bde64a5b2.tar.gz
UXP-3abb8e28add1be2c2ec2f53a20bd105bde64a5b2.tar.lz
UXP-3abb8e28add1be2c2ec2f53a20bd105bde64a5b2.tar.xz
UXP-3abb8e28add1be2c2ec2f53a20bd105bde64a5b2.zip
Revert "Issue #1684 - Remove global UA override preference and supporting code."
This reverts commit 18df01eb5498c954044f96c346026da0238d2e61. Backed out for devtools breakage.
Diffstat (limited to 'netwerk/protocol')
-rw-r--r--netwerk/protocol/http/nsHttpHandler.cpp12
-rw-r--r--netwerk/protocol/http/nsHttpHandler.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp
index 0ae589151..7a29e041b 100644
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -685,6 +685,11 @@ nsHttpHandler::BuildAppVersion()
const nsAFlatCString &
nsHttpHandler::UserAgent()
{
+ if (mUserAgentOverride) {
+ LOG(("using general.useragent.override : %s\n", mUserAgentOverride.get()));
+ return mUserAgentOverride;
+ }
+
if (mUserAgentIsDirty) {
BuildUserAgent();
mUserAgentIsDirty = false;
@@ -986,6 +991,13 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
mUserAgentIsDirty = true;
}
+ // general.useragent.override
+ if (PREF_CHANGED(UA_PREF("override"))) {
+ prefs->GetCharPref(UA_PREF("override"),
+ getter_Copies(mUserAgentOverride));
+ mUserAgentIsDirty = true;
+ }
+
//
// HTTP options
//
diff --git a/netwerk/protocol/http/nsHttpHandler.h b/netwerk/protocol/http/nsHttpHandler.h
index 549b82205..4f632e078 100644
--- a/netwerk/protocol/http/nsHttpHandler.h
+++ b/netwerk/protocol/http/nsHttpHandler.h
@@ -506,6 +506,7 @@ private:
nsCString mDeviceModelId;
nsCString mUserAgent;
+ nsXPIDLCString mUserAgentOverride;
bool mUserAgentIsDirty; // true if mUserAgent should be rebuilt
bool mAcceptLanguagesIsDirty;