Bug 1396468 - Spoof navigator.oscpu as 'Windows NT 6.1; Win64; x64' when resisting fingerprinting is enabled. r=ehsan
authorEthan <ettseng@mozilla.com>
Mon, 04 Sep 2017 11:30:37 +0800
changeset 379556 38323ec9e5dad88f7131b07e30982ec108d818a1
parent 379555 665ea291fce432c014fa48dedc94f204f3dd1fb4
child 379557 ca5fc64fe2aec9ee223e5b4062d1350c8c7d39af
push id32456
push userarchaeopteryx@coole-files.de
push dateThu, 07 Sep 2017 22:00:40 +0000
treeherdermozilla-central@b4c1ad9565ee [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1396468
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 1396468 - Spoof navigator.oscpu as 'Windows NT 6.1; Win64; x64' when resisting fingerprinting is enabled. r=ehsan
browser/components/resistfingerprinting/test/browser/browser_navigator.js
toolkit/components/resistfingerprinting/nsRFPService.h
--- a/browser/components/resistfingerprinting/test/browser/browser_navigator.js
+++ b/browser/components/resistfingerprinting/test/browser/browser_navigator.js
@@ -8,17 +8,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       = "Win64";
-const SPOOFED_OSCPU          = "Windows NT 6.1";
+const SPOOFED_OSCPU          = "Windows NT 6.1; Win64; x64";
 const SPOOFED_BUILDID        = "20100101";
 const SPOOFED_HW_CONCURRENCY = 2;
 
 const CONST_APPCODENAME = "Mozilla";
 const CONST_PRODUCT     = "Gecko";
 const CONST_PRODUCTSUB  = "20100101";
 const CONST_VENDOR      = "";
 const CONST_VENDORSUB   = "";
@@ -87,17 +87,17 @@ async function testWorkerNavigator() {
 add_task(async function setup() {
   await SpecialPowers.pushPrefEnv({"set":
     [["privacy.resistFingerprinting", true]]
   });
 
   let appInfo = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo);
   let appVersion = parseInt(appInfo.version);
   let spoofedVersion = appVersion - ((appVersion - 3) % 7);
-  spoofedUserAgent = `Mozilla/5.0 (Windows NT 6.1; rv:${spoofedVersion}.0) Gecko/20100101 Firefox/${spoofedVersion}.0`;
+  spoofedUserAgent = `Mozilla/5.0 (${SPOOFED_OSCPU}; rv:${spoofedVersion}.0) Gecko/20100101 Firefox/${spoofedVersion}.0`;
 });
 
 add_task(async function runNavigatorTest() {
   await testNavigator();
 });
 
 add_task(async function runWorkerNavigatorTest() {
   await testWorkerNavigator();
--- a/toolkit/components/resistfingerprinting/nsRFPService.h
+++ b/toolkit/components/resistfingerprinting/nsRFPService.h
@@ -10,17 +10,17 @@
 #include "nsIObserver.h"
 
 #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_OSCPU      "Windows NT 6.1; Win64; x64"
 #define SPOOFED_PLATFORM   "Win64"
 
 #define LEGACY_BUILD_ID    "20100101"
 
 namespace mozilla {
 
 class nsRFPService final : public nsIObserver
 {