Bug 1837153 - Make RFPTarget parameter of ShouldResistFingerprinting with nsIChannel non-optional. r=tjr,cookie-reviewers,timhuang,geckoview-reviewers,owlish
Differential Revision: https://phabricator.services.mozilla.com/D180199
This commit is contained in:
@@ -2240,8 +2240,8 @@ bool nsContentUtils::ShouldResistFingerprinting(nsIDocShell* aDocShell,
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool nsContentUtils::ShouldResistFingerprinting(
|
||||
nsIChannel* aChannel, RFPTarget aTarget /* = RFPTarget::Unknown */) {
|
||||
bool nsContentUtils::ShouldResistFingerprinting(nsIChannel* aChannel,
|
||||
RFPTarget aTarget) {
|
||||
if (!aChannel) {
|
||||
MOZ_LOG(nsContentUtils::ResistFingerprintingLog(), LogLevel::Info,
|
||||
("Called nsContentUtils::ShouldResistFingerprinting(nsIChannel* "
|
||||
|
||||
@@ -367,8 +367,8 @@ class nsContentUtils {
|
||||
static bool ShouldResistFingerprinting(nsIDocShell* aDocShell,
|
||||
RFPTarget aTarget);
|
||||
// These functions are the new, nuanced functions
|
||||
static bool ShouldResistFingerprinting(
|
||||
nsIChannel* aChannel, RFPTarget aTarget = RFPTarget::Unknown);
|
||||
static bool ShouldResistFingerprinting(nsIChannel* aChannel,
|
||||
RFPTarget aTarget);
|
||||
static bool ShouldResistFingerprinting(
|
||||
nsILoadInfo* aLoadInfo, RFPTarget aTarget = RFPTarget::Unknown);
|
||||
// These functions are labeled as dangerous because they will do the wrong
|
||||
|
||||
@@ -238,7 +238,8 @@ ReferrerPolicy ReferrerInfo::GetDefaultReferrerPolicy(nsIHttpChannel* aChannel,
|
||||
Unused << loadInfo->GetCookieJarSettings(getter_AddRefs(cjs));
|
||||
if (!cjs) {
|
||||
bool shouldResistFingerprinting =
|
||||
nsContentUtils::ShouldResistFingerprinting(aChannel);
|
||||
nsContentUtils::ShouldResistFingerprinting(
|
||||
aChannel, RFPTarget::IsAlwaysEnabledForPrecompute);
|
||||
cjs = aPrivateBrowsing
|
||||
? net::CookieJarSettings::Create(CookieJarSettings::ePrivate,
|
||||
shouldResistFingerprinting)
|
||||
|
||||
@@ -451,8 +451,8 @@ already_AddRefed<Cookie> CookieCommons::CreateCookieFromDocument(
|
||||
already_AddRefed<nsICookieJarSettings> CookieCommons::GetCookieJarSettings(
|
||||
nsIChannel* aChannel) {
|
||||
nsCOMPtr<nsICookieJarSettings> cookieJarSettings;
|
||||
bool shouldResistFingerprinting =
|
||||
nsContentUtils::ShouldResistFingerprinting(aChannel);
|
||||
bool shouldResistFingerprinting = nsContentUtils::ShouldResistFingerprinting(
|
||||
aChannel, RFPTarget::IsAlwaysEnabledForPrecompute);
|
||||
if (aChannel) {
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->LoadInfo();
|
||||
nsresult rv =
|
||||
|
||||
@@ -396,7 +396,8 @@ nsresult HttpBaseChannel::Init(nsIURI* aURI, uint32_t aCaps,
|
||||
|
||||
rv = gHttpHandler->AddStandardRequestHeaders(
|
||||
&mRequestHead, isHTTPS, aContentPolicyType,
|
||||
nsContentUtils::ShouldResistFingerprinting(this));
|
||||
nsContentUtils::ShouldResistFingerprinting(this,
|
||||
RFPTarget::HttpUserAgent));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoCString type;
|
||||
|
||||
@@ -1213,7 +1213,8 @@ nsresult nsHttpChannel::SetupTransaction() {
|
||||
mCaps |= NS_HTTP_LOAD_ANONYMOUS_CONNECT_ALLOW_CLIENT_CERT;
|
||||
}
|
||||
|
||||
if (nsContentUtils::ShouldResistFingerprinting(this)) {
|
||||
if (nsContentUtils::ShouldResistFingerprinting(this,
|
||||
RFPTarget::HttpUserAgent)) {
|
||||
mCaps |= NS_HTTP_USE_RFP;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ ITEM_VALUE(StreamVideoFacingMode, 1u << 20)
|
||||
ITEM_VALUE(JSDateTimeUTC, 1u << 21)
|
||||
ITEM_VALUE(JSMathFdlibm, 1u << 22)
|
||||
ITEM_VALUE(Gamepad, 1u << 23)
|
||||
ITEM_VALUE(HttpUserAgent, 1u << 24)
|
||||
|
||||
// !!! Don't forget to update kDefaultFingerintingProtections in nsRFPService.cpp
|
||||
// if necessary.
|
||||
|
||||
@@ -386,8 +386,8 @@ nsresult WebExecutorSupport::CreateStreamLoader(
|
||||
channel->SetLoadFlags(nsIRequest::LOAD_ANONYMOUS);
|
||||
}
|
||||
|
||||
bool shouldResistFingerprinting =
|
||||
nsContentUtils::ShouldResistFingerprinting(channel);
|
||||
bool shouldResistFingerprinting = nsContentUtils::ShouldResistFingerprinting(
|
||||
channel, RFPTarget::IsAlwaysEnabledForPrecompute);
|
||||
nsCOMPtr<nsICookieJarSettings> cookieJarSettings;
|
||||
if (aFlags & java::GeckoWebExecutor::FETCH_FLAGS_PRIVATE) {
|
||||
nsCOMPtr<nsIPrivateBrowsingChannel> pbChannel = do_QueryInterface(channel);
|
||||
|
||||
Reference in New Issue
Block a user