From d456b988733cfce0e90bdc5889e0911444a92350 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 3 Mar 2026 08:13:56 +0000 Subject: [PATCH] Fix command handler to look up cookieStoreId per command type Address bakulf's review: each command (open_container/reopen_in_container) now looks up its own cookieStoreId from identityState.keyboardShortcut instead of sharing the open_container key's value. Also use shorthand property in reopenInContainer and fix indentation/semicolon. https://claude.ai/code/session_01KZXcX3hBia3UyqEuJttWJR --- src/js/background/backgroundLogic.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/js/background/backgroundLogic.js b/src/js/background/backgroundLogic.js index 29e7825..34c7696 100644 --- a/src/js/background/backgroundLogic.js +++ b/src/js/background/backgroundLogic.js @@ -26,19 +26,19 @@ const backgroundLogic = { for (let i=0; i < backgroundLogic.NUMBER_OF_KEYBOARD_SHORTCUTS; i++) { const key = MAC_CONSTANTS.OPEN_CONTAINER_PREFIX + i; const reopenKey = MAC_CONSTANTS.REOPEN_IN_CONTAINER_PREFIX + i; - const cookieStoreId = identityState.keyboardShortcut[key]; - - if (cookieStoreId === "none") { - continue; - } - if (command === key) { - browser.tabs.create({cookieStoreId}); + const cookieStoreId = identityState.keyboardShortcut[key]; + if (cookieStoreId && cookieStoreId !== "none") { + browser.tabs.create({cookieStoreId}); + } return; } if (command === reopenKey) { - backgroundLogic.reopenInContainer(cookieStoreId); + const cookieStoreId = identityState.keyboardShortcut[reopenKey]; + if (cookieStoreId && cookieStoreId !== "none") { + backgroundLogic.reopenInContainer(cookieStoreId); + } return; } } @@ -83,14 +83,14 @@ const backgroundLogic = { }, async reopenInContainer(cookieStoreId) { - const currentTab = await browser.tabs.query({ active: true, currentWindow: true }) + const currentTab = await browser.tabs.query({ active: true, currentWindow: true }); if (currentTab.length > 0) { const tab = currentTab[0]; browser.tabs.create({ url: tab.url, - cookieStoreId: cookieStoreId, + cookieStoreId, index: tab.index + 1, active: tab.active });