Description: Add "Ubuntu" to the platform part of the UA string
Author: Chris Coulson <chris.coulson@canonical.com>
Forwarded: not-needed

Index: b/netwerk/protocol/http/nsHttpHandler.cpp
===================================================================
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -520,6 +523,9 @@
   LOG(("> misc = %s\n", mMisc.get()));
   LOG(("> product = %s\n", mProduct.get()));
   LOG(("> product-sub = %s\n", mProductSub.get()));
+#ifdef MOZ_UA_VENDOR
+  LOG(("> vendor = %s\n", mVendor.get()));
+#endif
   LOG(("> app-name = %s\n", mAppName.get()));
   LOG(("> app-version = %s\n", mAppVersion.get()));
   LOG(("> compat-firefox = %s\n", mCompatFirefox.get()));
@@ -877,7 +883,11 @@
                          mOscpu.Length() + mMisc.Length() + mProduct.Length() +
                          mProductSub.Length() + mAppName.Length() +
                          mAppVersion.Length() + mCompatFirefox.Length() +
-                         mCompatDevice.Length() + mDeviceModelId.Length() + 13);
+                         mCompatDevice.Length() + mDeviceModelId.Length() +
+#ifdef MOZ_UA_VENDOR
+                         mVendor.Length() +
+#endif
+                         15);
 
   // Application portion
   mUserAgent.Assign(mLegacyAppName);
@@ -893,6 +903,10 @@
     mUserAgent.AppendLiteral("; ");
   }
 #endif
+#ifdef MOZ_UA_VENDOR
+  mUserAgent += mVendor;
+  mUserAgent.AppendLiteral("; ");
+#endif
   if (!mCompatDevice.IsEmpty()) {
     mUserAgent += mCompatDevice;
     mUserAgent.AppendLiteral("; ");
Index: b/netwerk/protocol/http/nsHttpHandler.h
===================================================================
--- a/netwerk/protocol/http/nsHttpHandler.h
+++ b/netwerk/protocol/http/nsHttpHandler.h
@@ -514,6 +514,9 @@
   // useragent components
   nsCString mLegacyAppName{"Mozilla"};
   nsCString mLegacyAppVersion{"5.0"};
+#ifdef MOZ_UA_VENDOR
+  nsCString mVendor{MOZ_UA_VENDOR};
+#endif
   nsCString mPlatform;
   nsCString mOscpu;
   nsCString mMisc;
Index: b/old-configure.in
===================================================================
--- a/old-configure.in
+++ b/old-configure.in
@@ -1969,6 +1969,16 @@
   AC_MSG_RESULT([no])
 fi
 
+# Allow someone to add a vendor component to the default user agent string
+MOZ_ARG_WITH_STRING(ua-vendor,
+[--with-ua-vendor=VENDOR sets MOZ_UA_VENDOR to VENDOR],
+WITH_UA_VENDOR=$withval,
+)
+
+if test -n "$WITH_UA_VENDOR" ; then
+    MOZ_UA_VENDOR="$WITH_UA_VENDOR"
+fi
+
 AC_SUBST(MOZ_OFFICIAL_BRANDING)
 if test -n "$MOZ_OFFICIAL_BRANDING"; then
   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
@@ -4050,6 +4060,7 @@
 
 AC_SUBST(MOZ_APP_DISPLAYNAME)
 AC_SUBST(MOZ_APP_VENDOR)
+AC_SUBST(MOZ_UA_VENDOR)
 AC_SUBST(MOZ_APP_PROFILE)
 AC_SUBST(MOZ_APP_ID)
 AC_SUBST(MAR_CHANNEL_ID)
Index: b/build/moz.configure/old.configure
===================================================================
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -262,6 +262,7 @@
     "--with-branding",
     "--with-distribution-id",
     "--with-macbundlename-prefix",
+    "--with-ua-vendor",
     "--x-includes",
     "--x-libraries",
 )
Index: b/netwerk/protocol/http/moz.build
===================================================================
--- a/netwerk/protocol/http/moz.build
+++ b/netwerk/protocol/http/moz.build
@@ -154,4 +154,7 @@
     "components.conf",
 ]
 
+if CONFIG["MOZ_UA_VENDOR"]:
+    DEFINES["MOZ_UA_VENDOR"] = "\"%s\"" % CONFIG["MOZ_UA_VENDOR"]
+
 include("/tools/fuzzing/libfuzzer-config.mozbuild")
