Bug 572659 - Don't expose the Gecko patch level (13.X.Y) in the UA string, only show the major version (13.X). r=glandium,bz sr=gerv
--- a/config/milestone.pl
+++ b/config/milestone.pl
@@ -46,26 +46,27 @@ use vars qw(
$MILESTONE_FILE
$MILESTONE
$MILESTONE_NUM
@MILESTONE_PARTS
$MINI_VERSION
$MICRO_VERSION
$opt_debug
$opt_template
+ $opt_uaversion
$opt_help
);
$SCRIPTDIR = $0;
$SCRIPTDIR =~ s/[^\/]*$//;
push(@INC,$SCRIPTDIR);
require "Moz/Milestone.pm";
-&GetOptions('topsrcdir=s' => \$TOPSRCDIR, 'srcdir=s' => \$SRCDIR, 'objdir=s' => \$OBJDIR, 'debug', 'help', 'template');
+&GetOptions('topsrcdir=s' => \$TOPSRCDIR, 'srcdir=s' => \$SRCDIR, 'objdir=s' => \$OBJDIR, 'debug', 'help', 'template', 'uaversion');
if (defined($opt_help)) {
&usage();
exit;
}
if (defined($opt_template)) {
@TEMPLATE_FILE = @ARGV;
@@ -95,18 +96,24 @@ if (defined(@TEMPLATE_FILE)) {
if (-e $TFILE) {
Moz::Milestone::build_file($TFILE,$BUILT_FILE);
} else {
warn("$0: No such file $TFILE!\n");
}
}
+} elsif(defined($opt_uaversion)) {
+ my $uaversion = Moz::Milestone::getMilestoneMajor($milestone) . "." .
+ Moz::Milestone::getMilestoneMinor($milestone);
+ # strip off trailing pre-release indicators
+ $uaversion =~ s/[a-z]+\d*$//;
+ print "$uaversion\n";
} else {
print "$milestone\n";
}
sub usage() {
print <<END
-`milestone.pl [--topsrcdir TOPSRCDIR] [--objdir OBJDIR] [--srcdir SRCDIR] --template [file list]` # will build file list from .tmpl files
+`milestone.pl [--topsrcdir TOPSRCDIR] [--objdir OBJDIR] [--srcdir SRCDIR] --template [file list] --uaversion` # will build file list from .tmpl files
END
;
}
--- a/configure.in
+++ b/configure.in
@@ -2261,26 +2261,28 @@ if test "$MOZ_CUSTOM_STDINT_H"; then
AC_SUBST(MOZ_CUSTOM_STDINT_H)
AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H)
else
AC_MSG_RESULT(none specified)
fi
dnl Get mozilla version from central milestone file
MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
+MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
dnl Get version of various core apps from the version files.
FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
if test -z "$FIREFOX_VERSION"; then
AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
fi
AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
+AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
MOZ_DOING_LTO(lto_is_enabled)
dnl ========================================================
dnl System overrides of the defaults for target
dnl ========================================================
case "$target" in
--- a/js/src/config/milestone.pl
+++ b/js/src/config/milestone.pl
@@ -46,26 +46,27 @@ use vars qw(
$MILESTONE_FILE
$MILESTONE
$MILESTONE_NUM
@MILESTONE_PARTS
$MINI_VERSION
$MICRO_VERSION
$opt_debug
$opt_template
+ $opt_uaversion
$opt_help
);
$SCRIPTDIR = $0;
$SCRIPTDIR =~ s/[^\/]*$//;
push(@INC,$SCRIPTDIR);
require "Moz/Milestone.pm";
-&GetOptions('topsrcdir=s' => \$TOPSRCDIR, 'srcdir=s' => \$SRCDIR, 'objdir=s' => \$OBJDIR, 'debug', 'help', 'template');
+&GetOptions('topsrcdir=s' => \$TOPSRCDIR, 'srcdir=s' => \$SRCDIR, 'objdir=s' => \$OBJDIR, 'debug', 'help', 'template', 'uaversion');
if (defined($opt_help)) {
&usage();
exit;
}
if (defined($opt_template)) {
@TEMPLATE_FILE = @ARGV;
@@ -95,18 +96,24 @@ if (defined(@TEMPLATE_FILE)) {
if (-e $TFILE) {
Moz::Milestone::build_file($TFILE,$BUILT_FILE);
} else {
warn("$0: No such file $TFILE!\n");
}
}
+} elsif(defined($opt_uaversion)) {
+ my $uaversion = Moz::Milestone::getMilestoneMajor($milestone) . "." .
+ Moz::Milestone::getMilestoneMinor($milestone);
+ # strip off trailing pre-release indicators
+ $uaversion =~ s/[a-z]+\d*$//;
+ print "$uaversion\n";
} else {
print "$milestone\n";
}
sub usage() {
print <<END
-`milestone.pl [--topsrcdir TOPSRCDIR] [--objdir OBJDIR] [--srcdir SRCDIR] --template [file list]` # will build file list from .tmpl files
+`milestone.pl [--topsrcdir TOPSRCDIR] [--objdir OBJDIR] [--srcdir SRCDIR] --template [file list] --uaversion` # will build file list from .tmpl files
END
;
}
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -265,17 +265,17 @@ nsHttpHandler::Init()
prefBranch->AddObserver(INTL_ACCEPT_LANGUAGES, this, true);
prefBranch->AddObserver(NETWORK_ENABLEIDN, this, true);
prefBranch->AddObserver(BROWSER_PREF("disk_cache_ssl"), this, true);
prefBranch->AddObserver(DONOTTRACK_HEADER_ENABLED, this, true);
PrefsChanged(prefBranch, nsnull);
}
- mMisc.AssignLiteral("rv:" MOZILLA_VERSION);
+ mMisc.AssignLiteral("rv:" MOZILLA_UAVERSION);
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);
@@ -303,17 +303,17 @@ nsHttpHandler::Init()
rv = mAuthCache.Init();
if (NS_FAILED(rv)) return rv;
rv = InitConnectionMgr();
if (NS_FAILED(rv)) return rv;
#ifdef ANDROID
- mProductSub.AssignLiteral(MOZ_APP_UA_VERSION);
+ mProductSub.AssignLiteral(MOZILLA_UAVERSION);
#else
mProductSub.AssignLiteral(MOZ_UA_BUILDID);
#endif
if (mProductSub.IsEmpty() && appInfo)
appInfo->GetPlatformBuildID(mProductSub);
if (mProductSub.Length() > 8)
mProductSub.SetLength(8);