From 7a2b46fa2dc12d1865f073d40a4974f9fe447e60 Mon Sep 17 00:00:00 2001 From: Kendall Werts Date: Fri, 14 Feb 2020 17:37:02 -0600 Subject: [PATCH] ReOpenIn Picker Panel functional --- src/js/pageAction.js | 1 - src/js/popup.js | 25 ++++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) 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 93dc9e0..f00459b 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -910,26 +910,29 @@ Logic.registerPanel(P_CONTAINERS_EDIT, { }; 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();