summaryrefslogtreecommitdiffstats
path: root/netwerk
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2020-04-05 16:38:22 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-05 16:38:22 +0200
commiteadff6165c87d78258fdcee8779ae5442cc92ea0 (patch)
treeb46f197f218c1f7c635cefcb8077f087e6d9d5ae /netwerk
parentd0cf67573ca6d69c9f00c7e9a70a64158fbca304 (diff)
downloadUXP-eadff6165c87d78258fdcee8779ae5442cc92ea0.tar
UXP-eadff6165c87d78258fdcee8779ae5442cc92ea0.tar.gz
UXP-eadff6165c87d78258fdcee8779ae5442cc92ea0.tar.lz
UXP-eadff6165c87d78258fdcee8779ae5442cc92ea0.tar.xz
UXP-eadff6165c87d78258fdcee8779ae5442cc92ea0.zip
Issue #1505 - Part 2: Store application build ID in nsHttpHandler
Since we're needing to reuse this several times, it makes it simpler to just get it once in init and storing it.
Diffstat (limited to 'netwerk')
-rw-r--r--netwerk/protocol/http/nsHttpHandler.cpp28
-rw-r--r--netwerk/protocol/http/nsHttpHandler.h1
2 files changed, 13 insertions, 16 deletions
diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp
index cb3c7ae04..36f50a57f 100644
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -174,6 +174,7 @@ nsHttpHandler::nsHttpHandler()
, mLegacyAppName("Mozilla")
, mLegacyAppVersion("5.0")
, mProduct("Goanna")
+ , mAppBuildID("20200101")
, mCompatFirefoxEnabled(false)
, mCompatFirefoxVersion("68.9")
, mUserAgentIsDirty(true)
@@ -301,6 +302,14 @@ nsHttpHandler::Init()
nsCOMPtr<nsIXULAppInfo> appInfo =
do_GetService("@mozilla.org/xre/app-info;1");
+ nsCString dynamicBuildID;
+ if (appInfo) {
+ appInfo->GetPlatformBuildID(dynamicBuildID);
+ if (dynamicBuildID.Length() > 8 )
+ dynamicBuildID.Left(dynamicBuildID, 8);
+ }
+ mAppBuildID.Assign(dynamicBuildID);
+
mAppName.AssignLiteral(MOZ_APP_UA_NAME);
if (mAppName.Length() == 0 && appInfo) {
// Try to get the UA name from appInfo, falling back to the name
@@ -332,13 +341,7 @@ nsHttpHandler::Init()
mProductSub.AssignLiteral(MOZILLA_UAVERSION);
if (mProductSub.IsEmpty()) {
- nsCString dynamicBuildID;
- if (appInfo) {
- appInfo->GetPlatformBuildID(dynamicBuildID);
- if (dynamicBuildID.Length() > 8 )
- dynamicBuildID.Left(dynamicBuildID, 8);
- }
- mProductSub.Assign(dynamicBuildID);
+ mProductSub.Assign(mAppBuildID);
}
#if DEBUG
@@ -650,16 +653,9 @@ nsHttpHandler::BuildAppVersion()
{
nsCOMPtr<nsIXULAppInfo> appInfo = do_GetService("@mozilla.org/xre/app-info;1");
- nsCString dynamicBuildID;
- if (appInfo) {
- appInfo->GetPlatformBuildID(dynamicBuildID);
- if (dynamicBuildID.Length() > 8 )
- dynamicBuildID.Left(dynamicBuildID, 8);
- }
-
if (mAppVersionIsBuildID) {
- // Override BuildID
- mAppVersion.Assign(dynamicBuildID);
+ // Override with BuildID
+ mAppVersion.Assign(mAppBuildID);
} else if (appInfo) {
appInfo->GetVersion(mAppVersion);
} else {
diff --git a/netwerk/protocol/http/nsHttpHandler.h b/netwerk/protocol/http/nsHttpHandler.h
index 36fda6ace..4f632e078 100644
--- a/netwerk/protocol/http/nsHttpHandler.h
+++ b/netwerk/protocol/http/nsHttpHandler.h
@@ -501,6 +501,7 @@ private:
nsCString mCompatFirefox;
bool mCompatFirefoxEnabled;
nsCString mCompatFirefoxVersion;
+ nsCString mAppBuildID;
nsXPIDLCString mCompatDevice;
nsCString mDeviceModelId;