зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1641459 - Consider 3rd parties cookie requested by documents with a window, r=smaug CLOSED TREE
This is required for how Cookies gtests are written Differential Revision: https://phabricator.services.mozilla.com/D77301
This commit is contained in:
Родитель
332eda16ac
Коммит
d0913541e4
|
@ -317,14 +317,15 @@ CookieService::GetCookieStringFromDocument(Document* aDocument,
|
|||
// if it isn't, then we can't send a secure cookie over the connection.
|
||||
bool potentiallyTurstworthy = principal->GetIsOriginPotentiallyTrustworthy();
|
||||
|
||||
bool thirdParty = true;
|
||||
nsPIDOMWindowInner* innerWindow = aDocument->GetInnerWindow();
|
||||
if (NS_WARN_IF(!innerWindow)) {
|
||||
return NS_OK;
|
||||
// in gtests we don't have a window, let's consider those requests as 3rd
|
||||
// party.
|
||||
if (innerWindow) {
|
||||
thirdParty = nsContentUtils::IsThirdPartyWindowOrChannel(innerWindow,
|
||||
nullptr, nullptr);
|
||||
}
|
||||
|
||||
bool thirdParty = nsContentUtils::IsThirdPartyWindowOrChannel(
|
||||
innerWindow, nullptr, nullptr);
|
||||
|
||||
bool stale = false;
|
||||
nsTArray<Cookie*> cookieList;
|
||||
|
||||
|
@ -455,13 +456,16 @@ CookieService::SetCookieStringFromDocument(Document* aDocument,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool thirdParty = true;
|
||||
nsPIDOMWindowInner* innerWindow = aDocument->GetInnerWindow();
|
||||
if (NS_WARN_IF(!innerWindow)) {
|
||||
return NS_OK;
|
||||
// in gtests we don't have a window, let's consider those requests as 3rd
|
||||
// party.
|
||||
if (innerWindow) {
|
||||
thirdParty = nsContentUtils::IsThirdPartyWindowOrChannel(innerWindow,
|
||||
nullptr, nullptr);
|
||||
}
|
||||
|
||||
if (nsContentUtils::IsThirdPartyWindowOrChannel(innerWindow, nullptr,
|
||||
nullptr) &&
|
||||
if (thirdParty &&
|
||||
!CookieCommons::ShouldIncludeCrossSiteCookieForDocument(cookie)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -351,14 +351,15 @@ CookieServiceChild::GetCookieStringFromDocument(Document* aDocument,
|
|||
nsAutoCString pathFromURI;
|
||||
principal->GetFilePath(pathFromURI);
|
||||
|
||||
bool thirdParty = true;
|
||||
nsPIDOMWindowInner* innerWindow = aDocument->GetInnerWindow();
|
||||
if (NS_WARN_IF(!innerWindow)) {
|
||||
return NS_OK;
|
||||
// in gtests we don't have a window, let's consider those requests as 3rd
|
||||
// party.
|
||||
if (innerWindow) {
|
||||
thirdParty = nsContentUtils::IsThirdPartyWindowOrChannel(innerWindow,
|
||||
nullptr, nullptr);
|
||||
}
|
||||
|
||||
bool thirdParty = nsContentUtils::IsThirdPartyWindowOrChannel(
|
||||
innerWindow, nullptr, nullptr);
|
||||
|
||||
bool isPotentiallyTrustworthy =
|
||||
principal->GetIsOriginPotentiallyTrustworthy();
|
||||
int64_t currentTimeInUsec = PR_Now();
|
||||
|
@ -444,13 +445,16 @@ CookieServiceChild::SetCookieStringFromDocument(
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool thirdParty = true;
|
||||
nsPIDOMWindowInner* innerWindow = aDocument->GetInnerWindow();
|
||||
if (NS_WARN_IF(!innerWindow)) {
|
||||
return NS_OK;
|
||||
// in gtests we don't have a window, let's consider those requests as 3rd
|
||||
// party.
|
||||
if (innerWindow) {
|
||||
thirdParty = nsContentUtils::IsThirdPartyWindowOrChannel(innerWindow,
|
||||
nullptr, nullptr);
|
||||
}
|
||||
|
||||
if (nsContentUtils::IsThirdPartyWindowOrChannel(innerWindow, nullptr,
|
||||
nullptr) &&
|
||||
if (thirdParty &&
|
||||
!CookieCommons::ShouldIncludeCrossSiteCookieForDocument(cookie)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -1026,6 +1026,7 @@ TEST(TestCookie, SameSiteLax)
|
|||
TEST(TestCookie, OnionSite)
|
||||
{
|
||||
Preferences::SetBool("dom.securecontext.whitelist_onions", true);
|
||||
Preferences::SetBool("network.cookie.sameSite.laxByDefault", false);
|
||||
|
||||
nsresult rv;
|
||||
nsCString cookie;
|
||||
|
|
Загрузка…
Ссылка в новой задаче