diff --git a/src/js/background/assignManager.js b/src/js/background/assignManager.js index 3cba6fc..d7e1ab2 100644 --- a/src/js/background/assignManager.js +++ b/src/js/background/assignManager.js @@ -808,9 +808,8 @@ window.assignManager = { return this.createTabWrapper(url, cookieStoreId, index, active, openerTabId, groupId); } 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 this.createTabWrapper( diff --git a/src/js/background/backgroundLogic.js b/src/js/background/backgroundLogic.js index d21cf33..ec91a60 100644 --- a/src/js/background/backgroundLogic.js +++ b/src/js/background/backgroundLogic.js @@ -121,6 +121,9 @@ const backgroundLogic = { if (!cookieStoreId) { return false; } + if (cookieStoreId === "firefox-default") { + return "0"; + } const container = cookieStoreId.replace("firefox-container-", ""); if (container !== cookieStoreId) { return container; @@ -481,7 +484,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 990f3ff..1df0e26 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