diff options
Diffstat (limited to 'netwerk')
-rw-r--r-- | netwerk/protocol/http/UserAgentOverrides.jsm | 5 | ||||
-rw-r--r-- | netwerk/protocol/http/UserAgentUpdates.jsm | 30 |
2 files changed, 4 insertions, 31 deletions
diff --git a/netwerk/protocol/http/UserAgentOverrides.jsm b/netwerk/protocol/http/UserAgentOverrides.jsm index 037aa575b..aa1325a64 100644 --- a/netwerk/protocol/http/UserAgentOverrides.jsm +++ b/netwerk/protocol/http/UserAgentOverrides.jsm @@ -18,6 +18,9 @@ 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"] + .getService(Ci.nsIHttpProtocolHandler) + .oscpu + ";"; const MAX_OVERRIDE_FOR_HOST_CACHE_SIZE = 250; XPCOMUtils.defineLazyServiceGetter(this, "ppmm", @@ -143,7 +146,7 @@ function getUserAgentFromOverride(override) if (search && replace) { userAgent = DEFAULT_UA.replace(new RegExp(search, "g"), replace); } else { - userAgent = override; + userAgent = override.replace(/%OS_SLICE%/g, OS_SLICE); } gBuiltUAs.set(override, userAgent); return userAgent; diff --git a/netwerk/protocol/http/UserAgentUpdates.jsm b/netwerk/protocol/http/UserAgentUpdates.jsm index 4b3ae574a..cd21b78b3 100644 --- a/netwerk/protocol/http/UserAgentUpdates.jsm +++ b/netwerk/protocol/http/UserAgentUpdates.jsm @@ -17,15 +17,9 @@ XPCOMUtils.defineLazyModuleGetter( this, "FileUtils", "resource://gre/modules/FileUtils.jsm"); XPCOMUtils.defineLazyModuleGetter( - this, "NetUtil", "resource://gre/modules/NetUtil.jsm"); - -XPCOMUtils.defineLazyModuleGetter( this, "OS", "resource://gre/modules/osfile.jsm"); XPCOMUtils.defineLazyModuleGetter( - this, "Promise", "resource://gre/modules/Promise.jsm"); - -XPCOMUtils.defineLazyModuleGetter( this, "UpdateUtils", "resource://gre/modules/UpdateUtils.jsm"); XPCOMUtils.defineLazyServiceGetter( @@ -64,30 +58,6 @@ const PREF_APP_DISTRIBUTION_VERSION = "distribution.version"; var gInitialized = false; -function readChannel(url) { - return new Promise((resolve, reject) => { - try { - let channel = NetUtil.newChannel({uri: url, loadUsingSystemPrincipal: true}); - channel.contentType = "application/json"; - - NetUtil.asyncFetch(channel, (inputStream, status) => { - if (!Components.isSuccessCode(status)) { - reject(); - return; - } - - let data = JSON.parse( - NetUtil.readInputStreamToString(inputStream, inputStream.available()) - ); - resolve(data); - }); - } catch (ex) { - reject(new Error("UserAgentUpdates: Could not fetch " + url + " " + - ex + "\n" + ex.stack)); - } - }); -} - this.UserAgentUpdates = { init: function(callback) { if (gInitialized) { |