summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--browser/config/version.txt2
-rw-r--r--browser/config/version_display.txt2
-rw-r--r--modules/libpref/init/all.js2
-rw-r--r--netwerk/protocol/http/nsHttpHandler.cpp63
-rw-r--r--netwerk/protocol/http/nsHttpHandler.h3
-rw-r--r--old-configure.in3
6 files changed, 63 insertions, 12 deletions
diff --git a/browser/config/version.txt b/browser/config/version.txt
index b406fbef6..d90a8c220 100644
--- a/browser/config/version.txt
+++ b/browser/config/version.txt
@@ -1 +1 @@
-55.0.0
+52.9.0
diff --git a/browser/config/version_display.txt b/browser/config/version_display.txt
index b406fbef6..d90a8c220 100644
--- a/browser/config/version_display.txt
+++ b/browser/config/version_display.txt
@@ -1 +1 @@
-55.0.0
+52.9.0
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index aaf50bff6..82b9bafd3 100644
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -21,7 +21,9 @@
pref("keyword.enabled", false);
pref("general.useragent.locale", "chrome://global/locale/intl.properties");
+pref("general.useragent.compatMode.gecko", false);
pref("general.useragent.compatMode.firefox", false);
+pref("general.useragent.appVersionIsBuildID", true);
// This pref exists only for testing purposes. In order to disable all
// overrides by default, don't initialize UserAgentOverrides.jsm.
diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp
index 1ddffabff..3c46bbf80 100644
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -103,6 +103,9 @@
#define NS_HTTP_PROTOCOL_FLAGS (URI_STD | ALLOWS_PROXY | ALLOWS_PROXY_HTTP | URI_LOADABLE_BY_ANYONE)
+// Firefox compatibility version we claim in our UA by default
+#define MOZILLA_COMPATVERSION "52.9"
+
//-----------------------------------------------------------------------------
namespace mozilla {
@@ -316,9 +319,11 @@ nsHttpHandler::Init()
nsHttpChannelAuthProvider::InitializePrefs();
- mMisc.AssignLiteral("rv:" MOZILLA_UAVERSION);
+ // rv: should have the Firefox/Gecko compatversion for web compatibility
+ mMisc.AssignLiteral("rv:" MOZILLA_COMPATVERSION);
- mCompatFirefox.AssignLiteral("Firefox/" MOZILLA_UAVERSION);
+ mCompatGecko.AssignLiteral("Gecko/20100101");
+ mCompatFirefox.AssignLiteral("Firefox/" MOZILLA_COMPATVERSION);
nsCOMPtr<nsIXULAppInfo> appInfo =
do_GetService("@mozilla.org/xre/app-info;1");
@@ -330,12 +335,30 @@ nsHttpHandler::Init()
if (mAppName.Length() == 0) {
appInfo->GetName(mAppName);
}
- appInfo->GetVersion(mAppVersion);
mAppName.StripChars(R"( ()<>@,;:\"/[]?={})");
+ }
+
+ nsCString dynamicBuildID;
+ if (appInfo) {
+ appInfo->GetPlatformBuildID(dynamicBuildID);
+ if (dynamicBuildID.Length() > 8 )
+ dynamicBuildID.Left(dynamicBuildID, 8);
+ }
+
+ if (mAppVersionIsBuildID) {
+ // Override BuildID
+ mAppVersion.AssignLiteral(MOZ_UA_BUILDID);
+ } else if (appInfo) {
+ appInfo->GetVersion(mAppVersion);
} else {
- mAppVersion.AssignLiteral(MOZ_APP_UA_VERSION);
+ // Fall back to platform if appInfo is unavailable
+ mAppVersion.Assign(MOZILLA_UAVERSION);
}
+ // If there's no override set, set it to the dynamic BuildID
+ if (mAppVersion.IsEmpty())
+ mAppVersion.Assign(dynamicBuildID);
+
mSessionStartTime = NowInSeconds();
mHandlerActive = true;
@@ -351,11 +374,11 @@ nsHttpHandler::Init()
mRequestContextService =
do_GetService("@mozilla.org/network/request-context-service;1");
-#if defined(ANDROID) || defined(MOZ_MULET)
+ // Goanna slice version
mProductSub.AssignLiteral(MOZILLA_UAVERSION);
-#else
- mProductSub.AssignLiteral("20100101");
-#endif
+
+ if (mProductSub.IsEmpty())
+ mProductSub.Assign(dynamicBuildID);
#if DEBUG
// dump user agent prefs
@@ -369,6 +392,7 @@ nsHttpHandler::Init()
LOG(("> app-name = %s\n", mAppName.get()));
LOG(("> app-version = %s\n", mAppVersion.get()));
LOG(("> compat-firefox = %s\n", mCompatFirefox.get()));
+ LOG(("> compat-gecko = %s\n", mCompatGecko.get()));
LOG(("> user-agent = %s\n", UserAgent().get()));
#endif
@@ -678,9 +702,10 @@ nsHttpHandler::BuildUserAgent()
mAppName.Length() +
mAppVersion.Length() +
mCompatFirefox.Length() +
+ mCompatGecko.Length() +
mCompatDevice.Length() +
mDeviceModelId.Length() +
- 13);
+ 14);
// Application portion
mUserAgent.Assign(mLegacyAppName);
@@ -710,6 +735,12 @@ nsHttpHandler::BuildUserAgent()
}
mUserAgent += mMisc;
mUserAgent += ')';
+
+ if(mCompatGeckoEnabled) {
+ // Provide frozen Gecko/20100101 slice
+ mUserAgent += ' ';
+ mUserAgent += mCompatGecko;
+ }
// Product portion
mUserAgent += ' ';
@@ -719,7 +750,7 @@ nsHttpHandler::BuildUserAgent()
bool isFirefox = mAppName.EqualsLiteral("Firefox");
if (isFirefox || mCompatFirefoxEnabled) {
- // "Firefox/x.y" (compatibility) app token
+ // Provide "Firefox/x.y" (compatibility) app token
mUserAgent += ' ';
mUserAgent += mCompatFirefox;
}
@@ -966,6 +997,18 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
bool cVar = false;
+ if (PREF_CHANGED(UA_PREF("appVersionIsBuildID"))) {
+ rv = prefs->GetBoolPref(UA_PREF("appVersionIsBuildID"), &cVar);
+ mAppVersionIsBuildID = (NS_SUCCEEDED(rv) && cVar);
+ mUserAgentIsDirty = true;
+ }
+
+ if (PREF_CHANGED(UA_PREF("compatMode.gecko"))) {
+ rv = prefs->GetBoolPref(UA_PREF("compatMode.gecko"), &cVar);
+ mCompatGeckoEnabled = (NS_SUCCEEDED(rv) && cVar);
+ mUserAgentIsDirty = true;
+ }
+
if (PREF_CHANGED(UA_PREF("compatMode.firefox"))) {
rv = prefs->GetBoolPref(UA_PREF("compatMode.firefox"), &cVar);
mCompatFirefoxEnabled = (NS_SUCCEEDED(rv) && cVar);
diff --git a/netwerk/protocol/http/nsHttpHandler.h b/netwerk/protocol/http/nsHttpHandler.h
index 13cc72e8e..7121d4bc2 100644
--- a/netwerk/protocol/http/nsHttpHandler.h
+++ b/netwerk/protocol/http/nsHttpHandler.h
@@ -485,6 +485,9 @@ private:
nsXPIDLCString mProductSub;
nsXPIDLCString mAppName;
nsXPIDLCString mAppVersion;
+ bool mAppVersionIsBuildID;
+ nsCString mCompatGecko;
+ bool mCompatGeckoEnabled;
nsCString mCompatFirefox;
bool mCompatFirefoxEnabled;
nsXPIDLCString mCompatDevice;
diff --git a/old-configure.in b/old-configure.in
index 92a5f729e..4fbe49b96 100644
--- a/old-configure.in
+++ b/old-configure.in
@@ -5459,6 +5459,9 @@ fi
AC_SUBST(MOZ_APP_STATIC_INI)
+AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
+AC_SUBST(MOZ_UA_BUILDID)
+
AC_SUBST(MOZ_PKG_SPECIAL)
AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)