mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1640135 - P1: add new attribute for dFPI; r=timhuang
Differential Revision: https://phabricator.services.mozilla.com/D77914
This commit is contained in:
parent
256b591fe1
commit
edb1e5a899
@ -204,6 +204,13 @@ void OriginAttributes::CreateSuffix(nsACString& aStr) const {
|
||||
sanitizedGeckoViewUserContextId);
|
||||
}
|
||||
|
||||
if (!mPartitionKey.IsEmpty()) {
|
||||
nsAutoString sanitizedPartitionKey(mPartitionKey);
|
||||
sanitizedPartitionKey.ReplaceChar(kSourceChar, kSanitizedChar);
|
||||
|
||||
params.Set(NS_LITERAL_STRING("partitionKey"), sanitizedPartitionKey);
|
||||
}
|
||||
|
||||
aStr.Truncate();
|
||||
|
||||
params.Serialize(value);
|
||||
@ -229,6 +236,10 @@ void OriginAttributes::CreateAnonymizedSuffix(nsACString& aStr) const {
|
||||
attrs.mFirstPartyDomain.AssignLiteral("_anonymizedFirstPartyDomain_");
|
||||
}
|
||||
|
||||
if (!attrs.mPartitionKey.IsEmpty()) {
|
||||
attrs.mPartitionKey.AssignLiteral("_anonymizedPartitionKey_");
|
||||
}
|
||||
|
||||
attrs.CreateSuffix(aStr);
|
||||
}
|
||||
|
||||
@ -299,6 +310,14 @@ class MOZ_STACK_CLASS PopulateFromSuffixIterator final
|
||||
return true;
|
||||
}
|
||||
|
||||
if (aName.EqualsLiteral("partitionKey")) {
|
||||
MOZ_RELEASE_ASSERT(mOriginAttributes->mPartitionKey.IsEmpty());
|
||||
nsAutoString partitionKey(aValue);
|
||||
partitionKey.ReplaceChar(kSanitizedChar, kSourceChar);
|
||||
mOriginAttributes->mPartitionKey.Assign(partitionKey);
|
||||
return true;
|
||||
}
|
||||
|
||||
// No other attributes are supported.
|
||||
return false;
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ class OriginAttributes : public dom::OriginAttributesDictionary {
|
||||
STRIP_FIRST_PARTY_DOMAIN = 0x01,
|
||||
STRIP_USER_CONTEXT_ID = 0x02,
|
||||
STRIP_PRIVATE_BROWSING_ID = 0x04,
|
||||
STRIP_PARITION_KEY = 0x08,
|
||||
};
|
||||
|
||||
inline void StripAttributes(uint32_t aFlags) {
|
||||
@ -51,6 +52,10 @@ class OriginAttributes : public dom::OriginAttributesDictionary {
|
||||
mPrivateBrowsingId =
|
||||
nsIScriptSecurityManager::DEFAULT_PRIVATE_BROWSING_ID;
|
||||
}
|
||||
|
||||
if (aFlags & STRIP_PARITION_KEY) {
|
||||
mPartitionKey.Truncate();
|
||||
}
|
||||
}
|
||||
|
||||
bool operator==(const OriginAttributes& aOther) const {
|
||||
@ -58,7 +63,8 @@ class OriginAttributes : public dom::OriginAttributesDictionary {
|
||||
mUserContextId == aOther.mUserContextId &&
|
||||
mPrivateBrowsingId == aOther.mPrivateBrowsingId &&
|
||||
mFirstPartyDomain == aOther.mFirstPartyDomain &&
|
||||
mGeckoViewSessionContextId == aOther.mGeckoViewSessionContextId;
|
||||
mGeckoViewSessionContextId == aOther.mGeckoViewSessionContextId &&
|
||||
mPartitionKey == aOther.mPartitionKey;
|
||||
}
|
||||
|
||||
bool operator!=(const OriginAttributes& aOther) const {
|
||||
@ -167,6 +173,11 @@ class OriginAttributesPattern : public dom::OriginAttributesPatternDictionary {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mPartitionKey.WasPassed() &&
|
||||
mPartitionKey.Value() != aAttrs.mPartitionKey) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -200,6 +211,11 @@ class OriginAttributesPattern : public dom::OriginAttributesPatternDictionary {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mPartitionKey.WasPassed() && aOther.mPartitionKey.WasPassed() &&
|
||||
mPartitionKey.Value() != aOther.mPartitionKey.Value()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
@ -630,6 +630,7 @@ dictionary OriginAttributesDictionary {
|
||||
unsigned long privateBrowsingId = 0;
|
||||
DOMString firstPartyDomain = "";
|
||||
DOMString geckoViewSessionContextId = "";
|
||||
DOMString partitionKey = "";
|
||||
};
|
||||
|
||||
[GenerateInitFromJSON, GenerateToJSON]
|
||||
@ -639,6 +640,7 @@ dictionary OriginAttributesPatternDictionary {
|
||||
unsigned long privateBrowsingId;
|
||||
DOMString firstPartyDomain;
|
||||
DOMString geckoViewSessionContextId;
|
||||
DOMString partitionKey;
|
||||
};
|
||||
|
||||
dictionary CompileScriptOptionsDictionary {
|
||||
|
Loading…
Reference in New Issue
Block a user