Bug 1581084, nsDeviceSensors::IsSensorAllowedByPref should use the principal of the window, not docshell, to check whether to resist fingerprinting, r=bzbarsky
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Mon, 04 Nov 2019 12:43:43 +0000
changeset 500340 61d7a299c26be6ef66b32e7a37d06606f661d6b9
parent 500339 d8b8aaa7e20253d2b79cd0506c305f2521f145a5
child 500341 ae7103e15afdd30a2848da6b0f42e640337da96d
push id114164
push useraiakab@mozilla.com
push dateTue, 05 Nov 2019 10:06:15 +0000
treeherdermozilla-inbound@4d585c7edc76 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1581084
milestone72.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 1581084, nsDeviceSensors::IsSensorAllowedByPref should use the principal of the window, not docshell, to check whether to resist fingerprinting, r=bzbarsky Differential Revision: https://phabricator.services.mozilla.com/D50525
dom/system/nsDeviceSensors.cpp
--- a/dom/system/nsDeviceSensors.cpp
+++ b/dom/system/nsDeviceSensors.cpp
@@ -567,10 +567,12 @@ bool nsDeviceSensors::IsSensorAllowedByP
       MOZ_ASSERT_UNREACHABLE("Device sensor type not recognised");
       return false;
   }
 
   if (!window) {
     return true;
   }
 
-  return !nsContentUtils::ShouldResistFingerprinting(window->GetDocShell());
+  nsCOMPtr<nsIScriptObjectPrincipal> soPrincipal = do_QueryInterface(window);
+  return !nsContentUtils::ShouldResistFingerprinting(
+      soPrincipal->GetPrincipal());
 }