diff --git a/src/js/pageAction.js b/src/js/pageAction.js index 9242f24..74f670e 100644 --- a/src/js/pageAction.js +++ b/src/js/pageAction.js @@ -30,7 +30,6 @@ async function init() { assignedUserContextId, false ); - console.log(currentTab); Utils.reloadInContainer( currentTab.url, false, diff --git a/src/js/popup.js b/src/js/popup.js index cfc4a61..246292c 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -854,26 +854,29 @@ Logic.registerPanel(P_CONTAINER_PICKER, { }; break; case REOPEN_IN_CONTAINER: - pickedFunction = function (identity) { - try { - browser.tabs.create({ - cookieStoreId: identity.cookieStoreId - }); - window.close(); - } catch (e) { - window.close(); - } + pickedFunction = async function (identity) { + const currentTab = await Utils.currentTab(); + const newUserContextId = Utils.userContextId(identity.cookieStoreId); + console.log(currentTab); + Utils.reloadInContainer( + currentTab.url, + false, + newUserContextId, + currentTab.index + 1, + currentTab.active + ); + window.close(); }; break; case ALWAYS_OPEN_IN_PICKER: default: pickedFunction = async function (identity) { - const userContextId = Utils.userContextId(identity.cookieStoreId); const currentTab = await Utils.currentTab(); + const assignedUserContextId = Utils.userContextId(identity.cookieStoreId); Utils.setOrRemoveAssignment( currentTab.id, currentTab.url, - userContextId, + assignedUserContextId, false ); window.close();