Bug 1876575, part 2 - Make Workers use ancestor chain for third-partiness check - r=anti-tracking-reviewers,timhuang,asuth
Differential Revision: https://phabricator.services.mozilla.com/D203289
This commit is contained in:
@@ -1063,8 +1063,8 @@ nsresult WorkerScriptLoader::LoadScript(
|
||||
// This flag reflects the fact that if the worker is created under a
|
||||
// third-party context.
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = channel->LoadInfo();
|
||||
loadInfo->SetIsThirdPartyContextToTopWindow(
|
||||
mWorkerRef->Private()->IsThirdPartyContextToTopWindow());
|
||||
loadInfo->SetIsInThirdPartyContext(
|
||||
mWorkerRef->Private()->IsThirdPartyContext());
|
||||
|
||||
Maybe<ClientInfo> clientInfo;
|
||||
clientInfo.emplace(loadContext->mClientInfo.ref());
|
||||
|
||||
@@ -101,7 +101,7 @@ WorkerLoadInfoData::WorkerLoadInfoData()
|
||||
mUsingStorageAccess(false),
|
||||
mServiceWorkersTestingInWindow(false),
|
||||
mShouldResistFingerprinting(false),
|
||||
mIsThirdPartyContextToTopWindow(true),
|
||||
mIsThirdPartyContext(true),
|
||||
mSecureContext(eNotSet) {}
|
||||
|
||||
nsresult WorkerLoadInfo::SetPrincipalsAndCSPOnMainThread(
|
||||
|
||||
@@ -147,7 +147,7 @@ struct WorkerLoadInfoData {
|
||||
bool mShouldResistFingerprinting;
|
||||
Maybe<RFPTarget> mOverriddenFingerprintingSettings;
|
||||
OriginAttributes mOriginAttributes;
|
||||
bool mIsThirdPartyContextToTopWindow;
|
||||
bool mIsThirdPartyContext;
|
||||
|
||||
enum {
|
||||
eNotSet,
|
||||
|
||||
@@ -2791,8 +2791,7 @@ nsresult WorkerPrivate::GetLoadInfo(
|
||||
loadInfo.mOriginAttributes = aParent->GetOriginAttributes();
|
||||
loadInfo.mServiceWorkersTestingInWindow =
|
||||
aParent->ServiceWorkersTestingInWindow();
|
||||
loadInfo.mIsThirdPartyContextToTopWindow =
|
||||
aParent->IsThirdPartyContextToTopWindow();
|
||||
loadInfo.mIsThirdPartyContext = aParent->IsThirdPartyContext();
|
||||
loadInfo.mShouldResistFingerprinting = aParent->ShouldResistFingerprinting(
|
||||
RFPTarget::IsAlwaysEnabledForPrecompute);
|
||||
loadInfo.mOverriddenFingerprintingSettings =
|
||||
@@ -2953,7 +2952,7 @@ nsresult WorkerPrivate::GetLoadInfo(
|
||||
StorageAllowedForDocument(document) != StorageAccess::eAllow) {
|
||||
loadInfo.mUsingStorageAccess = false;
|
||||
}
|
||||
loadInfo.mIsThirdPartyContextToTopWindow =
|
||||
loadInfo.mIsThirdPartyContext =
|
||||
AntiTrackingUtils::IsThirdPartyWindow(globalWindow, nullptr);
|
||||
loadInfo.mCookieJarSettings = document->CookieJarSettings();
|
||||
if (loadInfo.mCookieJarSettings) {
|
||||
@@ -3021,7 +3020,7 @@ nsresult WorkerPrivate::GetLoadInfo(
|
||||
cookieJarSettings->Serialize(loadInfo.mCookieJarSettingsArgs);
|
||||
|
||||
loadInfo.mOriginAttributes = OriginAttributes();
|
||||
loadInfo.mIsThirdPartyContextToTopWindow = false;
|
||||
loadInfo.mIsThirdPartyContext = false;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(loadInfo.mLoadingPrincipal);
|
||||
|
||||
@@ -972,9 +972,7 @@ class WorkerPrivate final
|
||||
}
|
||||
|
||||
// Determine if the worker was created under a third-party context.
|
||||
bool IsThirdPartyContextToTopWindow() const {
|
||||
return mLoadInfo.mIsThirdPartyContextToTopWindow;
|
||||
}
|
||||
bool IsThirdPartyContext() const { return mLoadInfo.mIsThirdPartyContext; }
|
||||
|
||||
bool IsWatchedByDevTools() const { return mLoadInfo.mWatchedByDevTools; }
|
||||
|
||||
|
||||
@@ -286,7 +286,7 @@ nsresult RemoteWorkerChild::ExecWorkerOnMainThread(RemoteWorkerData&& aData) {
|
||||
info.mStorageAccess = aData.storageAccess();
|
||||
info.mUseRegularPrincipal = aData.useRegularPrincipal();
|
||||
info.mUsingStorageAccess = aData.usingStorageAccess();
|
||||
info.mIsThirdPartyContextToTopWindow = aData.isThirdPartyContextToTopWindow();
|
||||
info.mIsThirdPartyContext = aData.isThirdPartyContext();
|
||||
info.mOriginAttributes =
|
||||
BasePrincipal::Cast(principal)->OriginAttributesRef();
|
||||
info.mShouldResistFingerprinting = aData.shouldResistFingerprinting();
|
||||
|
||||
@@ -76,7 +76,7 @@ struct RemoteWorkerData
|
||||
|
||||
StorageAccess storageAccess;
|
||||
|
||||
bool isThirdPartyContextToTopWindow;
|
||||
bool isThirdPartyContext;
|
||||
|
||||
bool shouldResistFingerprinting;
|
||||
|
||||
|
||||
@@ -437,7 +437,7 @@ bool StoragePrincipalHelper::ShouldUsePartitionPrincipalForServiceWorker(
|
||||
return false;
|
||||
}
|
||||
|
||||
return aWorkerPrivate->IsThirdPartyContextToTopWindow();
|
||||
return aWorkerPrivate->IsThirdPartyContext();
|
||||
}
|
||||
|
||||
// static
|
||||
|
||||
Reference in New Issue
Block a user