summaryrefslogtreecommitdiffstats
path: root/netwerk
diff options
context:
space:
mode:
authorMoonchild <git-repo@palemoon.org>2020-03-28 16:54:43 +0100
committerGitHub <noreply@github.com>2020-03-28 16:54:43 +0100
commit568ea8deaa4fa5f07b6987e75d35e53eb3af66dd (patch)
tree84512aad33854559916b661753e942e73b005a12 /netwerk
parent1039487b75057f5414a26b584a04db395efb8070 (diff)
parente74509ec540e84230508cc1a634eee9551e68ac8 (diff)
downloadUXP-568ea8deaa4fa5f07b6987e75d35e53eb3af66dd.tar
UXP-568ea8deaa4fa5f07b6987e75d35e53eb3af66dd.tar.gz
UXP-568ea8deaa4fa5f07b6987e75d35e53eb3af66dd.tar.lz
UXP-568ea8deaa4fa5f07b6987e75d35e53eb3af66dd.tar.xz
UXP-568ea8deaa4fa5f07b6987e75d35e53eb3af66dd.zip
Merge pull request #1494 from JustOff/PR_osslice_non_windows
Fix building `%OS_SLICE%` on non-Windows platforms
Diffstat (limited to 'netwerk')
-rw-r--r--netwerk/protocol/http/UserAgentOverrides.jsm23
-rw-r--r--netwerk/protocol/http/moz.build4
2 files changed, 22 insertions, 5 deletions
diff --git a/netwerk/protocol/http/UserAgentOverrides.jsm b/netwerk/protocol/http/UserAgentOverrides.jsm
index 425bdfd72..e106f817a 100644
--- a/netwerk/protocol/http/UserAgentOverrides.jsm
+++ b/netwerk/protocol/http/UserAgentOverrides.jsm
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+#ifdef XP_WIN
+#define UA_SPARE_PLATFORM
+#endif
+
"use strict";
this.EXPORTED_SYMBOLS = [ "UserAgentOverrides" ];
@@ -18,9 +22,14 @@ const PREF_OVERRIDES_ENABLED = "general.useragent.site_specific_overrides";
const DEFAULT_UA = Cc["@mozilla.org/network/protocol;1?name=http"]
.getService(Ci.nsIHttpProtocolHandler)
.userAgent;
-const OS_SLICE = Cc["@mozilla.org/network/protocol;1?name=http"]
+const OSCPU = Cc["@mozilla.org/network/protocol;1?name=http"]
+ .getService(Ci.nsIHttpProtocolHandler)
+ .oscpu;
+#ifndef UA_SPARE_PLATFORM
+const PLATFORM = Cc["@mozilla.org/network/protocol;1?name=http"]
.getService(Ci.nsIHttpProtocolHandler)
- .oscpu + ";";
+ .platform;
+#endif
const MAX_OVERRIDE_FOR_HOST_CACHE_SIZE = 250;
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
@@ -37,12 +46,20 @@ var gOverrideFunctions = [
function (aHttpChannel) { return UserAgentOverrides.getOverrideForURI(aHttpChannel.URI); }
];
var gBuiltUAs = new Map;
+var gOSSlice;
this.UserAgentOverrides = {
init: function uao_init() {
if (gInitialized)
return;
+ gOSSlice = OSCPU + ";";
+#ifndef UA_SPARE_PLATFORM
+ if (PLATFORM != "") {
+ gOSSlice = PLATFORM + "; " + gOSSlice;
+ }
+#endif
+
gPrefBranch = Services.prefs.getBranch("general.useragent.override.");
gPrefBranch.addObserver("", buildOverrides, false);
@@ -151,7 +168,7 @@ function getUserAgentFromOverride(override)
if (search && replace) {
userAgent = DEFAULT_UA.replace(new RegExp(search, "g"), replace);
} else {
- userAgent = override.replace(/%OS_SLICE%/g, OS_SLICE);
+ userAgent = override.replace(/%OS_SLICE%/g, gOSSlice);
}
gBuiltUAs.set(override, userAgent);
return userAgent;
diff --git a/netwerk/protocol/http/moz.build b/netwerk/protocol/http/moz.build
index 37e801f2f..a1b57876b 100644
--- a/netwerk/protocol/http/moz.build
+++ b/netwerk/protocol/http/moz.build
@@ -99,9 +99,9 @@ IPDL_SOURCES += [
'PHttpChannel.ipdl',
]
-EXTRA_JS_MODULES += ['UserAgentOverrides.jsm']
+EXTRA_JS_MODULES += ['UserAgentUpdates.jsm']
-EXTRA_PP_JS_MODULES += ['UserAgentUpdates.jsm']
+EXTRA_PP_JS_MODULES += ['UserAgentOverrides.jsm']
include('/ipc/chromium/chromium-config.mozbuild')