Bug 1915355 - Part 4: Implement the third-party cookie blocking excpetion in CookieService. r=cookie-reviewers,baku,valentin
The patch integrates the third-party cookie blocking excpetion in CookieService. Differential Revision: https://phabricator.services.mozilla.com/D223383
This commit is contained in:
@@ -61,7 +61,7 @@ static void PopulateTopLevelInfoFromURI(const bool aIsTopLevelDocument,
|
||||
bool aForeignByAncestorContext,
|
||||
bool aIsFirstPartyEnabled, bool aForced,
|
||||
bool aUseSite,
|
||||
nsString OriginAttributes::*aTarget,
|
||||
nsString OriginAttributes::* aTarget,
|
||||
OriginAttributes& aOriginAttributes) {
|
||||
nsresult rv;
|
||||
|
||||
@@ -514,4 +514,23 @@ bool OriginAttributes::ParsePartitionKey(const nsAString& aPartitionKey,
|
||||
return fieldIndex > 1;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool OriginAttributes::ExtractSiteFromPartitionKey(
|
||||
const nsAString& aPartitionKey, nsAString& aOutSite) {
|
||||
nsAutoString scheme, host;
|
||||
int32_t port;
|
||||
bool unused;
|
||||
if (!ParsePartitionKey(aPartitionKey, scheme, host, port, unused)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (port == -1) {
|
||||
aOutSite.Assign(scheme + u"://"_ns + host);
|
||||
} else {
|
||||
aOutSite.Assign(scheme + u"://"_ns + host + u":"_ns);
|
||||
aOutSite.AppendInt(port);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
@@ -141,6 +141,11 @@ class OriginAttributes : public dom::OriginAttributesDictionary {
|
||||
nsAString& outScheme, nsAString& outBaseDomain,
|
||||
int32_t& outPort,
|
||||
bool& outForeignByAncestorContext);
|
||||
|
||||
// Parse a partitionKey and extract the site from it. Returns false if the
|
||||
// partitionKey cannot be parsed because the format is invalid.
|
||||
static bool ExtractSiteFromPartitionKey(const nsAString& aPartitionKey,
|
||||
nsAString& aOutSite);
|
||||
};
|
||||
|
||||
class OriginAttributesPattern : public dom::OriginAttributesPatternDictionary {
|
||||
|
||||
Reference in New Issue
Block a user