зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1637194 - P2. Set firstPartyDomain to CookieJarSetting in nsHttpChannel::AsyncOpen r=necko-reviewers,timhuang,baku,kershaw
FirstPartyDomain is only set while loading a top-level document. We added in nsHttpChannel::AsyncOpen to ensure that the value is updated whenever we open a channel. Differential Revision: https://phabricator.services.mozilla.com/D75277
This commit is contained in:
Родитель
7cf904bbc5
Коммит
ae8751a56d
|
@ -433,6 +433,7 @@ bool DocumentLoadListener::Open(
|
||||||
httpBaseChannel->SetTopWindowURI(topWindowURI);
|
httpBaseChannel->SetTopWindowURI(topWindowURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Remove this in Bug 1639140
|
||||||
Unused << loadInfo->SetHasStoragePermission(
|
Unused << loadInfo->SetHasStoragePermission(
|
||||||
AntiTrackingUtils::HasStoragePermissionInParent(mChannel));
|
AntiTrackingUtils::HasStoragePermissionInParent(mChannel));
|
||||||
|
|
||||||
|
|
|
@ -1857,6 +1857,25 @@ void nsHttpChannel::SetCachedContentType() {
|
||||||
mCacheEntry->SetContentType(contentType);
|
mCacheEntry->SetContentType(contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nsHttpChannel::UpdateAntiTrackingInfo() {
|
||||||
|
Unused << mLoadInfo->SetHasStoragePermission(
|
||||||
|
AntiTrackingUtils::HasStoragePermissionInParent(this));
|
||||||
|
|
||||||
|
AntiTrackingUtils::ComputeIsThirdPartyToTopWindow(this);
|
||||||
|
|
||||||
|
// We only need to set FPD for top-level loads. FPD will automatically be
|
||||||
|
// propagated to non-top level loads via CookieJarSetting.
|
||||||
|
if (mLoadInfo->GetExternalContentPolicyType() ==
|
||||||
|
nsIContentPolicy::TYPE_DOCUMENT) {
|
||||||
|
nsCOMPtr<nsICookieJarSettings> cookieJarSettings;
|
||||||
|
Unused << mLoadInfo->GetCookieJarSettings(
|
||||||
|
getter_AddRefs(cookieJarSettings));
|
||||||
|
|
||||||
|
mozilla::net::CookieJarSettings::Cast(cookieJarSettings)
|
||||||
|
->SetFirstPartyDomain(mURI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
nsresult nsHttpChannel::CallOnStartRequest() {
|
nsresult nsHttpChannel::CallOnStartRequest() {
|
||||||
LOG(("nsHttpChannel::CallOnStartRequest [this=%p]", this));
|
LOG(("nsHttpChannel::CallOnStartRequest [this=%p]", this));
|
||||||
|
|
||||||
|
@ -6506,11 +6525,6 @@ nsHttpChannel::AsyncOpen(nsIStreamListener* aListener) {
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
return NS_ERROR_NOT_AVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Unused << mLoadInfo->SetHasStoragePermission(
|
|
||||||
AntiTrackingUtils::HasStoragePermissionInParent(this));
|
|
||||||
|
|
||||||
AntiTrackingUtils::ComputeIsThirdPartyToTopWindow(this);
|
|
||||||
|
|
||||||
static bool sRCWNInited = false;
|
static bool sRCWNInited = false;
|
||||||
if (!sRCWNInited) {
|
if (!sRCWNInited) {
|
||||||
sRCWNInited = true;
|
sRCWNInited = true;
|
||||||
|
@ -6542,6 +6556,8 @@ nsHttpChannel::AsyncOpen(nsIStreamListener* aListener) {
|
||||||
UpdatePrivateBrowsing();
|
UpdatePrivateBrowsing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UpdateAntiTrackingInfo();
|
||||||
|
|
||||||
if (WaitingForTailUnblock()) {
|
if (WaitingForTailUnblock()) {
|
||||||
// This channel is marked as Tail and is part of a request context
|
// This channel is marked as Tail and is part of a request context
|
||||||
// that has positive number of non-tailed requestst, hence this channel
|
// that has positive number of non-tailed requestst, hence this channel
|
||||||
|
|
|
@ -569,6 +569,11 @@ class nsHttpChannel final : public HttpBaseChannel,
|
||||||
// writing a new entry. The content type is used in cache internally only.
|
// writing a new entry. The content type is used in cache internally only.
|
||||||
void SetCachedContentType();
|
void SetCachedContentType();
|
||||||
|
|
||||||
|
// This function updates all the fields used by anti-tracking when a channel
|
||||||
|
// is opened. We have to do this in the parent to access cross-origin info
|
||||||
|
// that is not exposed to child processes.
|
||||||
|
void UpdateAntiTrackingInfo();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// this section is for main-thread-only object
|
// this section is for main-thread-only object
|
||||||
// all the references need to be proxy released on main thread.
|
// all the references need to be proxy released on main thread.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче