From 33912818661edfbc9d02e23fc82fabde7f290e40 Mon Sep 17 00:00:00 2001 From: Alex Kontos Date: Wed, 21 Mar 2018 20:23:43 -0400 Subject: [PATCH] Remove the Waterfox specific UA for now :-(. Allows better compatibility on the web unfortunately, too many sites check for browser name instead of feature detection. Pretend we're 57.0 as well, so add-ons install propely on the Mozilla AMO. --- modules/libpref/init/all.js | 26 ++++++++++++------------- netwerk/protocol/http/nsHttpHandler.cpp | 19 ++++++++++++------ 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 285e373cdc3a3..b2bf5ced2e4a2 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -23,23 +23,23 @@ pref("preferences.allow.omt-write", false); pref("keyword.enabled", false); pref("general.useragent.locale", "chrome://global/locale/intl.properties"); -pref("general.useragent.compatMode.firefox", true); +pref("general.useragent.compatMode.firefox", false); // This pref exists only for testing purposes. In order to disable all // overrides by default, don't initialize UserAgentOverrides.jsm. pref("general.useragent.site_specific_overrides", true); -#ifdef XP_WIN -pref("general.useragent.override.americanexpress.com", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0"); -pref("general.useragent.override.chase.com", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0"); -pref("general.useragent.override.discordapp.com", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0"); -pref("general.useragent.override.slack.com", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0"); -#endif -#ifdef XP_MACOSX -pref("general.useragent.override.americanexpress.com", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0"); -pref("general.useragent.override.chase.com", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0"); -pref("general.useragent.override.discordapp.com", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0"); -pref("general.useragent.override.slack.com", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0"); -#endif +// #ifdef XP_WIN +// pref("general.useragent.override.americanexpress.com", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0"); +// pref("general.useragent.override.chase.com", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0"); +// pref("general.useragent.override.discordapp.com", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0"); +// pref("general.useragent.override.slack.com", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0"); +// #endif +// #ifdef XP_MACOSX +// pref("general.useragent.override.americanexpress.com", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0"); +// pref("general.useragent.override.chase.com", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0"); +// pref("general.useragent.override.discordapp.com", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0"); +// pref("general.useragent.override.slack.com", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0"); +// #endif pref("general.config.obscure_value", 13); // for MCD .cfg files diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp index dc174047ab3e6..45119bdb78748 100644 --- a/netwerk/protocol/http/nsHttpHandler.cpp +++ b/netwerk/protocol/http/nsHttpHandler.cpp @@ -436,14 +436,17 @@ nsHttpHandler::Init() nsHttpChannelAuthProvider::InitializePrefs(); - mMisc.AssignLiteral("rv:" MOZILLA_UAVERSION); + // mMisc.AssignLiteral("rv:" MOZILLA_UAVERSION); + mMisc.AssignLiteral("rv: 57.0"); - mCompatFirefox.AssignLiteral("Waterfox/" MOZ_APP_UA_VERSION); + // mCompatFirefox.AssignLiteral("Firefox/" MOZILLA_UAVERSION); + mCompatFirefox.AssignLiteral("Firefox/57.0"); nsCOMPtr appInfo = do_GetService("@mozilla.org/xre/app-info;1"); - mAppName.AssignLiteral(MOZ_APP_UA_NAME); + // mAppName.AssignLiteral(MOZ_APP_UA_NAME); + mAppName.AssignLiteral("Firefox"); if (mAppName.Length() == 0 && appInfo) { // Try to get the UA name from appInfo, falling back to the name appInfo->GetUAName(mAppName); @@ -905,12 +908,16 @@ nsHttpHandler::BuildUserAgent() bool isFirefox = mAppName.EqualsLiteral("Firefox"); if (isFirefox || mCompatFirefoxEnabled) { + // "Firefox/x.y" (compatibility) app token mUserAgent += ' '; - mUserAgent += "Firefox"; + mUserAgent += mCompatFirefox; + } + if (!isFirefox) { + // App portion + mUserAgent += ' '; + mUserAgent += mAppName; mUserAgent += '/'; mUserAgent += mAppVersion; - mUserAgent += ' '; - mUserAgent += mCompatFirefox; } }