Bug 1372069 - Part 1: Disable Geolocation when 'privacy.resistFingerprinting' is true. r=arthuredelstein,smaug

This patch disables Geolocation API when fingerprinting resistance is enabled.
The way we disable it is the same as how we disable this API for non-secure
origins that we will reject the request from this API and still keep this API
around.

MozReview-Commit-ID: 5D7Bf6Rplm8

--HG--
extra : rebase_source : b28f33f70a59dc670089dcbbb82f2720a059c341
This commit is contained in:
Tim Huang 2017-07-13 14:11:08 +08:00
parent c2f2b84cee
commit 1ec953e612

View File

@ -1250,7 +1250,8 @@ Geolocation::GetCurrentPosition(GeoPositionCallback callback,
Move(options), static_cast<uint8_t>(mProtocolType),
false);
if (!sGeoEnabled || ShouldBlockInsecureRequests()) {
if (!sGeoEnabled || ShouldBlockInsecureRequests() ||
nsContentUtils::ResistFingerprinting(aCallerType)) {
nsCOMPtr<nsIRunnable> ev = new RequestAllowEvent(false, request);
NS_DispatchToMainThread(ev);
return NS_OK;
@ -1336,7 +1337,8 @@ Geolocation::WatchPosition(GeoPositionCallback aCallback,
Move(aOptions),
static_cast<uint8_t>(mProtocolType), true, *aRv);
if (!sGeoEnabled || ShouldBlockInsecureRequests()) {
if (!sGeoEnabled || ShouldBlockInsecureRequests() ||
nsContentUtils::ResistFingerprinting(aCallerType)) {
nsCOMPtr<nsIRunnable> ev = new RequestAllowEvent(false, request);
NS_DispatchToMainThread(ev);
return NS_OK;