Skip to content

Commit b630fd8

Browse files
authored
Fix command handler to look up cookieStoreId per command type
Fix command handler to look up cookieStoreId per command type
2 parents 1f0c522 + d456b98 commit b630fd8

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

src/js/background/backgroundLogic.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ const backgroundLogic = {
2626
for (let i=0; i < backgroundLogic.NUMBER_OF_KEYBOARD_SHORTCUTS; i++) {
2727
const key = MAC_CONSTANTS.OPEN_CONTAINER_PREFIX + i;
2828
const reopenKey = MAC_CONSTANTS.REOPEN_IN_CONTAINER_PREFIX + i;
29-
const cookieStoreId = identityState.keyboardShortcut[key];
30-
31-
if (cookieStoreId === "none") {
32-
continue;
33-
}
34-
3529
if (command === key) {
36-
browser.tabs.create({cookieStoreId});
30+
const cookieStoreId = identityState.keyboardShortcut[key];
31+
if (cookieStoreId && cookieStoreId !== "none") {
32+
browser.tabs.create({cookieStoreId});
33+
}
3734
return;
3835
}
3936

4037
if (command === reopenKey) {
41-
backgroundLogic.reopenInContainer(cookieStoreId);
38+
const cookieStoreId = identityState.keyboardShortcut[reopenKey];
39+
if (cookieStoreId && cookieStoreId !== "none") {
40+
backgroundLogic.reopenInContainer(cookieStoreId);
41+
}
4242
return;
4343
}
4444
}
@@ -83,14 +83,14 @@ const backgroundLogic = {
8383
},
8484

8585
async reopenInContainer(cookieStoreId) {
86-
const currentTab = await browser.tabs.query({ active: true, currentWindow: true })
86+
const currentTab = await browser.tabs.query({ active: true, currentWindow: true });
8787

8888
if (currentTab.length > 0) {
8989
const tab = currentTab[0];
9090

9191
browser.tabs.create({
9292
url: tab.url,
93-
cookieStoreId: cookieStoreId,
93+
cookieStoreId,
9494
index: tab.index + 1,
9595
active: tab.active
9696
});

0 commit comments

Comments
 (0)