Bug 1532408 - Pass a docshell pointer to nsContentUtils::ShouldResistFingerprinting() callers in nsGlobalWindowInner.cpp; r=baku
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 05 Mar 2019 12:42:52 +0000
changeset 520337 c1a7b4982eaf9ae178e09a7474a8eb2cd2f78762
parent 520336 ac2880eb346a750208311858fb858a01710149cb
child 520338 9810f4da2d88a07351cc8b4689539daa0473f52a
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1532408
milestone67.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 1532408 - Pass a docshell pointer to nsContentUtils::ShouldResistFingerprinting() callers in nsGlobalWindowInner.cpp; r=baku Differential Revision: https://phabricator.services.mozilla.com/D21995
dom/base/nsGlobalWindowInner.cpp
--- a/dom/base/nsGlobalWindowInner.cpp
+++ b/dom/base/nsGlobalWindowInner.cpp
@@ -5708,19 +5708,17 @@ void nsGlobalWindowInner::DisableDeviceS
   nsCOMPtr<nsIDeviceSensors> ac = do_GetService(NS_DEVICE_SENSORS_CONTRACTID);
   if (ac) {
     ac->RemoveWindowListener(aType, this);
   }
 }
 
 #if defined(MOZ_WIDGET_ANDROID)
 void nsGlobalWindowInner::EnableOrientationChangeListener() {
-  // XXX: mDocShell is never set on the inner window?
-  nsIDocShell* docShell = nullptr;
-  if (!nsContentUtils::ShouldResistFingerprinting(docShell) &&
+  if (!nsContentUtils::ShouldResistFingerprinting(GetDocShell()) &&
       !mOrientationChangeObserver) {
     mOrientationChangeObserver = MakeUnique<WindowOrientationObserver>(this);
   }
 }
 
 void nsGlobalWindowInner::DisableOrientationChangeListener() {
   mOrientationChangeObserver = nullptr;
 }
@@ -5889,17 +5887,17 @@ void nsGlobalWindowInner::RemoveGamepad(
   mGamepads.Remove(aIndex);
 }
 
 void nsGlobalWindowInner::GetGamepads(nsTArray<RefPtr<Gamepad>>& aGamepads) {
   aGamepads.Clear();
 
   // navigator.getGamepads() always returns an empty array when
   // privacy.resistFingerprinting is true.
-  if (nsContentUtils::ShouldResistFingerprinting()) {
+  if (nsContentUtils::ShouldResistFingerprinting(GetDocShell())) {
     return;
   }
 
   // mGamepads.Count() may not be sufficient, but it's not harmful.
   aGamepads.SetCapacity(mGamepads.Count());
   for (auto iter = mGamepads.Iter(); !iter.Done(); iter.Next()) {
     Gamepad* gamepad = iter.UserData();
     aGamepads.EnsureLengthAtLeast(gamepad->Index() + 1);