diff --git a/packages/flutter_mozilla_components/javascript/container_proxy/src/background/BackgroundMain.ts b/packages/flutter_mozilla_components/javascript/container_proxy/src/background/BackgroundMain.ts index 9c7dc881..638f984e 100644 --- a/packages/flutter_mozilla_components/javascript/container_proxy/src/background/BackgroundMain.ts +++ b/packages/flutter_mozilla_components/javascript/container_proxy/src/background/BackgroundMain.ts @@ -92,7 +92,12 @@ export default class BackgroundMain { async onRequest(requestDetails: Pick<_OnRequestDetails, 'cookieStoreId' | 'url' | 'tabId'>): Promise { try { const tab = await this.tabForRequest(requestDetails.tabId) - const contextId = this.contextIdFromCookieStoreId(tab?.cookieStoreId ?? requestDetails.cookieStoreId) + // `||` (not `??`) so an empty-string cookieStoreId on the tab falls + // back to the request's cookieStoreId. Some extension code paths + // surface `''` for tabs without an explicit container assignment, + // which `??` would treat as a real value and stop the fallback. + const cookieStoreId = (tab?.cookieStoreId || requestDetails.cookieStoreId) + const contextId = this.contextIdFromCookieStoreId(cookieStoreId) if (contextId === null) { return doNotProxy