summaryrefslogtreecommitdiffstats
path: root/caps/OriginAttributes.h
diff options
context:
space:
mode:
Diffstat (limited to 'caps/OriginAttributes.h')
-rw-r--r--caps/OriginAttributes.h29
1 files changed, 20 insertions, 9 deletions
diff --git a/caps/OriginAttributes.h b/caps/OriginAttributes.h
index faf9d80050..52f7afa942 100644
--- a/caps/OriginAttributes.h
+++ b/caps/OriginAttributes.h
@@ -27,9 +27,9 @@ class OriginAttributes : public dom::OriginAttributesDictionary {
void SetFirstPartyDomain(const bool aIsTopLevelDocument,
const nsAString& aDomain, bool aForced = false);
- void SetPartitionKey(nsIURI* aURI);
- void SetPartitionKey(const nsACString& aDomain);
- void SetPartitionKey(const nsAString& aDomain);
+ void SetPartitionKey(nsIURI* aURI, bool aForeignByAncestorContext);
+ void SetPartitionKey(const nsACString& aOther);
+ void SetPartitionKey(const nsAString& aOther);
enum {
STRIP_FIRST_PARTY_DOMAIN = 0x01,
@@ -129,13 +129,13 @@ class OriginAttributes : public dom::OriginAttributesDictionary {
// different than 0.
static bool IsPrivateBrowsing(const nsACString& aOrigin);
- // Parse a partitionKey of the format "(<scheme>,<baseDomain>,[port])" into
- // its components.
- // Returns false if the partitionKey cannot be parsed because the format is
- // invalid.
+ // Parse a partitionKey of the format
+ // "(<scheme>,<baseDomain>,[port],[ancestorbit])" into its components. Returns
+ // false if the partitionKey cannot be parsed because the format is invalid.
static bool ParsePartitionKey(const nsAString& aPartitionKey,
nsAString& outScheme, nsAString& outBaseDomain,
- int32_t& outPort);
+ int32_t& outPort,
+ bool& outForeignByAncestorContext);
};
class OriginAttributesPattern : public dom::OriginAttributesPatternDictionary {
@@ -193,8 +193,9 @@ class OriginAttributesPattern : public dom::OriginAttributesPatternDictionary {
nsString scheme;
nsString baseDomain;
int32_t port;
+ bool ancestor;
bool success = OriginAttributes::ParsePartitionKey(
- aAttrs.mPartitionKey, scheme, baseDomain, port);
+ aAttrs.mPartitionKey, scheme, baseDomain, port, ancestor);
if (!success) {
return false;
}
@@ -210,6 +211,10 @@ class OriginAttributesPattern : public dom::OriginAttributesPatternDictionary {
if (pkPattern.mPort.WasPassed() && pkPattern.mPort.Value() != port) {
return false;
}
+ if (pkPattern.mForeignByAncestorContext.WasPassed() &&
+ pkPattern.mForeignByAncestorContext.Value() != ancestor) {
+ return false;
+ }
}
}
@@ -262,6 +267,12 @@ class OriginAttributesPattern : public dom::OriginAttributesPatternDictionary {
self.mPort.Value() != other.mPort.Value()) {
return false;
}
+ if (self.mForeignByAncestorContext.WasPassed() &&
+ other.mForeignByAncestorContext.WasPassed() &&
+ self.mForeignByAncestorContext.Value() !=
+ other.mForeignByAncestorContext.Value()) {
+ return false;
+ }
}
return true;