Bug 1559747 - Part 1: UA string needn't reveal the user is running 32-bit Firefox on a 64-bit Unix OS. r=tjr
authorChris Peterson <cpeterson@mozilla.com>
Wed, 19 Jun 2019 09:56:50 +0000
changeset 479290 dcd234c04764821fc4fd93a06285f0df66392eef
parent 479289 4b2173be8699b7408f75dedc36bf7222b29ee4fc
child 479291 ef0e2b8429328d53cefee4ce64ab6b3cd2df937c
push id36177
push userrmaries@mozilla.com
push dateThu, 20 Jun 2019 09:46:31 +0000
treeherdermozilla-central@a440f0629814 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstjr
bugs1559747, 265536
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1559747 - Part 1: UA string needn't reveal the user is running 32-bit Firefox on a 64-bit Unix OS. r=tjr Change the User-Agent HTTP header and the navigator.userAgent, navigator.platform, and navigator.oscpu APIs to say "Linux x86_64" instead "Linux i686 on x86_64" (bug 265536) when the user is running 32-bit Firefox on a 64-bit Unix OS (including Android). Software download websites that try to sniff for the user's CPU architecture (so they can serve compatible software) only need to know whether the user has a 32- or 64-bit OS, not whether they are running a 32- or 64-bit Firefox build. Once upon a time, Mozilla's Plugin Finder Service needed to check whether Firefox was 32- or 64-bit so it could direct the user to a Flash Player plugin compatible with their Firefox build (bug 265536). But these days Adobe's Flash Player installer includes both 32- and 64-bit plugins. Differential Revision: https://phabricator.services.mozilla.com/D35164
netwerk/protocol/http/nsHttpHandler.cpp
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -1042,45 +1042,32 @@ void nsHttpHandler::InitUserAgentCompone
   mOscpu.AssignLiteral("Intel Mac OS X");
 #    endif
   SInt32 majorVersion = nsCocoaFeatures::OSXVersionMajor();
   SInt32 minorVersion = nsCocoaFeatures::OSXVersionMinor();
   mOscpu += nsPrintfCString(" %d.%d", static_cast<int>(majorVersion),
                             static_cast<int>(minorVersion));
 #  elif defined(XP_UNIX)
   struct utsname name;
-
   int ret = uname(&name);
   if (ret >= 0) {
     nsAutoCString buf;
     buf = (char*)name.sysname;
-
-    if (strcmp(name.machine, "x86_64") == 0 &&
-        sizeof(void*) == sizeof(int32_t)) {
-      // We're running 32-bit code on x86_64. Make this browser
-      // look like it's running on i686 hardware, but append "
-      // (x86_64)" to the end of the oscpu identifier to be able
-      // to differentiate this from someone running 64-bit code
-      // on x86_64..
-
-      buf += " i686 on x86_64";
-    } else {
-      buf += ' ';
+    buf += ' ';
 
 #    ifdef AIX
-      // AIX uname returns machine specific info in the uname.machine
-      // field and does not return the cpu type like other platforms.
-      // We use the AIX version and release numbers instead.
-      buf += (char*)name.version;
-      buf += '.';
-      buf += (char*)name.release;
+    // AIX uname returns machine specific info in the uname.machine
+    // field and does not return the cpu type like other platforms.
+    // We use the AIX version and release numbers instead.
+    buf += (char*)name.version;
+    buf += '.';
+    buf += (char*)name.release;
 #    else
-      buf += (char*)name.machine;
+    buf += (char*)name.machine;
 #    endif
-    }
 
     mOscpu.Assign(buf);
   }
 #  endif
 #endif
 
   mUserAgentIsDirty = true;
 }