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
☠☠ backed out by d07998fb3530 ☠ ☠
authorDão Gottwald <dao@mozilla.com>
Mon, 20 Feb 2012 15:39:33 +0100
changeset 88713 0a741052778866996dae6bad02553a33fd7ba95e
parent 88712 5b8195516c117120837021c21932c591a04447b7
child 88714 b98eb5ea65267ff4693ea01b7b75d7b67e83a0fb
push id975
push userffxbld
push dateTue, 13 Mar 2012 21:39:16 +0000
treeherdermozilla-aurora@99faebf9dc36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium, bz, gerv
bugs572659
milestone13.0a1
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
config/milestone.pl
configure.in
js/src/config/milestone.pl
netwerk/protocol/http/nsHttpHandler.cpp
--- 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);
@@ -302,17 +302,17 @@ nsHttpHandler::Init()
     mSessionStartTime = NowInSeconds();
 
     rv = mAuthCache.Init();
     if (NS_FAILED(rv)) return rv;
 
     rv = InitConnectionMgr();
     if (NS_FAILED(rv)) return rv;
 
-    mProductSub.AssignLiteral(MOZILLA_VERSION);
+    mProductSub.AssignLiteral(MOZILLA_UAVERSION);
 
     // Startup the http category
     // Bring alive the objects in the http-protocol-startup category
     NS_CreateServicesFromCategory(NS_HTTP_STARTUP_CATEGORY,
                                   static_cast<nsISupports*>(static_cast<void*>(this)),
                                   NS_HTTP_STARTUP_TOPIC);    
     
     mObserverService = mozilla::services::GetObserverService();