summaryrefslogtreecommitdiffstats
path: root/netwerk
diff options
context:
space:
mode:
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')