Bug 1383495 - Spoof Navigator API platform as win64 when resisting fingerprinting is enabled. r=ehsan
authorEthan <ettseng@mozilla.com>
Fri, 11 Aug 2017 09:51:09 +0800
changeset 374407 5451feeb04480c8126271a752b5b4e7b8a4ee077
parent 374406 923bb6366e728149d7fcb692fdd731c82a258afa
child 374408 525c6d077e1e78492240882db5f133cd99223945
push id32322
push userarchaeopteryx@coole-files.de
push dateSat, 12 Aug 2017 22:54:01 +0000
treeherdermozilla-central@687810bb2143 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1383495
milestone57.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 1383495 - Spoof Navigator API platform as win64 when resisting fingerprinting is enabled. r=ehsan
browser/components/resistfingerprinting/test/browser/browser_navigator.js
netwerk/protocol/http/nsHttpHandler.cpp
toolkit/components/resistfingerprinting/nsRFPService.h
--- a/browser/components/resistfingerprinting/test/browser/browser_navigator.js
+++ b/browser/components/resistfingerprinting/test/browser/browser_navigator.js
@@ -7,17 +7,17 @@ const { classes: Cc, Constructor: CC, in
 
 const TEST_PATH = "http://example.net/browser/browser/" +
                   "components/resistfingerprinting/test/browser/"
 
 var spoofedUserAgent;
 
 const SPOOFED_APPNAME        = "Netscape";
 const SPOOFED_APPVERSION     = "5.0 (Windows)";
-const SPOOFED_PLATFORM       = "Win32";
+const SPOOFED_PLATFORM       = "Win64";
 const SPOOFED_OSCPU          = "Windows NT 6.1";
 const SPOOFED_BUILDID        = "20100101";
 const SPOOFED_HW_CONCURRENCY = 2;
 
 const CONST_APPCODENAME = "Mozilla";
 const CONST_PRODUCT     = "Gecko";
 const CONST_PRODUCTSUB  = "20100101";
 const CONST_VENDOR      = "";
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -450,19 +450,20 @@ nsHttpHandler::Init()
           appInfo->GetName(mAppName);
         }
         appInfo->GetVersion(mAppVersion);
         mAppName.StripChars(R"( ()<>@,;:\"/[]?={})");
     } else {
         mAppVersion.AssignLiteral(MOZ_APP_UA_VERSION);
     }
 
-    // Generating the spoofed userAgent for fingerprinting resistance. We will
-    // round the version to the nearest 10. By doing so, the anonymity group will
-    // cover more versions instead of one version.
+    // Generating the spoofed userAgent for fingerprinting resistance.
+    // The browser version will be rounded down to a multiple of 10.
+    // By doing so, the anonymity group will cover more versions instead of one
+    // version.
     uint32_t spoofedVersion = mAppVersion.ToInteger(&rv);
     if (NS_SUCCEEDED(rv)) {
         spoofedVersion = spoofedVersion - (spoofedVersion % 10);
         mSpoofedUserAgent.Assign(nsPrintfCString(
             "Mozilla/5.0 (%s; rv:%d.0) Gecko/%s Firefox/%d.0",
             SPOOFED_OSCPU, spoofedVersion, LEGACY_BUILD_ID, spoofedVersion));
     }
 
--- a/toolkit/components/resistfingerprinting/nsRFPService.h
+++ b/toolkit/components/resistfingerprinting/nsRFPService.h
@@ -11,17 +11,17 @@
 
 #include "nsString.h"
 
 // Defines regarding spoofed values of Navigator object. These spoofed values
 // are returned when 'privacy.resistFingerprinting' is true.
 #define SPOOFED_APPNAME    "Netscape"
 #define SPOOFED_APPVERSION "5.0 (Windows)"
 #define SPOOFED_OSCPU      "Windows NT 6.1"
-#define SPOOFED_PLATFORM   "Win32"
+#define SPOOFED_PLATFORM   "Win64"
 
 #define LEGACY_BUILD_ID    "20100101"
 
 namespace mozilla {
 
 class nsRFPService final : public nsIObserver
 {
 public: