Ticket #22084: 0001-PATCH-Bug-1372072-Part-1-Spoofing-network-informatio.2.patch

File 0001-PATCH-Bug-1372072-Part-1-Spoofing-network-informatio.2.patch, 1.9 KB (added by igt0, 21 months ago)

Version 3 - Remove superfluous lines

  • dom/network/Connection.cpp

    From 44c3381d80b9a7eb48ec81b6a0ec0798b1c733fa Mon Sep 17 00:00:00 2001
    From: Tim Huang <tihuang@mozilla.com>
    Date: Wed, 13 Dec 2017 15:29:00 -0200
    Subject: [PATCH 1/2] [PATCH] 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 b Connection::Notify(const hal::NetworkInformation& aNetworkInfo) 
    7878
    7979  UpdateFromNetworkInfo(aNetworkInfo);
    8080
    81   if (previousType == mType) {
     81  if (previousType == mType ||
     82      nsContentUtils::ShouldResistFingerprinting()) {
    8283    return;
    8384  }
    8485
  • dom/network/Connection.h

    diff --git a/dom/network/Connection.h b/dom/network/Connection.h
    index 907aea144bc0..19e00d93c907 100644
    a b  
    1313#include "mozilla/dom/NetworkInformationBinding.h"
    1414#include "nsCycleCollectionParticipant.h"
    1515#include "nsINetworkProperties.h"
     16#include "nsContentUtils.h"
    1617
    1718namespace mozilla {
    1819
    public: 
    4445
    4546  virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
    4647
    47   ConnectionType Type() const { return mType; }
     48  ConnectionType Type() const
     49  {
     50    return nsContentUtils::ShouldResistFingerprinting() ?
     51             static_cast<ConnectionType>(ConnectionType::Unknown) : mType;
     52  }
    4853
    4954  IMPL_EVENT_HANDLER(typechange)
    5055