Skip to content

Commit

Permalink
Bug 777710 - Remove platform and OS identifiers from B2G UA. r=bz
Browse files Browse the repository at this point in the history
--HG--
extra : rebase_source : 75ddd7a0e75f22a065fc0e7efad3a749511b813d
  • Loading branch information
daogottwald committed Jul 31, 2012
1 parent 88f3d72 commit f517099
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
2 changes: 2 additions & 0 deletions b2g/confvars.sh
Expand Up @@ -6,6 +6,8 @@ MOZ_APP_BASENAME=B2G
MOZ_APP_VENDOR=Mozilla

MOZ_APP_VERSION=17.0a1

MOZ_UA_OS_AGNOSTIC=1
MOZ_APP_UA_NAME=Firefox

MOZ_BRANDING_DIRECTORY=b2g/branding/unofficial
Expand Down
1 change: 1 addition & 0 deletions config/autoconf.mk.in
Expand Up @@ -22,6 +22,7 @@ ACCEPTED_MAR_CHANNEL_IDS = @ACCEPTED_MAR_CHANNEL_IDS@
MOZ_PROFILE_MIGRATOR = @MOZ_PROFILE_MIGRATOR@
MOZ_EXTENSION_MANAGER = @MOZ_EXTENSION_MANAGER@
MOZ_APP_UA_NAME = @MOZ_APP_UA_NAME@
MOZ_UA_OS_AGNOSTIC = @MOZ_UA_OS_AGNOSTIC@
MOZ_APP_VERSION = @MOZ_APP_VERSION@
MOZ_APP_MAXVERSION = @MOZ_APP_MAXVERSION@
MOZ_MACBUNDLE_NAME = @MOZ_MACBUNDLE_NAME@
Expand Down
4 changes: 4 additions & 0 deletions configure.in
Expand Up @@ -8411,6 +8411,10 @@ AC_SUBST(MOZ_APP_VERSION)
AC_SUBST(MOZ_APP_MAXVERSION)
AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
AC_SUBST(FIREFOX_VERSION)
AC_SUBST(MOZ_UA_OS_AGNOSTIC)
if test -n "$MOZ_UA_OS_AGNOSTIC"; then
AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
fi

# We can't use the static application.ini data when building against
# a libxul SDK.
Expand Down
25 changes: 13 additions & 12 deletions netwerk/protocol/http/nsHttpHandler.cpp
Expand Up @@ -516,9 +516,7 @@ nsHttpHandler::BuildUserAgent()
LOG(("nsHttpHandler::BuildUserAgent\n"));

NS_ASSERTION(!mLegacyAppName.IsEmpty() &&
!mLegacyAppVersion.IsEmpty() &&
!mPlatform.IsEmpty() &&
!mOscpu.IsEmpty(),
!mLegacyAppVersion.IsEmpty(),
"HTTP cannot send practical requests without this much");

// preallocate to worst-case size, which should always be better
Expand Down Expand Up @@ -547,18 +545,19 @@ nsHttpHandler::BuildUserAgent()
// Application comment
mUserAgent += '(';
#ifndef UA_SPARE_PLATFORM
mUserAgent += mPlatform;
mUserAgent.AppendLiteral("; ");
if (!mPlatform.IsEmpty()) {
mUserAgent += mPlatform;
mUserAgent.AppendLiteral("; ");
}
#endif
#if defined(ANDROID) || defined(MOZ_PLATFORM_MAEMO)
if (!mCompatDevice.IsEmpty()) {
mUserAgent += mCompatDevice;
mUserAgent.AppendLiteral("; ");
}
#else
mUserAgent += mOscpu;
mUserAgent.AppendLiteral("; ");
#endif
else if (!mOscpu.IsEmpty()) {
mUserAgent += mOscpu;
mUserAgent.AppendLiteral("; ");
}
mUserAgent += mMisc;
mUserAgent += ')';

Expand Down Expand Up @@ -591,6 +590,7 @@ nsHttpHandler::BuildUserAgent()
void
nsHttpHandler::InitUserAgentComponents()
{
#ifndef MOZ_UA_OS_AGNOSTIC
// Gather platform.
mPlatform.AssignLiteral(
#if defined(ANDROID)
Expand All @@ -605,10 +605,9 @@ nsHttpHandler::InitUserAgentComponents()
"Maemo"
#elif defined(MOZ_X11)
"X11"
#else
"?"
#endif
);
#endif

#if defined(ANDROID) || defined(MOZ_PLATFORM_MAEMO)
nsCOMPtr<nsIPropertyBag2> infoService = do_GetService("@mozilla.org/system-info;1");
Expand All @@ -622,6 +621,7 @@ nsHttpHandler::InitUserAgentComponents()
mCompatDevice.AssignLiteral("Mobile");
#endif

#ifndef MOZ_UA_OS_AGNOSTIC
// Gather OS/CPU.
#if defined(XP_OS2)
ULONG os2ver = 0;
Expand Down Expand Up @@ -706,6 +706,7 @@ nsHttpHandler::InitUserAgentComponents()

mOscpu.Assign(buf);
}
#endif
#endif

mUserAgentIsDirty = true;
Expand Down

0 comments on commit f517099

Please sign in to comment.