[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser/tor-browser-52.5.2esr-7.5-2] Bug 1372072 - Part 1: Spoofing network information API and blocking ontypechange event when 'privacy.resistFingerprinting' is true. r=arthuredelstein, baku



commit a1beadc5b70e1b6e4727506656723684cf3225bf
Author: Tim Huang <tihuang@xxxxxxxxxxx>
Date:   Wed Dec 13 15:29:00 2017 -0200

    Bug 1372072 - Part 1: Spoofing network information API and blocking ontypechange event when 'privacy.resistFingerprinting' is true. r=arthuredelstein,baku
    
    This patch makes the network information API always returns the default type 'unknown'
    and blocking the ontypechange event while connection type changed when 'privacy.
    resistFingerprinting' is true.
    
    MozReview-Commit-ID: 4eOdHgAGtyY
    
    --HG--
    extra : rebase_source : 78449fb4888b787062ff2139e36c219e0eac0b2c
---
 dom/network/Connection.cpp | 3 ++-
 dom/network/Connection.h   | 7 ++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/dom/network/Connection.cpp b/dom/network/Connection.cpp
index 3bf6f40384a6..cc06b5e14b6a 100644
--- a/dom/network/Connection.cpp
+++ b/dom/network/Connection.cpp
@@ -78,7 +78,8 @@ Connection::Notify(const hal::NetworkInformation& aNetworkInfo)
 
   UpdateFromNetworkInfo(aNetworkInfo);
 
-  if (previousType == mType) {
+  if (previousType == mType ||
+      nsContentUtils::ShouldResistFingerprinting()) {
     return;
   }
 
diff --git a/dom/network/Connection.h b/dom/network/Connection.h
index 907aea144bc0..19e00d93c907 100644
--- a/dom/network/Connection.h
+++ b/dom/network/Connection.h
@@ -13,6 +13,7 @@
 #include "mozilla/dom/NetworkInformationBinding.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsINetworkProperties.h"
+#include "nsContentUtils.h"
 
 namespace mozilla {
 
@@ -44,7 +45,11 @@ public:
 
   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
-  ConnectionType Type() const { return mType; }
+  ConnectionType Type() const
+  {
+    return nsContentUtils::ShouldResistFingerprinting() ?
+             static_cast<ConnectionType>(ConnectionType::Unknown) : mType;
+  }
 
   IMPL_EVENT_HANDLER(typechange)
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits