Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Associate userContextId=0 with default container (fix can't open in default container if url assigned to a container #1312) #1599

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion test/features/assignment.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down