Skip to content

Commit

Permalink
fix can't open in default container if url assigned to a container
Browse files Browse the repository at this point in the history
associate userContextId=0 with CookieStoreId="firefox-default"
  • Loading branch information
garywill committed Mar 14, 2021
1 parent 4b56a2f commit ab5d67e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/js/background/assignManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
5 changes: 4 additions & 1 deletion src/js/background/backgroundLogic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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}`;
}
};
Expand Down

0 comments on commit ab5d67e

Please sign in to comment.