fix can't open in default container if url assigned to a container

associate userContextId=0 with CookieStoreId="firefox-default"
This commit is contained in:
garywill 2021-03-14 19:01:37 +08:00
parent 4b56a2f0bb
commit ab5d67eacb
2 changed files with 6 additions and 4 deletions

View file

@ -705,9 +705,8 @@ window.assignManager = {
return browser.tabs.create({url, cookieStoreId, index, active, openerTabId});
} else {
let confirmUrl = `${loadPage}?url=${this.encodeURLProperty(url)}&cookieStoreId=${cookieStoreId}`;
let currentCookieStoreId;
if (currentUserContextId) {
currentCookieStoreId = backgroundLogic.cookieStoreId(currentUserContextId);
const currentCookieStoreId = backgroundLogic.cookieStoreId(currentUserContextId);
if (parseInt(currentUserContextId, 10) > 0) {
confirmUrl += `&currentCookieStoreId=${currentCookieStoreId}`;
}
return browser.tabs.create({

View file

@ -32,6 +32,9 @@ const backgroundLogic = {
if (!cookieStoreId) {
return false;
}
if (cookieStoreId === "firefox-default") {
return "0";
}
const container = cookieStoreId.replace("firefox-container-", "");
if (container !== cookieStoreId) {
return container;
@ -357,7 +360,7 @@ const backgroundLogic = {
},
cookieStoreId(userContextId) {
if(userContextId === 0) return "firefox-default";
if (parseInt(userContextId, 10) === 0) return "firefox-default";
return `firefox-container-${userContextId}`;
}
};