зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1731982 - Part 10: Use AntiTrackingUtils::IsThirdPartyContext() to check third party in AntiTrackingUtils::IsThirdPartyWindow() if the channel is not available. r=pbz
We used to use the ThirdPartyUtil::IsThirdPartyWindow() to check third party if the document or the channel is not available. However, this could be incorrect in the case where the channel is not available because the WindowContext is not ready yet. To address this issue, we use the browingContext of the document to check third party. Differential Revision: https://phabricator.services.mozilla.com/D128601
This commit is contained in:
Родитель
efb970c784
Коммит
4793e51a6e
|
@ -651,9 +651,9 @@ bool AntiTrackingUtils::IsThirdPartyWindow(nsPIDOMWindowInner* aWindow,
|
|||
}
|
||||
|
||||
RefPtr<Document> doc = aWindow->GetDoc();
|
||||
if (!doc || !doc->GetChannel()) {
|
||||
// If we can't get channel from the window, ex, about:blank, fallback to use
|
||||
// IsThirdPartyWindow check that examine the whole hierarchy.
|
||||
if (!doc) {
|
||||
// If we can't get the document from the window, ex, about:blank, fallback
|
||||
// to use IsThirdPartyWindow check that examine the whole hierarchy.
|
||||
nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil =
|
||||
components::ThirdPartyUtil::Service();
|
||||
Unused << thirdPartyUtil->IsThirdPartyWindow(aWindow->GetOuterWindow(),
|
||||
|
@ -661,6 +661,13 @@ bool AntiTrackingUtils::IsThirdPartyWindow(nsPIDOMWindowInner* aWindow,
|
|||
return thirdParty;
|
||||
}
|
||||
|
||||
if (!doc->GetChannel()) {
|
||||
// If we can't get the channel from the document, i.e. initial about:blank
|
||||
// page, we use the browsingContext of the document to check if it's in the
|
||||
// third-party context.
|
||||
return IsThirdPartyContext(doc->GetBrowsingContext());
|
||||
}
|
||||
|
||||
// We only care whether the channel is 3rd-party with respect to
|
||||
// the top-level.
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = doc->GetChannel()->LoadInfo();
|
||||
|
|
Загрузка…
Ссылка в новой задаче