зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
e2cb3b6fc1
Коммит
e8f8d32e61
|
@ -711,7 +711,11 @@ var FullZoom = {
|
|||
}
|
||||
return (
|
||||
!aBrowser?.browsingContext?.topWindowContext.shouldResistFingerprinting ||
|
||||
!ChromeUtils.shouldResistFingerprinting("SiteSpecificZoom")
|
||||
!ChromeUtils.shouldResistFingerprinting(
|
||||
"SiteSpecificZoom",
|
||||
aBrowser?.browsingContext?.topWindowContext
|
||||
.overriddenFingerprintingSettings
|
||||
)
|
||||
);
|
||||
},
|
||||
|
||||
|
|
|
@ -1570,7 +1570,7 @@ var gBrowserInit = {
|
|||
updateBookmarkToolbarVisibility();
|
||||
|
||||
// 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
|
||||
// have a maximum window to interfere with generating rounded window dimensions.
|
||||
document.documentElement.setAttribute("sizemode", "normal");
|
||||
|
|
|
@ -1876,8 +1876,9 @@ void ChromeUtils::GetAllPossibleUtilityActorNames(GlobalObject& aGlobal,
|
|||
}
|
||||
|
||||
/* static */
|
||||
bool ChromeUtils::ShouldResistFingerprinting(GlobalObject& aGlobal,
|
||||
JSRFPTarget aTarget) {
|
||||
bool ChromeUtils::ShouldResistFingerprinting(
|
||||
GlobalObject& aGlobal, JSRFPTarget aTarget,
|
||||
const Nullable<uint64_t>& aOverriddenFingerprintingSettings) {
|
||||
RFPTarget target;
|
||||
switch (aTarget) {
|
||||
case JSRFPTarget::RoundWindowSize:
|
||||
|
@ -1890,7 +1891,14 @@ bool ChromeUtils::ShouldResistFingerprinting(GlobalObject& aGlobal,
|
|||
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;
|
||||
|
|
|
@ -304,8 +304,9 @@ class ChromeUtils {
|
|||
static void GetAllPossibleUtilityActorNames(GlobalObject& aGlobal,
|
||||
nsTArray<nsCString>& aNames);
|
||||
|
||||
static bool ShouldResistFingerprinting(GlobalObject& aGlobal,
|
||||
JSRFPTarget aTarget);
|
||||
static bool ShouldResistFingerprinting(
|
||||
GlobalObject& aGlobal, JSRFPTarget aTarget,
|
||||
const Nullable<uint64_t>& aOverriddenFingerprintingSettings);
|
||||
|
||||
private:
|
||||
// Number of DevTools session debugging the current process
|
||||
|
|
|
@ -16311,7 +16311,9 @@ bool Document::RecomputeResistFingerprinting() {
|
|||
}
|
||||
|
||||
bool Document::ShouldResistFingerprinting(RFPTarget aTarget) const {
|
||||
return mShouldResistFingerprinting && nsRFPService::IsRFPEnabledFor(aTarget);
|
||||
return mShouldResistFingerprinting &&
|
||||
nsRFPService::IsRFPEnabledFor(aTarget,
|
||||
mOverriddenFingerprintingSettings);
|
||||
}
|
||||
|
||||
WindowContext* Document::GetWindowContextForPageUseCounters() const {
|
||||
|
|
|
@ -2135,7 +2135,7 @@ bool nsContentUtils::IsCallerChromeOrElementTransformGettersEnabled(
|
|||
|
||||
/* static */
|
||||
bool nsContentUtils::ShouldResistFingerprinting(RFPTarget aTarget) {
|
||||
return nsRFPService::IsRFPEnabledFor(aTarget);
|
||||
return nsRFPService::IsRFPEnabledFor(aTarget, Nothing());
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
|
|
@ -717,7 +717,8 @@ partial namespace ChromeUtils {
|
|||
[ChromeOnly]
|
||||
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 {
|
||||
return mLoadInfo.mShouldResistFingerprinting &&
|
||||
nsRFPService::IsRFPEnabledFor(aTarget);
|
||||
nsRFPService::IsRFPEnabledFor(
|
||||
aTarget, mLoadInfo.mOverriddenFingerprintingSettings);
|
||||
}
|
||||
|
||||
void WorkerPrivate::SetRemoteWorkerController(RemoteWorkerChild* aController) {
|
||||
|
|
|
@ -85,7 +85,8 @@ class WorkletImpl {
|
|||
bool IsSystemPrincipal() const { return mPrincipal->IsSystemPrincipal(); }
|
||||
bool ShouldResistFingerprinting(RFPTarget aTarget) const {
|
||||
return mShouldResistFingerprinting &&
|
||||
nsRFPService::IsRFPEnabledFor(aTarget);
|
||||
nsRFPService::IsRFPEnabledFor(aTarget,
|
||||
mOverriddenFingerprintingSettings);
|
||||
}
|
||||
|
||||
virtual void OnAddModuleStarted() const {
|
||||
|
|
|
@ -194,7 +194,9 @@ bool nsRFPService::IsRFPPrefEnabled(bool aIsPrivateMode) {
|
|||
}
|
||||
|
||||
/* static */
|
||||
bool nsRFPService::IsRFPEnabledFor(RFPTarget aTarget) {
|
||||
bool nsRFPService::IsRFPEnabledFor(
|
||||
RFPTarget aTarget,
|
||||
const Maybe<RFPTarget>& aOverriddenFingerprintingSettings) {
|
||||
MOZ_ASSERT(aTarget != RFPTarget::AllTargets);
|
||||
|
||||
if (StaticPrefs::privacy_resistFingerprinting_DoNotUseDirectly() ||
|
||||
|
@ -210,6 +212,11 @@ bool nsRFPService::IsRFPEnabledFor(RFPTarget aTarget) {
|
|||
if (aTarget == RFPTarget::IsAlwaysEnabledForPrecompute) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (aOverriddenFingerprintingSettings) {
|
||||
return bool(aOverriddenFingerprintingSettings.ref() & 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
|
||||
// as the difference will not matter to you.
|
||||
static bool IsRFPPrefEnabled(bool aIsPrivateMode);
|
||||
static bool IsRFPEnabledFor(RFPTarget aTarget);
|
||||
static bool IsRFPEnabledFor(
|
||||
RFPTarget aTarget,
|
||||
const Maybe<RFPTarget>& aOverriddenFingerprintingSettings);
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
static double TimerResolution(RTPCallerType aRTPCallerType);
|
||||
|
|
Загрузка…
Ссылка в новой задаче