diff --git a/src/bidiMapper/modules/network/NetworkUtils.ts b/src/bidiMapper/modules/network/NetworkUtils.ts index 05ec5207dd..22414bdf27 100644 --- a/src/bidiMapper/modules/network/NetworkUtils.ts +++ b/src/bidiMapper/modules/network/NetworkUtils.ts @@ -227,7 +227,9 @@ export function bidiToCdpCookie( httpOnly: params.cookie.httpOnly ?? false, ...(partitionKey.sourceOrigin !== undefined && { partitionKey: { - hasCrossSiteAncestor: false, + hasCrossSiteAncestor: Boolean( + partitionKey['goog:hasCrossSiteAncestor'] + ), // CDP's `partitionKey.topLevelSite` is the BiDi's `partition.sourceOrigin`. topLevelSite: partitionKey.sourceOrigin, }, diff --git a/src/bidiMapper/modules/storage/StorageProcessor.ts b/src/bidiMapper/modules/storage/StorageProcessor.ts index f3a57a8907..926e03687a 100644 --- a/src/bidiMapper/modules/storage/StorageProcessor.ts +++ b/src/bidiMapper/modules/storage/StorageProcessor.ts @@ -77,7 +77,9 @@ export class StorageProcessor { // are returned. (c) => partitionKey.sourceOrigin === undefined || - c.partitionKey?.topLevelSite === partitionKey.sourceOrigin + (c.partitionKey?.topLevelSite === partitionKey.sourceOrigin && + c.partitionKey?.hasCrossSiteAncestor === + partitionKey['goog:hasCrossSiteAncestor']) ) .filter((cdpCookie) => { const bidiCookie = cdpToBiDiCookie(cdpCookie); @@ -212,7 +214,12 @@ export class StorageProcessor { if ( key !== undefined && value !== undefined && - !['type', 'sourceOrigin', 'userContext'].includes(key) + ![ + 'type', + 'sourceOrigin', + 'userContext', + 'goog:hasCrossSiteAncestor', + ].includes(key) ) { unsupportedPartitionKeys.set(key, value); } @@ -229,10 +236,13 @@ export class StorageProcessor { // Set `userContext` to `default` if not provided, as it's required in Chromium. const userContext = descriptor.userContext ?? 'default'; + const hasCrossSiteAncestor = + descriptor['goog:hasCrossSiteAncestor'] ?? false; return { userContext, ...(sourceOrigin === undefined ? {} : {sourceOrigin}), + ...(sourceOrigin === undefined ? {} : {'goog:hasCrossSiteAncestor': hasCrossSiteAncestor}), }; }