зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1535697 - Part 1: Avoid calling AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor() more than once per channel; r=michal
Differential Revision: https://phabricator.services.mozilla.com/D28371 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
39d8ddcb3c
Коммит
7fb3204d5c
|
@ -334,6 +334,8 @@ nsHttpChannel::nsHttpChannel()
|
|||
mAuthConnectionRestartable(0),
|
||||
mChannelClassifierCancellationPending(0),
|
||||
mAsyncResumePending(0),
|
||||
mHasBeenIsolatedChecked(0),
|
||||
mIsIsolated(0),
|
||||
mPushedStream(nullptr),
|
||||
mLocalBlocklist(false),
|
||||
mOnTailUnblock(nullptr),
|
||||
|
@ -625,9 +627,7 @@ nsresult nsHttpChannel::ContinueOnBeforeConnect(bool aShouldUpgrade,
|
|||
mCaps |= NS_HTTP_DISABLE_TRR;
|
||||
}
|
||||
|
||||
bool isIsolated = mPrivateBrowsing ||
|
||||
!AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
|
||||
this, mURI, nullptr);
|
||||
bool isIsolated = mPrivateBrowsing || IsIsolated();
|
||||
|
||||
// Finalize ConnectionInfo flags before SpeculativeConnect
|
||||
mConnectionInfo->SetAnonymous((mLoadFlags & LOAD_ANONYMOUS) != 0);
|
||||
|
@ -3895,6 +3895,16 @@ nsresult nsHttpChannel::OpenCacheEntry(bool isHttps) {
|
|||
return OpenCacheEntryInternal(isHttps, mApplicationCache, true);
|
||||
}
|
||||
|
||||
bool nsHttpChannel::IsIsolated() {
|
||||
if (mHasBeenIsolatedChecked) {
|
||||
return mIsIsolated;
|
||||
}
|
||||
mIsIsolated = !AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
|
||||
this, mURI, nullptr);
|
||||
mHasBeenIsolatedChecked = true;
|
||||
return mIsIsolated;
|
||||
}
|
||||
|
||||
nsresult nsHttpChannel::OpenCacheEntryInternal(
|
||||
bool isHttps, nsIApplicationCache *applicationCache,
|
||||
bool allowApplicationCache) {
|
||||
|
@ -4014,9 +4024,7 @@ nsresult nsHttpChannel::OpenCacheEntryInternal(
|
|||
extension.Append("TRR");
|
||||
}
|
||||
|
||||
if (IsThirdPartyTrackingResource() &&
|
||||
!AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(this, mURI,
|
||||
nullptr)) {
|
||||
if (IsThirdPartyTrackingResource() && IsIsolated()) {
|
||||
nsCOMPtr<nsIURI> topWindowURI;
|
||||
rv = GetTopWindowURI(getter_AddRefs(topWindowURI));
|
||||
bool isDocument = false;
|
||||
|
|
|
@ -546,6 +546,8 @@ class nsHttpChannel final : public HttpBaseChannel,
|
|||
void SetOriginHeader();
|
||||
void SetDoNotTrack();
|
||||
|
||||
bool IsIsolated();
|
||||
|
||||
already_AddRefed<nsChannelClassifier> GetOrCreateChannelClassifier();
|
||||
|
||||
// Start an internal redirect to a new InterceptedHttpChannel which will
|
||||
|
@ -718,6 +720,14 @@ class nsHttpChannel final : public HttpBaseChannel,
|
|||
// Used to suspend any newly created pumps in mCallOnResume handler.
|
||||
uint32_t mAsyncResumePending : 1;
|
||||
|
||||
// True only when we have checked whether this channel has been isolated for
|
||||
// anti-tracking purposes.
|
||||
uint32_t mHasBeenIsolatedChecked : 1;
|
||||
// True only when we have determined this channel should be isolated for
|
||||
// anti-tracking purposes. Can never ben true unless mHasBeenIsolatedChecked
|
||||
// is true.
|
||||
uint32_t mIsIsolated : 1;
|
||||
|
||||
nsTArray<nsContinueRedirectionFunc> mRedirectFuncStack;
|
||||
|
||||
// Needed for accurate DNS timing
|
||||
|
|
Загрузка…
Ссылка в новой задаче