Bug 1322856 - Expose ContextualIdentities (aka containers) to WebExtensions - part 1, r=kmaglione

This commit is contained in:
Andrea Marchesini
2016-12-16 22:01:24 +01:00
parent dec891d2ad
commit 40b3b9a35c
10 changed files with 378 additions and 2 deletions

View File

@@ -22,7 +22,7 @@ global.getCookieStoreIdForTab = function(data, tab) {
}
if (tab.userContextId) {
return CONTAINER_STORE + tab.userContextId;
return getCookieStoreIdForContainer(tab.userContextId);
}
return DEFAULT_STORE;
@@ -40,6 +40,10 @@ global.isContainerCookieStoreId = function(storeId) {
return storeId !== null && storeId.startsWith(CONTAINER_STORE);
};
global.getCookieStoreIdForContainer = function(containerId) {
return CONTAINER_STORE + containerId;
};
global.getContainerForCookieStoreId = function(storeId) {
if (!global.isContainerCookieStoreId(storeId)) {
return null;
@@ -76,7 +80,7 @@ function convert({cookie, isPrivate}) {
}
if (cookie.originAttributes.userContextId) {
result.storeId = CONTAINER_STORE + cookie.originAttributes.userContextId;
result.storeId = getCookieStoreIdForContainer(cookie.originAttributes.userContextId);
} else if (cookie.originAttributes.privateBrowsingId || isPrivate) {
result.storeId = PRIVATE_STORE;
} else {