forked from mirrors/gecko-dev
Bug 1824222 - Make nsRFPService::IsRFPEnabledFor() to use the given OverriddenFingerprintingSettings for checking RFPTargets. r=tjr
Differential Revision: https://phabricator.services.mozilla.com/D185016
This commit is contained in:
parent
e2cb3b6fc1
commit
e8f8d32e61
11 changed files with 41 additions and 14 deletions
|
|
@ -711,7 +711,11 @@ var FullZoom = {
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
!aBrowser?.browsingContext?.topWindowContext.shouldResistFingerprinting ||
|
!aBrowser?.browsingContext?.topWindowContext.shouldResistFingerprinting ||
|
||||||
!ChromeUtils.shouldResistFingerprinting("SiteSpecificZoom")
|
!ChromeUtils.shouldResistFingerprinting(
|
||||||
|
"SiteSpecificZoom",
|
||||||
|
aBrowser?.browsingContext?.topWindowContext
|
||||||
|
.overriddenFingerprintingSettings
|
||||||
|
)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1570,7 +1570,7 @@ var gBrowserInit = {
|
||||||
updateBookmarkToolbarVisibility();
|
updateBookmarkToolbarVisibility();
|
||||||
|
|
||||||
// Set a sane starting width/height for all resolutions on new profiles.
|
// Set a sane starting width/height for all resolutions on new profiles.
|
||||||
if (ChromeUtils.shouldResistFingerprinting("RoundWindowSize")) {
|
if (ChromeUtils.shouldResistFingerprinting("RoundWindowSize", null)) {
|
||||||
// When the fingerprinting resistance is enabled, making sure that we don't
|
// When the fingerprinting resistance is enabled, making sure that we don't
|
||||||
// have a maximum window to interfere with generating rounded window dimensions.
|
// have a maximum window to interfere with generating rounded window dimensions.
|
||||||
document.documentElement.setAttribute("sizemode", "normal");
|
document.documentElement.setAttribute("sizemode", "normal");
|
||||||
|
|
|
||||||
|
|
@ -1876,8 +1876,9 @@ void ChromeUtils::GetAllPossibleUtilityActorNames(GlobalObject& aGlobal,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
bool ChromeUtils::ShouldResistFingerprinting(GlobalObject& aGlobal,
|
bool ChromeUtils::ShouldResistFingerprinting(
|
||||||
JSRFPTarget aTarget) {
|
GlobalObject& aGlobal, JSRFPTarget aTarget,
|
||||||
|
const Nullable<uint64_t>& aOverriddenFingerprintingSettings) {
|
||||||
RFPTarget target;
|
RFPTarget target;
|
||||||
switch (aTarget) {
|
switch (aTarget) {
|
||||||
case JSRFPTarget::RoundWindowSize:
|
case JSRFPTarget::RoundWindowSize:
|
||||||
|
|
@ -1890,7 +1891,14 @@ bool ChromeUtils::ShouldResistFingerprinting(GlobalObject& aGlobal,
|
||||||
MOZ_CRASH("Unhandled JSRFPTarget enum value");
|
MOZ_CRASH("Unhandled JSRFPTarget enum value");
|
||||||
}
|
}
|
||||||
|
|
||||||
return nsRFPService::IsRFPEnabledFor(target);
|
Maybe<RFPTarget> overriddenFingerprintingSettings;
|
||||||
|
if (!aOverriddenFingerprintingSettings.IsNull()) {
|
||||||
|
overriddenFingerprintingSettings.emplace(
|
||||||
|
RFPTarget(aOverriddenFingerprintingSettings.Value()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return nsRFPService::IsRFPEnabledFor(target,
|
||||||
|
overriddenFingerprintingSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::atomic<uint32_t> ChromeUtils::sDevToolsOpenedCount = 0;
|
std::atomic<uint32_t> ChromeUtils::sDevToolsOpenedCount = 0;
|
||||||
|
|
|
||||||
|
|
@ -304,8 +304,9 @@ class ChromeUtils {
|
||||||
static void GetAllPossibleUtilityActorNames(GlobalObject& aGlobal,
|
static void GetAllPossibleUtilityActorNames(GlobalObject& aGlobal,
|
||||||
nsTArray<nsCString>& aNames);
|
nsTArray<nsCString>& aNames);
|
||||||
|
|
||||||
static bool ShouldResistFingerprinting(GlobalObject& aGlobal,
|
static bool ShouldResistFingerprinting(
|
||||||
JSRFPTarget aTarget);
|
GlobalObject& aGlobal, JSRFPTarget aTarget,
|
||||||
|
const Nullable<uint64_t>& aOverriddenFingerprintingSettings);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Number of DevTools session debugging the current process
|
// Number of DevTools session debugging the current process
|
||||||
|
|
|
||||||
|
|
@ -16311,7 +16311,9 @@ bool Document::RecomputeResistFingerprinting() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Document::ShouldResistFingerprinting(RFPTarget aTarget) const {
|
bool Document::ShouldResistFingerprinting(RFPTarget aTarget) const {
|
||||||
return mShouldResistFingerprinting && nsRFPService::IsRFPEnabledFor(aTarget);
|
return mShouldResistFingerprinting &&
|
||||||
|
nsRFPService::IsRFPEnabledFor(aTarget,
|
||||||
|
mOverriddenFingerprintingSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowContext* Document::GetWindowContextForPageUseCounters() const {
|
WindowContext* Document::GetWindowContextForPageUseCounters() const {
|
||||||
|
|
|
||||||
|
|
@ -2135,7 +2135,7 @@ bool nsContentUtils::IsCallerChromeOrElementTransformGettersEnabled(
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
bool nsContentUtils::ShouldResistFingerprinting(RFPTarget aTarget) {
|
bool nsContentUtils::ShouldResistFingerprinting(RFPTarget aTarget) {
|
||||||
return nsRFPService::IsRFPEnabledFor(aTarget);
|
return nsRFPService::IsRFPEnabledFor(aTarget, Nothing());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
|
|
|
||||||
|
|
@ -717,7 +717,8 @@ partial namespace ChromeUtils {
|
||||||
[ChromeOnly]
|
[ChromeOnly]
|
||||||
sequence<UTF8String> getAllPossibleUtilityActorNames();
|
sequence<UTF8String> getAllPossibleUtilityActorNames();
|
||||||
|
|
||||||
boolean shouldResistFingerprinting(JSRFPTarget target);
|
boolean shouldResistFingerprinting(JSRFPTarget target,
|
||||||
|
unsigned long long? overriddenFingerprintingSettings);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -5786,7 +5786,8 @@ PerformanceStorage* WorkerPrivate::GetPerformanceStorage() {
|
||||||
|
|
||||||
bool WorkerPrivate::ShouldResistFingerprinting(RFPTarget aTarget) const {
|
bool WorkerPrivate::ShouldResistFingerprinting(RFPTarget aTarget) const {
|
||||||
return mLoadInfo.mShouldResistFingerprinting &&
|
return mLoadInfo.mShouldResistFingerprinting &&
|
||||||
nsRFPService::IsRFPEnabledFor(aTarget);
|
nsRFPService::IsRFPEnabledFor(
|
||||||
|
aTarget, mLoadInfo.mOverriddenFingerprintingSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorkerPrivate::SetRemoteWorkerController(RemoteWorkerChild* aController) {
|
void WorkerPrivate::SetRemoteWorkerController(RemoteWorkerChild* aController) {
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,8 @@ class WorkletImpl {
|
||||||
bool IsSystemPrincipal() const { return mPrincipal->IsSystemPrincipal(); }
|
bool IsSystemPrincipal() const { return mPrincipal->IsSystemPrincipal(); }
|
||||||
bool ShouldResistFingerprinting(RFPTarget aTarget) const {
|
bool ShouldResistFingerprinting(RFPTarget aTarget) const {
|
||||||
return mShouldResistFingerprinting &&
|
return mShouldResistFingerprinting &&
|
||||||
nsRFPService::IsRFPEnabledFor(aTarget);
|
nsRFPService::IsRFPEnabledFor(aTarget,
|
||||||
|
mOverriddenFingerprintingSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnAddModuleStarted() const {
|
virtual void OnAddModuleStarted() const {
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,9 @@ bool nsRFPService::IsRFPPrefEnabled(bool aIsPrivateMode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
bool nsRFPService::IsRFPEnabledFor(RFPTarget aTarget) {
|
bool nsRFPService::IsRFPEnabledFor(
|
||||||
|
RFPTarget aTarget,
|
||||||
|
const Maybe<RFPTarget>& aOverriddenFingerprintingSettings) {
|
||||||
MOZ_ASSERT(aTarget != RFPTarget::AllTargets);
|
MOZ_ASSERT(aTarget != RFPTarget::AllTargets);
|
||||||
|
|
||||||
if (StaticPrefs::privacy_resistFingerprinting_DoNotUseDirectly() ||
|
if (StaticPrefs::privacy_resistFingerprinting_DoNotUseDirectly() ||
|
||||||
|
|
@ -210,6 +212,11 @@ bool nsRFPService::IsRFPEnabledFor(RFPTarget aTarget) {
|
||||||
if (aTarget == RFPTarget::IsAlwaysEnabledForPrecompute) {
|
if (aTarget == RFPTarget::IsAlwaysEnabledForPrecompute) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (aOverriddenFingerprintingSettings) {
|
||||||
|
return bool(aOverriddenFingerprintingSettings.ref() & aTarget);
|
||||||
|
}
|
||||||
|
|
||||||
return bool(sEnabledFingerintingProtections & aTarget);
|
return bool(sEnabledFingerintingProtections & aTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,9 @@ class nsRFPService final : public nsIObserver, public nsIRFPService {
|
||||||
// 98% of the time you should use nsContentUtils::ShouldResistFingerprinting
|
// 98% of the time you should use nsContentUtils::ShouldResistFingerprinting
|
||||||
// as the difference will not matter to you.
|
// as the difference will not matter to you.
|
||||||
static bool IsRFPPrefEnabled(bool aIsPrivateMode);
|
static bool IsRFPPrefEnabled(bool aIsPrivateMode);
|
||||||
static bool IsRFPEnabledFor(RFPTarget aTarget);
|
static bool IsRFPEnabledFor(
|
||||||
|
RFPTarget aTarget,
|
||||||
|
const Maybe<RFPTarget>& aOverriddenFingerprintingSettings);
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
static double TimerResolution(RTPCallerType aRTPCallerType);
|
static double TimerResolution(RTPCallerType aRTPCallerType);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue