зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1623268 - P2. Refine the logic of third-party checks in ContentBlocking::AllowAccessFor r=timhuang,baku
This patch doesn't change the current behavior. The intention is to make this code section easier to understand. Differential Revision: https://phabricator.services.mozilla.com/D67282 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
3cd786fb66
Коммит
738efb7aa6
|
@ -383,24 +383,17 @@ ContentBlocking::AllowAccessFor(
|
|||
|
||||
} else {
|
||||
// We should be a 3rd party source.
|
||||
bool isThirdParty = false;
|
||||
if (behavior == nsICookieService::BEHAVIOR_REJECT_TRACKER) {
|
||||
isThirdParty =
|
||||
nsContentUtils::IsThirdPartyTrackingResourceWindow(parentWindow);
|
||||
// Make sure we are either a third-party tracker or a third-party
|
||||
// window (depends upon the cookie bahavior).
|
||||
if (behavior == nsICookieService::BEHAVIOR_REJECT_TRACKER &&
|
||||
!nsContentUtils::IsThirdPartyTrackingResourceWindow(parentWindow)) {
|
||||
LOG(("Our window isn't a third-party tracking window"));
|
||||
return StorageAccessGrantPromise::CreateAndReject(false, __func__);
|
||||
} else if (behavior == nsICookieService::
|
||||
BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN) {
|
||||
isThirdParty = nsContentUtils::IsThirdPartyWindowOrChannel(
|
||||
parentWindow, nullptr, nullptr);
|
||||
}
|
||||
|
||||
if (!isThirdParty) {
|
||||
if (behavior == nsICookieService::BEHAVIOR_REJECT_TRACKER) {
|
||||
LOG(("Our window isn't a third-party tracking window"));
|
||||
} else if (behavior ==
|
||||
nsICookieService::
|
||||
BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN) {
|
||||
LOG(("Our window isn't a third-party window"));
|
||||
}
|
||||
BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN &&
|
||||
!nsContentUtils::IsThirdPartyWindowOrChannel(parentWindow,
|
||||
nullptr, nullptr)) {
|
||||
LOG(("Our window isn't a third-party window"));
|
||||
return StorageAccessGrantPromise::CreateAndReject(false, __func__);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче