Skip to content

Commit 8ed546c

Browse files
committed
Bug 1968644 - Part 1: Introduce triggeringFirstPartyClassificationFlags and triggeringThirdPartyClassificationFlags to LoadInfo. r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D252443
1 parent 2387101 commit 8ed546c

File tree

6 files changed

+92
-7
lines changed

6 files changed

+92
-7
lines changed

ipc/glue/BackgroundUtils.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,8 @@ nsresult LoadInfoToLoadInfoArgs(nsILoadInfo* aLoadInfo,
565565
aLoadInfo->GetSandboxFlags(), aLoadInfo->GetTriggeringSandboxFlags(),
566566
aLoadInfo->GetTriggeringWindowId(),
567567
aLoadInfo->GetTriggeringStorageAccess(),
568+
aLoadInfo->GetTriggeringFirstPartyClassificationFlags(),
569+
aLoadInfo->GetTriggeringThirdPartyClassificationFlags(),
568570
aLoadInfo->InternalContentPolicyType(),
569571
static_cast<uint32_t>(aLoadInfo->GetTainting()),
570572
aLoadInfo->GetBlockAllMixedContent(),
@@ -860,7 +862,10 @@ nsresult LoadInfoArgsToLoadInfo(const LoadInfoArgs& loadInfoArgs,
860862
reservedClientInfo, initialClientInfo, controller,
861863
loadInfoArgs.securityFlags(), loadInfoArgs.sandboxFlags(),
862864
loadInfoArgs.triggeringSandboxFlags(), loadInfoArgs.triggeringWindowId(),
863-
loadInfoArgs.triggeringStorageAccess(), loadInfoArgs.contentPolicyType(),
865+
loadInfoArgs.triggeringStorageAccess(),
866+
loadInfoArgs.triggeringFirstPartyClassificationFlags(),
867+
loadInfoArgs.triggeringThirdPartyClassificationFlags(),
868+
loadInfoArgs.contentPolicyType(),
864869
static_cast<LoadTainting>(loadInfoArgs.tainting()),
865870
loadInfoArgs.blockAllMixedContent(),
866871
loadInfoArgs.upgradeInsecureRequests(),

netwerk/base/LoadInfo.cpp

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,10 @@ LoadInfo::LoadInfo(const LoadInfo& rhs)
718718
mTriggeringSandboxFlags(rhs.mTriggeringSandboxFlags),
719719
mTriggeringWindowId(rhs.mTriggeringWindowId),
720720
mTriggeringStorageAccess(rhs.mTriggeringStorageAccess),
721+
mTriggeringFirstPartyClassificationFlags(
722+
rhs.mTriggeringFirstPartyClassificationFlags),
723+
mTriggeringThirdPartyClassificationFlags(
724+
rhs.mTriggeringThirdPartyClassificationFlags),
721725
mInternalContentPolicyType(rhs.mInternalContentPolicyType),
722726
mTainting(rhs.mTainting),
723727
mBlockAllMixedContent(rhs.mBlockAllMixedContent),
@@ -809,9 +813,12 @@ LoadInfo::LoadInfo(
809813
const Maybe<ServiceWorkerDescriptor>& aController,
810814
nsSecurityFlags aSecurityFlags, uint32_t aSandboxFlags,
811815
uint32_t aTriggeringSandboxFlags, uint64_t aTriggeringWindowId,
812-
bool aTriggeringStorageAccess, nsContentPolicyType aContentPolicyType,
813-
LoadTainting aTainting, bool aBlockAllMixedContent,
814-
bool aUpgradeInsecureRequests, bool aBrowserUpgradeInsecureRequests,
816+
bool aTriggeringStorageAccess,
817+
uint32_t aTriggeringFirstPartyClassificationFlags,
818+
uint32_t aTriggeringThirdPartyClassificationFlags,
819+
nsContentPolicyType aContentPolicyType, LoadTainting aTainting,
820+
bool aBlockAllMixedContent, bool aUpgradeInsecureRequests,
821+
bool aBrowserUpgradeInsecureRequests,
815822
bool aBrowserDidUpgradeInsecureRequests,
816823
bool aBrowserWouldUpgradeInsecureRequests, bool aForceAllowDataURI,
817824
bool aAllowInsecureRedirectToDataURI,
@@ -870,6 +877,10 @@ LoadInfo::LoadInfo(
870877
mTriggeringSandboxFlags(aTriggeringSandboxFlags),
871878
mTriggeringWindowId(aTriggeringWindowId),
872879
mTriggeringStorageAccess(aTriggeringStorageAccess),
880+
mTriggeringFirstPartyClassificationFlags(
881+
aTriggeringFirstPartyClassificationFlags),
882+
mTriggeringThirdPartyClassificationFlags(
883+
aTriggeringThirdPartyClassificationFlags),
873884
mInternalContentPolicyType(aContentPolicyType),
874885
mTainting(aTainting),
875886
mBlockAllMixedContent(aBlockAllMixedContent),
@@ -1201,6 +1212,30 @@ LoadInfo::SetTriggeringStorageAccess(bool aFlags) {
12011212
return NS_OK;
12021213
}
12031214

1215+
NS_IMETHODIMP
1216+
LoadInfo::GetTriggeringFirstPartyClassificationFlags(uint32_t* aResult) {
1217+
*aResult = mTriggeringFirstPartyClassificationFlags;
1218+
return NS_OK;
1219+
}
1220+
1221+
NS_IMETHODIMP
1222+
LoadInfo::SetTriggeringFirstPartyClassificationFlags(uint32_t aFlags) {
1223+
mTriggeringFirstPartyClassificationFlags = aFlags;
1224+
return NS_OK;
1225+
}
1226+
1227+
NS_IMETHODIMP
1228+
LoadInfo::GetTriggeringThirdPartyClassificationFlags(uint32_t* aResult) {
1229+
*aResult = mTriggeringThirdPartyClassificationFlags;
1230+
return NS_OK;
1231+
}
1232+
1233+
NS_IMETHODIMP
1234+
LoadInfo::SetTriggeringThirdPartyClassificationFlags(uint32_t aFlags) {
1235+
mTriggeringThirdPartyClassificationFlags = aFlags;
1236+
return NS_OK;
1237+
}
1238+
12041239
NS_IMETHODIMP
12051240
LoadInfo::GetSecurityMode(uint32_t* aFlags) {
12061241
*aFlags = nsContentSecurityManager::ComputeSecurityMode(mSecurityFlags);

netwerk/base/LoadInfo.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,12 @@ class LoadInfo final : public nsILoadInfo {
237237
const Maybe<mozilla::dom::ServiceWorkerDescriptor>& aController,
238238
nsSecurityFlags aSecurityFlags, uint32_t aSandboxFlags,
239239
uint32_t aTriggeringSandboxFlags, uint64_t aTriggeringWindowId,
240-
bool aTriggeringStorageAccess, nsContentPolicyType aContentPolicyType,
241-
LoadTainting aTainting, bool aBlockAllMixedContent,
242-
bool aUpgradeInsecureRequests, bool aBrowserUpgradeInsecureRequests,
240+
bool aTriggeringStorageAccess,
241+
uint32_t aTriggeringFirstPartyClassificationFlags,
242+
uint32_t aTriggeringThirdPartyClassificationFlags,
243+
nsContentPolicyType aContentPolicyType, LoadTainting aTainting,
244+
bool aBlockAllMixedContent, bool aUpgradeInsecureRequests,
245+
bool aBrowserUpgradeInsecureRequests,
243246
bool aBrowserDidUpgradeInsecureRequests,
244247
bool aBrowserWouldUpgradeInsecureRequests, bool aForceAllowDataURI,
245248
bool aAllowInsecureRedirectToDataURI,
@@ -348,6 +351,8 @@ class LoadInfo final : public nsILoadInfo {
348351
uint32_t mTriggeringSandboxFlags = 0;
349352
uint64_t mTriggeringWindowId = 0;
350353
bool mTriggeringStorageAccess = false;
354+
uint32_t mTriggeringFirstPartyClassificationFlags = 0;
355+
uint32_t mTriggeringThirdPartyClassificationFlags = 0;
351356
nsContentPolicyType mInternalContentPolicyType;
352357
LoadTainting mTainting = LoadTainting::Basic;
353358
bool mBlockAllMixedContent = false;

netwerk/base/TRRLoadInfo.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,26 @@ TRRLoadInfo::SetTriggeringStorageAccess(bool aResult) {
150150
return NS_ERROR_NOT_IMPLEMENTED;
151151
}
152152

153+
NS_IMETHODIMP
154+
TRRLoadInfo::GetTriggeringFirstPartyClassificationFlags(uint32_t* aResult) {
155+
return NS_ERROR_NOT_IMPLEMENTED;
156+
}
157+
158+
NS_IMETHODIMP
159+
TRRLoadInfo::SetTriggeringFirstPartyClassificationFlags(uint32_t aResult) {
160+
return NS_ERROR_NOT_IMPLEMENTED;
161+
}
162+
163+
NS_IMETHODIMP
164+
TRRLoadInfo::GetTriggeringThirdPartyClassificationFlags(uint32_t* aResult) {
165+
return NS_ERROR_NOT_IMPLEMENTED;
166+
}
167+
168+
NS_IMETHODIMP
169+
TRRLoadInfo::SetTriggeringThirdPartyClassificationFlags(uint32_t aResult) {
170+
return NS_ERROR_NOT_IMPLEMENTED;
171+
}
172+
153173
NS_IMETHODIMP
154174
TRRLoadInfo::GetSecurityMode(uint32_t* aFlags) {
155175
return NS_ERROR_NOT_IMPLEMENTED;

netwerk/base/nsILoadInfo.idl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,24 @@ interface nsILoadInfo : nsISupports
457457
[infallible] attribute unsigned long long triggeringWindowId;
458458
[infallible] attribute boolean triggeringStorageAccess;
459459

460+
/**
461+
* The classification flags of the first-party context responsible for causing
462+
* the load to start. If the load is not triggered by a first-party context,
463+
* this will be 0.
464+
*
465+
* See nsIClassifiedChannel.idl for the list of flags.
466+
*/
467+
[infallible] attribute unsigned long triggeringFirstPartyClassificationFlags;
468+
469+
/**
470+
* The classification flags of the third-party context responsible for causing
471+
* the load to start. If the load is not triggered by a third-party context,
472+
* this will be 0.
473+
*
474+
* See nsIClassifiedChannel.idl for the list of flags.
475+
*/
476+
[infallible] attribute unsigned long triggeringThirdPartyClassificationFlags;
477+
460478
/**
461479
* Allows to query only the security mode bits from above.
462480
*/

netwerk/ipc/NeckoChannelParams.ipdlh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ struct LoadInfoArgs
119119
uint32_t triggeringSandboxFlags;
120120
uint64_t triggeringWindowId;
121121
bool triggeringStorageAccess;
122+
uint32_t triggeringFirstPartyClassificationFlags;
123+
uint32_t triggeringThirdPartyClassificationFlags;
122124
nsContentPolicyType contentPolicyType;
123125
uint32_t tainting;
124126
bool blockAllMixedContent;

0 commit comments

Comments
 (0)