diff --git a/src/js/background/assignManager.js b/src/js/background/assignManager.js index 032adb1fe..d2aa80488 100644 --- a/src/js/background/assignManager.js +++ b/src/js/background/assignManager.js @@ -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 += `¤tCookieStoreId=${currentCookieStoreId}`; } return browser.tabs.create({ diff --git a/src/js/background/backgroundLogic.js b/src/js/background/backgroundLogic.js index 76432216d..d0ef360cf 100644 --- a/src/js/background/backgroundLogic.js +++ b/src/js/background/backgroundLogic.js @@ -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}`; } }; diff --git a/test/features/assignment.test.js b/test/features/assignment.test.js index 990f3ffe1..1df0e2696 100644 --- a/test/features/assignment.test.js +++ b/test/features/assignment.test.js @@ -73,7 +73,7 @@ describe("Assignment Comfirm Page Feature", function () { url: "moz-extension://fake/confirm-page.html?" + `url=${encodeURIComponent(url)}` + `&cookieStoreId=${this.webExt.tab.cookieStoreId}`, - cookieStoreId: undefined, + cookieStoreId: "firefox-default", openerTabId: null, index: 2, active: true