mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
Bug 1510909 - Bypass calling nsContentUtils::IsThirdPartyWindowOrChannel() for BEHAVIOR_REJECT_TRACKER r=baku
Calling this function is just a waste of time since we will check third-partiness a few statements further down. Differential Revision: https://phabricator.services.mozilla.com/D13500 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
3fdc51e66c
commit
9a096cb89d
@ -885,10 +885,15 @@ bool AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
|
||||
return false;
|
||||
}
|
||||
|
||||
// Let's check if this is a 3rd party context.
|
||||
if (!nsContentUtils::IsThirdPartyWindowOrChannel(aWindow, nullptr, aURI)) {
|
||||
LOG(("Our window isn't a third-party window"));
|
||||
return true;
|
||||
// As a performance optimization, we only perform this check for
|
||||
// BEHAVIOR_REJECT_FOREIGN and BEHAVIOR_LIMIT_FOREIGN. For
|
||||
// BEHAVIOR_REJECT_TRACKER, third-partiness is implicily checked later below.
|
||||
if (behavior != nsICookieService::BEHAVIOR_REJECT_TRACKER) {
|
||||
// Let's check if this is a 3rd party context.
|
||||
if (!nsContentUtils::IsThirdPartyWindowOrChannel(aWindow, nullptr, aURI)) {
|
||||
LOG(("Our window isn't a third-party window"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (behavior == nsICookieService::BEHAVIOR_REJECT_FOREIGN ||
|
||||
@ -909,6 +914,20 @@ bool AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil = services::GetThirdPartyUtil();
|
||||
if (thirdPartyUtil) {
|
||||
bool thirdParty = false;
|
||||
nsresult rv = thirdPartyUtil->IsThirdPartyWindow(aWindow->GetOuterWindow(),
|
||||
aURI, &thirdParty);
|
||||
// The result of this assertion depends on whether IsThirdPartyWindow
|
||||
// succeeds, because otherwise IsThirdPartyWindowOrChannel artificially
|
||||
// fails.
|
||||
MOZ_ASSERT(nsContentUtils::IsThirdPartyWindowOrChannel(
|
||||
aWindow, nullptr, aURI) == NS_SUCCEEDED(rv));
|
||||
}
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIPrincipal> parentPrincipal;
|
||||
nsCOMPtr<nsIURI> parentPrincipalURI;
|
||||
nsCOMPtr<nsIURI> trackingURI;
|
||||
|
Loading…
Reference in New Issue
Block a user