Bug 581008 - Remove support for appending arbitrary data to the User Agent string. r=jst,khuey sr=dveditz
authorDão Gottwald <dao@mozilla.com>
Fri, 27 Aug 2010 09:02:10 +0200
changeset 51553 99eb6c83cccfb06c24a34cd84bb8cffc5cb0bcba
parent 51552 be22d84c6d1822e17929ac379c36d3f774c57aeb
child 51554 4a800d695ac9ad56982b1eb5e936dabb94dfa827
push idunknown
push userunknown
push dateunknown
reviewersjst, khuey, dveditz
bugs581008
milestone2.0b5pre
Bug 581008 - Remove support for appending arbitrary data to the User Agent string. r=jst,khuey sr=dveditz
browser/app/Makefile.in
browser/app/profile/firefox.js
browser/branding/nightly/configure.sh
browser/branding/unofficial/configure.sh
config/autoconf.mk.in
configure.in
js/src/configure.in
layout/tools/reftest/reftest.js
modules/libpref/src/init/all.js
netwerk/protocol/http/nsHttpHandler.cpp
netwerk/protocol/http/nsHttpHandler.h
netwerk/protocol/http/nsIHttpProtocolHandler.idl
--- a/browser/app/Makefile.in
+++ b/browser/app/Makefile.in
@@ -54,18 +54,16 @@ PREF_JS_EXPORTS = $(srcdir)/profile/fire
 
 # hardcode en-US for the moment
 AB_CD = en-US
 
 DEFINES += -DAB_CD=$(AB_CD)
 
 APP_VERSION = $(shell cat $(srcdir)/../config/version.txt)
 DEFINES += -DAPP_VERSION="$(APP_VERSION)"
-APP_UA_NAME = $(shell echo $(MOZ_APP_DISPLAYNAME) | sed -e's/[^A-Za-z]//g')
-DEFINES += -DAPP_UA_NAME="$(APP_UA_NAME)"
 
 DIST_FILES = application.ini
 
 GRE_MILESTONE = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build Milestone)
 GRE_BUILDID = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build BuildID)
 
 DEFINES += -DGRE_MILESTONE=$(GRE_MILESTONE) -DGRE_BUILDID=$(GRE_BUILDID)
 
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -186,17 +186,16 @@ pref("lightweightThemes.update.enabled",
 
 pref("keyword.enabled", true);
 // Override the default keyword.URL. Empty value means
 // "use the search service's default engine"
 pref("keyword.URL", "");
 
 pref("general.useragent.locale", "@AB_CD@");
 pref("general.skins.selectedSkin", "classic/1.0");
-pref("general.useragent.extra.firefox", "@APP_UA_NAME@/@APP_VERSION@");
 
 pref("general.smoothScroll", false);
 #ifdef UNIX_BUT_NOT_MAC
 pref("general.autoScroll", false);
 #else
 pref("general.autoScroll", true);
 #endif
 
--- a/browser/branding/nightly/configure.sh
+++ b/browser/branding/nightly/configure.sh
@@ -1,1 +1,2 @@
 MOZ_APP_DISPLAYNAME=Minefield
+MOZ_APP_UA_NAME=Minefield
--- a/browser/branding/unofficial/configure.sh
+++ b/browser/branding/unofficial/configure.sh
@@ -1,1 +1,2 @@
 MOZ_APP_DISPLAYNAME="MozillaDeveloperPreview"
+MOZ_APP_UA_NAME="MozillaDeveloperPreview"
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -45,18 +45,18 @@ target          = @target@
 ac_configure_args = @ac_configure_args@
 BUILD_MODULES	= @BUILD_MODULES@
 MOZILLA_VERSION = @MOZILLA_VERSION@
 FIREFOX_VERSION	= @FIREFOX_VERSION@
 
 MOZ_BUILD_APP = @MOZ_BUILD_APP@
 MOZ_APP_NAME	= @MOZ_APP_NAME@
 MOZ_APP_DISPLAYNAME = @MOZ_APP_DISPLAYNAME@
+MOZ_APP_UA_NAME = @MOZ_APP_UA_NAME@
 MOZ_APP_VERSION = @MOZ_APP_VERSION@
-MOZ_APP_UA_EXTRA = @MOZ_APP_UA_EXTRA@
 
 MOZ_PKG_SPECIAL = @MOZ_PKG_SPECIAL@
 
 prefix		= @prefix@
 exec_prefix	= @exec_prefix@
 bindir		= @bindir@
 includedir	= @includedir@/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
 libdir		= @libdir@
--- a/configure.in
+++ b/configure.in
@@ -8762,18 +8762,21 @@ AC_SUBST(MOZ_OS2_USE_DECLSPEC)
 
 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
 AC_SUBST(MOZ_TIMELINE)
 AC_SUBST(OGLES_SDK_DIR)
 
 AC_SUBST(MOZ_APP_NAME)
 AC_SUBST(MOZ_APP_DISPLAYNAME)
+AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
+AC_SUBST(MOZ_APP_UA_NAME)
+AC_DEFINE_UNQUOTED(MOZ_APP_VERSION, "$MOZ_APP_VERSION")
 AC_SUBST(MOZ_APP_VERSION)
-AC_SUBST(MOZ_APP_UA_EXTRA)
+AC_DEFINE_UNQUOTED(FIREFOX_VERSION, "$FIREFOX_VERSION")
 AC_SUBST(FIREFOX_VERSION)
 
 AC_SUBST(MOZ_PKG_SPECIAL)
 
 AC_SUBST(MOZILLA_OFFICIAL)
 
 dnl win32 options
 AC_SUBST(MOZ_MAPINFO)
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -5059,17 +5059,19 @@ AC_SUBST(MOZ_OS2_USE_DECLSPEC)
 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
 AC_SUBST(MOZ_TIMELINE)
 AC_SUBST(WINCE)
 AC_SUBST(WINCE_WINDOWS_MOBILE)
 
 AC_SUBST(MOZ_APP_NAME)
 AC_SUBST(MOZ_APP_DISPLAYNAME)
+AC_SUBST(MOZ_APP_UA_NAME)
 AC_SUBST(MOZ_APP_VERSION)
+AC_SUBST(FIREFOX_VERSION)
 
 AC_SUBST(MOZ_PKG_SPECIAL)
 
 AC_SUBST(MOZILLA_OFFICIAL)
 
 dnl win32 options
 AC_SUBST(MOZ_MAPINFO)
 AC_SUBST(MOZ_BROWSE_INFO)
--- a/layout/tools/reftest/reftest.js
+++ b/layout/tools/reftest/reftest.js
@@ -348,18 +348,18 @@ function BuildConditionSandbox(aURL) {
     sandbox.gtk2Widget = xr.widgetToolkit == "gtk2";
     sandbox.qtWidget = xr.widgetToolkit == "qt";
     sandbox.winWidget = xr.widgetToolkit == "windows";
 
     var hh = CC[NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX + "http"].
                  getService(CI.nsIHttpProtocolHandler);
     sandbox.http = {};
     for each (var prop in [ "userAgent", "appName", "appVersion",
-                            "vendor", "vendorSub", "vendorComment",
-                            "product", "productSub", "productComment",
+                            "vendor", "vendorSub",
+                            "product", "productSub",
                             "platform", "oscpu", "language", "misc" ])
         sandbox.http[prop] = hh[prop];
     // see if we have the test plugin available,
     // and set a sandox prop accordingly
     sandbox.haveTestPlugin = false;
     for (var i = 0; i < navigator.mimeTypes.length; i++) {
         if (navigator.mimeTypes[i].type == "application/x-test" &&
             navigator.mimeTypes[i].enabledPlugin != null &&
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -45,16 +45,17 @@
  */
 
 // SYNTAX HINTS:  dashes are delimiters.  Use underscores instead.
 //  The first character after a period must be alphabetic.
 
 pref("keyword.URL", "http://www.google.com/search?ie=UTF-8&oe=utf-8&q=");
 pref("keyword.enabled", false);
 pref("general.useragent.locale", "chrome://global/locale/intl.properties");
+pref("general.useragent.compatMode.firefox", false);
 
 pref("general.config.obscure_value", 13); // for MCD .cfg files
 
 pref("general.warnOnAboutConfig", true);
 
 // maximum number of dated backups to keep at any time
 pref("browser.bookmarks.max_backups",       5);
 
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -25,16 +25,17 @@
  *   Gagan Saksena <gagan@netscape.com>
  *   Pierre Phaneuf <pp@ludusdesign.com>
  *   Christopher Blizzard <blizzard@mozilla.org>
  *   Adrian Havill <havill@redhat.com>
  *   Gervase Markham <gerv@gerv.net>
  *   Bradley Baetz <bbaetz@netscape.com>
  *   Benjamin Smedberg <bsmedberg@covad.net>
  *   Josh Aas <josh@mozilla.com>
+ *   Dão Gottwald <dao@mozilla.com>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either the GNU General Public License Version 2 or later (the "GPL"), or
  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
@@ -114,18 +115,16 @@ extern PRThread *gSocketThread;
 
 static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
 static NS_DEFINE_CID(kStreamConverterServiceCID, NS_STREAMCONVERTERSERVICE_CID);
 static NS_DEFINE_CID(kCookieServiceCID, NS_COOKIESERVICE_CID);
 static NS_DEFINE_CID(kCacheServiceCID, NS_CACHESERVICE_CID);
 static NS_DEFINE_CID(kSocketProviderServiceCID, NS_SOCKETPROVIDERSERVICE_CID);
 
 #define UA_PREF_PREFIX          "general.useragent."
-#define UA_APPNAME              "Mozilla"
-#define UA_APPVERSION           "5.0"
 #ifdef XP_WIN
 #define UA_SPARE_PLATFORM
 #endif
 
 #define HTTP_PREF_PREFIX        "network.http."
 #define INTL_ACCEPT_LANGUAGES   "intl.accept_languages"
 #define INTL_ACCEPT_CHARSET     "intl.charset.default"
 #define NETWORK_ENABLEIDN       "network.enableIDN"
@@ -186,16 +185,18 @@ nsHttpHandler::nsHttpHandler()
     , mRedirectionLimit(10)
     , mInPrivateBrowsingMode(PR_FALSE)
     , mPhishyUserPassLength(1)
     , mQoSBits(0x00)
     , mPipeliningOverSSL(PR_FALSE)
     , mLastUniqueID(NowInSeconds())
     , mSessionStartTime(0)
     , mProduct("Gecko")
+    , mLegacyAppName("Mozilla")
+    , mLegacyAppVersion("5.0")
     , mUserAgentIsDirty(PR_TRUE)
     , mUseCache(PR_TRUE)
     , mPromptTempRedirect(PR_TRUE)
     , mSendSecureXSiteReferrer(PR_TRUE)
     , mEnablePersistentHttpsCaching(PR_FALSE)
 {
 #if defined(PR_LOGGING)
     gHttpLog = PR_NewLogModule("nsHttp");
@@ -270,44 +271,53 @@ nsHttpHandler::Init()
         prefBranch->AddObserver(NETWORK_ENABLEIDN, this, PR_TRUE);
         prefBranch->AddObserver(BROWSER_PREF("disk_cache_ssl"), this, PR_TRUE);
 
         PrefsChanged(prefBranch, nsnull);
     }
 
     mMisc.AssignLiteral("rv:" MOZILLA_VERSION);
 
+    nsCOMPtr<nsIXULAppInfo> appInfo =
+        do_GetService("@mozilla.org/xre/app-info;1");
+
+    mAppName.AssignLiteral(MOZ_APP_UA_NAME);
+    if (mAppName.Length() == 0 && appInfo) {
+        appInfo->GetName(mAppName);
+        appInfo->GetVersion(mAppVersion);
+    } else {
+        mAppVersion.AssignLiteral(MOZ_APP_VERSION);
+    }
+
 #if DEBUG
     // dump user agent prefs
-    LOG(("> app-name = %s\n", mAppName.get()));
-    LOG(("> app-version = %s\n", mAppVersion.get()));
+    LOG(("> legacy-app-name = %s\n", mLegacyAppName.get()));
+    LOG(("> legacy-app-version = %s\n", mLegacyAppVersion.get()));
     LOG(("> platform = %s\n", mPlatform.get()));
     LOG(("> oscpu = %s\n", mOscpu.get()));
     LOG(("> language = %s\n", mLanguage.get()));
     LOG(("> misc = %s\n", mMisc.get()));
     LOG(("> vendor = %s\n", mVendor.get()));
     LOG(("> vendor-sub = %s\n", mVendorSub.get()));
-    LOG(("> vendor-comment = %s\n", mVendorComment.get()));
-    LOG(("> extra = %s\n", mExtraUA.get()));
     LOG(("> product = %s\n", mProduct.get()));
     LOG(("> product-sub = %s\n", mProductSub.get()));
-    LOG(("> product-comment = %s\n", mProductComment.get()));
+    LOG(("> app-name = %s\n", mAppName.get()));
+    LOG(("> app-version = %s\n", mAppVersion.get()));
+    LOG(("> compat-firefox = %s\n", mCompatFirefox.get()));
     LOG(("> user-agent = %s\n", UserAgent().get()));
 #endif
 
     mSessionStartTime = NowInSeconds();
 
     rv = mAuthCache.Init();
     if (NS_FAILED(rv)) return rv;
 
     rv = InitConnectionMgr();
     if (NS_FAILED(rv)) return rv;
 
-    nsCOMPtr<nsIXULAppInfo> appInfo =
-        do_GetService("@mozilla.org/xre/app-info;1");
     if (appInfo)
         appInfo->GetPlatformBuildID(mProductSub);
     if (mProductSub.Length() > 8)
         mProductSub.SetLength(8);
 
     // Startup the http category
     // Bring alive the objects in the http-protocol-startup category
     NS_CreateServicesFromCategory(NS_HTTP_STARTUP_CATEGORY,
@@ -597,91 +607,82 @@ nsHttpHandler::UserAgent()
     return mUserAgent;
 }
 
 void
 nsHttpHandler::BuildUserAgent()
 {
     LOG(("nsHttpHandler::BuildUserAgent\n"));
 
-    NS_ASSERTION(!mAppName.IsEmpty() &&
-                 !mAppVersion.IsEmpty() &&
+    NS_ASSERTION(!mLegacyAppName.IsEmpty() &&
+                 !mLegacyAppVersion.IsEmpty() &&
                  !mPlatform.IsEmpty() &&
                  !mOscpu.IsEmpty(),
                  "HTTP cannot send practical requests without this much");
 
     // preallocate to worst-case size, which should always be better
     // than if we didn't preallocate at all.
-    mUserAgent.SetCapacity(mAppName.Length() + 
-                           mAppVersion.Length() + 
+    mUserAgent.SetCapacity(mLegacyAppName.Length() + 
+                           mLegacyAppVersion.Length() + 
 #ifndef UA_SPARE_PLATFORM
                            mPlatform.Length() + 
 #endif
                            mOscpu.Length() +
                            mMisc.Length() +
                            mProduct.Length() +
                            mProductSub.Length() +
-                           mProductComment.Length() +
                            mVendor.Length() +
                            mVendorSub.Length() +
-                           mVendorComment.Length() +
-                           mExtraUA.Length() +
-                           22);
+                           mAppName.Length() +
+                           mAppVersion.Length() +
+                           mCompatFirefox.Length() +
+                           15);
 
     // Application portion
-    mUserAgent.Assign(mAppName);
+    mUserAgent.Assign(mLegacyAppName);
     mUserAgent += '/';
-    mUserAgent += mAppVersion;
+    mUserAgent += mLegacyAppVersion;
     mUserAgent += ' ';
 
     // Application comment
     mUserAgent += '(';
 #ifndef UA_SPARE_PLATFORM
     mUserAgent += mPlatform;
     mUserAgent.AppendLiteral("; ");
 #endif
     mUserAgent += mOscpu;
-    if (!mMisc.IsEmpty()) {
-        mUserAgent.AppendLiteral("; ");
-        mUserAgent += mMisc;
-    }
+    mUserAgent.AppendLiteral("; ");
+    mUserAgent += mMisc;
     mUserAgent += ')';
 
     // Product portion
-    if (!mProduct.IsEmpty()) {
-        mUserAgent += ' ';
-        mUserAgent += mProduct;
-        if (!mProductSub.IsEmpty()) {
-            mUserAgent += '/';
-            mUserAgent += mProductSub;
-        }
-        if (!mProductComment.IsEmpty()) {
-            mUserAgent.AppendLiteral(" (");
-            mUserAgent += mProductComment;
-            mUserAgent += ')';
-        }
-    }
+    mUserAgent += ' ';
+    mUserAgent += mProduct;
+    mUserAgent += '/';
+    mUserAgent += mProductSub;
 
     // Vendor portion
     if (!mVendor.IsEmpty()) {
         mUserAgent += ' ';
         mUserAgent += mVendor;
         if (!mVendorSub.IsEmpty()) {
             mUserAgent += '/';
             mUserAgent += mVendorSub;
         }
-        if (!mVendorComment.IsEmpty()) {
-            mUserAgent.AppendLiteral(" (");
-            mUserAgent += mVendorComment;
-            mUserAgent += ')';
-        }
     }
 
-    if (!mExtraUA.IsEmpty())
-        mUserAgent += mExtraUA;
+    mUserAgent += ' ';
+    mUserAgent += mAppName;
+    mUserAgent += '/';
+    mUserAgent += mAppVersion;
+
+    if (!mCompatFirefox.IsEmpty()) {
+        mUserAgent += ' ';
+        mUserAgent += mCompatFirefox;
+    }
 }
 
 #ifdef XP_WIN
 typedef BOOL (WINAPI *IsWow64ProcessP) (HANDLE, PBOOL);
 
 #define WNT_BASE "Windows NT %ld.%ld"
 #define W64_PREFIX "; Win64"
 #endif
@@ -822,83 +823,37 @@ nsHttpHandler::PrefsChanged(nsIPrefBranc
 #define PREF_CHANGED(p) ((pref == nsnull) || !PL_strcmp(pref, p))
 #define MULTI_PREF_CHANGED(p) \
   ((pref == nsnull) || !PL_strncmp(pref, p, sizeof(p) - 1))
 
     //
     // UA components
     //
 
-    // Gather application values.
-    if (PREF_CHANGED(UA_PREF("appName"))) {
-        prefs->GetCharPref(UA_PREF("appName"),
-            getter_Copies(mAppName));
-        if (mAppName.IsEmpty())
-            mAppName.AssignLiteral(UA_APPNAME);
-        mUserAgentIsDirty = PR_TRUE;
-    }
-    if (PREF_CHANGED(UA_PREF("appVersion"))) {
-        prefs->GetCharPref(UA_PREF("appVersion"),
-            getter_Copies(mAppVersion));
-        if (mAppVersion.IsEmpty())
-            mAppVersion.AssignLiteral(UA_APPVERSION);
-        mUserAgentIsDirty = PR_TRUE;
-    }
-
     // Gather vendor values.
     if (PREF_CHANGED(UA_PREF("vendor"))) {
         prefs->GetCharPref(UA_PREF("vendor"),
             getter_Copies(mVendor));
         mUserAgentIsDirty = PR_TRUE;
     }
     if (PREF_CHANGED(UA_PREF("vendorSub"))) {
         prefs->GetCharPref(UA_PREF("vendorSub"),
             getter_Copies(mVendorSub));
         mUserAgentIsDirty = PR_TRUE;
     }
-    if (PREF_CHANGED(UA_PREF("vendorComment"))) {
-        prefs->GetCharPref(UA_PREF("vendorComment"),
-            getter_Copies(mVendorComment));
-        mUserAgentIsDirty = PR_TRUE;
-    }
 
-    if (MULTI_PREF_CHANGED(UA_PREF("extra."))) {
-        mExtraUA.Truncate();
+    PRBool cVar = PR_FALSE;
 
-        // Unfortunately, we can't do this using the pref branch.
-        nsCOMPtr<nsIPrefService> service =
-            do_GetService(NS_PREFSERVICE_CONTRACTID);
-        nsCOMPtr<nsIPrefBranch> branch;
-        service->GetBranch(UA_PREF("extra."), getter_AddRefs(branch));
-        if (branch) {
-            PRUint32 extraCount;
-            char **extraItems;
-            rv = branch->GetChildList("", &extraCount, &extraItems);
-            if (NS_SUCCEEDED(rv) && extraItems) {
-                NS_QuickSort(extraItems, extraCount, sizeof(extraItems[0]),
-                             StringCompare, nsnull);
-                for (char **item = extraItems,
-                      **item_end = extraItems + extraCount;
-                     item < item_end; ++item) {
-                    nsXPIDLCString valStr;
-                    branch->GetCharPref(*item, getter_Copies(valStr));
-                    if (!valStr.IsEmpty())
-                        mExtraUA += NS_LITERAL_CSTRING(" ") + valStr;
-                }
-                NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(extraCount, extraItems);
-            }
+    if (PREF_CHANGED(UA_PREF("compatMode.firefox"))) {
+        rv = prefs->GetBoolPref(UA_PREF("compatMode.firefox"), &cVar);
+        if (NS_SUCCEEDED(rv) && cVar) {
+            mCompatFirefox.AssignLiteral("Firefox/" FIREFOX_VERSION);
+        } else {
+            mCompatFirefox.Truncate();
         }
-
-        mUserAgentIsDirty = PR_TRUE;
-    }
-
-    // Gather product values.
-    if (PREF_CHANGED(UA_PREF("productComment"))) {
-        prefs->GetCharPref(UA_PREF("productComment"),
-            getter_Copies(mProductComment));
         mUserAgentIsDirty = PR_TRUE;
     }
 
     // Gather locale.
     if (PREF_CHANGED(UA_PREF("locale"))) {
         nsCOMPtr<nsIPrefLocalizedString> pls;
         prefs->GetComplexValue(UA_PREF("locale"),
                                NS_GET_IID(nsIPrefLocalizedString),
@@ -1027,18 +982,16 @@ nsHttpHandler::PrefsChanged(nsIPrefBranc
             if (!PL_strcmp(httpVersion, "1.1"))
                 mProxyHttpVersion = NS_HTTP_VERSION_1_1;
             else
                 mProxyHttpVersion = NS_HTTP_VERSION_1_0;
             // it does not make sense to issue a HTTP/0.9 request to a proxy server
         }
     }
 
-    PRBool cVar = PR_FALSE;
-
     if (PREF_CHANGED(HTTP_PREF("keep-alive"))) {
         rv = prefs->GetBoolPref(HTTP_PREF("keep-alive"), &cVar);
         if (NS_SUCCEEDED(rv)) {
             if (cVar)
                 mCapabilities |= NS_HTTP_ALLOW_KEEPALIVE;
             else
                 mCapabilities &= ~NS_HTTP_ALLOW_KEEPALIVE;
         }
@@ -1602,110 +1555,54 @@ nsHttpHandler::GetUserAgent(nsACString &
 {
     value = UserAgent();
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHttpHandler::GetAppName(nsACString &value)
 {
-    value = mAppName;
+    value = mLegacyAppName;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHttpHandler::GetAppVersion(nsACString &value)
 {
-    value = mAppVersion;
+    value = mLegacyAppVersion;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHttpHandler::GetVendor(nsACString &value)
 {
     value = mVendor;
     return NS_OK;
 }
-NS_IMETHODIMP
-nsHttpHandler::SetVendor(const nsACString &value)
-{
-    mVendor = value;
-    mUserAgentIsDirty = PR_TRUE;
-    return NS_OK;
-}
 
 NS_IMETHODIMP
 nsHttpHandler::GetVendorSub(nsACString &value)
 {
     value = mVendorSub;
     return NS_OK;
 }
-NS_IMETHODIMP
-nsHttpHandler::SetVendorSub(const nsACString &value)
-{
-    mVendorSub = value;
-    mUserAgentIsDirty = PR_TRUE;
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHttpHandler::GetVendorComment(nsACString &value)
-{
-    value = mVendorComment;
-    return NS_OK;
-}
-NS_IMETHODIMP
-nsHttpHandler::SetVendorComment(const nsACString &value)
-{
-    mVendorComment = value;
-    mUserAgentIsDirty = PR_TRUE;
-    return NS_OK;
-}
 
 NS_IMETHODIMP
 nsHttpHandler::GetProduct(nsACString &value)
 {
     value = mProduct;
     return NS_OK;
 }
-NS_IMETHODIMP
-nsHttpHandler::SetProduct(const nsACString &value)
-{
-    mProduct = value;
-    mUserAgentIsDirty = PR_TRUE;
-    return NS_OK;
-}
 
 NS_IMETHODIMP
 nsHttpHandler::GetProductSub(nsACString &value)
 {
     value = mProductSub;
     return NS_OK;
 }
-NS_IMETHODIMP
-nsHttpHandler::SetProductSub(const nsACString &value)
-{
-    mProductSub = value;
-    mUserAgentIsDirty = PR_TRUE;
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHttpHandler::GetProductComment(nsACString &value)
-{
-    value = mProductComment;
-    return NS_OK;
-}
-NS_IMETHODIMP
-nsHttpHandler::SetProductComment(const nsACString &value)
-{
-    mProductComment = value;
-    mUserAgentIsDirty = PR_TRUE;
-    return NS_OK;
-}
 
 NS_IMETHODIMP
 nsHttpHandler::GetPlatform(nsACString &value)
 {
     value = mPlatform;
     return NS_OK;
 }
 
@@ -1724,23 +1621,16 @@ nsHttpHandler::GetLanguage(nsACString &v
 }
 
 NS_IMETHODIMP
 nsHttpHandler::GetMisc(nsACString &value)
 {
     value = mMisc;
     return NS_OK;
 }
-NS_IMETHODIMP
-nsHttpHandler::SetMisc(const nsACString &value)
-{
-    mMisc = value;
-    mUserAgentIsDirty = PR_TRUE;
-    return NS_OK;
-}
 
 //-----------------------------------------------------------------------------
 // nsHttpHandler::nsIObserver
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsHttpHandler::Observe(nsISupports *subject,
                        const char *topic,
--- a/netwerk/protocol/http/nsHttpHandler.h
+++ b/netwerk/protocol/http/nsHttpHandler.h
@@ -298,29 +298,29 @@ private:
 
     nsXPIDLCString mDefaultSocketType;
 
     // cache support
     PRUint32                  mLastUniqueID;
     PRUint32                  mSessionStartTime;
 
     // useragent components
-    nsXPIDLCString mAppName;
-    nsXPIDLCString mAppVersion;
+    nsCString      mLegacyAppName;
+    nsCString      mLegacyAppVersion;
     nsCString      mPlatform;
     nsCString      mOscpu;
     nsCString      mLanguage;
     nsCString      mMisc;
     nsXPIDLCString mVendor;
     nsXPIDLCString mVendorSub;
-    nsXPIDLCString mVendorComment;
     nsCString      mProduct;
     nsXPIDLCString mProductSub;
-    nsXPIDLCString mProductComment;
-    nsCString      mExtraUA;
+    nsXPIDLCString mAppName;
+    nsXPIDLCString mAppVersion;
+    nsCString      mCompatFirefox;
 
     nsCString      mUserAgent;
     nsXPIDLCString mUserAgentOverride;
     PRPackedBool   mUserAgentIsDirty; // true if mUserAgent should be rebuilt
 
     PRPackedBool   mUseCache;
 
     PRPackedBool   mPromptTempRedirect;
--- a/netwerk/protocol/http/nsIHttpProtocolHandler.idl
+++ b/netwerk/protocol/http/nsIHttpProtocolHandler.idl
@@ -34,17 +34,17 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsIProxiedProtocolHandler.idl"
 
-[scriptable, uuid(cf549f80-9423-11df-981c-0800200c9a66)]
+[scriptable, uuid(36709064-d2c8-40cb-b754-d30d970be639)]
 interface nsIHttpProtocolHandler : nsIProxiedProtocolHandler
 {
     /**
      * Get the HTTP advertised user agent string.
      */
     readonly attribute ACString userAgent;
 
     /**
@@ -59,42 +59,32 @@ interface nsIHttpProtocolHandler : nsIPr
      *
      * @return The complete version (major and minor) string. (eg. "5.0")
      */
     readonly attribute ACString appVersion;
 
     /**
      * @return The vendor name.
      */
-    attribute ACString vendor;
+    readonly attribute ACString vendor;
 
     /**
      * @return The vendor sub string.
      */
-    attribute ACString vendorSub;
-    
-    /**
-     * @return The vendor comment.
-     */
-    attribute ACString vendorComment;
+    readonly attribute ACString vendorSub;
 
     /**
      * @return The product name.
      */
-    attribute ACString product;
+    readonly attribute ACString product;
 
     /**
      * @return A product sub string.
      */
-    attribute ACString productSub;
-
-    /**
-     * @return A product comment.
-     */
-    attribute ACString productComment;
+    readonly attribute ACString productSub;
 
     /**
      * Get the current platform.
      *
      * @return The platform this application is running on
      *		   (eg. "Windows", "Macintosh", "X11")
      */
     readonly attribute ACString platform;
@@ -109,19 +99,19 @@ interface nsIHttpProtocolHandler : nsIPr
     /**
      * Get the translation of the application. The value for language
      * is usually a 2-letter code such as "en" and occasionally a 
      * five-character code to indicate a language subtype, such as "zh_CN". 
      */
     readonly attribute ACString language;
 
     /**
-     * Get/Set the application comment misc portion.
+     * Get the application comment misc portion.
      */
-    attribute ACString misc;
+    readonly attribute ACString misc;
 
 };
 
 %{C++
 // ----------- Categories ----------- 
 /**
  * At initialization time, the HTTP handler will initialize each service
  * registered under this category: