address feedback 02

This commit is contained in:
Anton Dudakov
2026-02-26 22:01:54 +04:00
parent eda79aaf05
commit 2f6596259b
+18 -19
View File
@@ -12,35 +12,33 @@ const backgroundLogic = {
"about:home",
"about:blank"
]),
// Use shared constants for counts
// NOTE: Keep in sync with MAC_CONSTANTS.NUMBER_OF_KEYBOARD_SHORTCUTS
NUMBER_OF_KEYBOARD_SHORTCUTS: MAC_CONSTANTS.NUMBER_OF_KEYBOARD_SHORTCUTS,
unhideQueue: [],
init() {
browser.commands.onCommand.addListener(async function (command) {
if (command === "sort_tabs") {
backgroundLogic.sortTabs();
} else if (command.startsWith(MAC_CONSTANTS.OPEN_CONTAINER_PREFIX)) {
for (let i = 0; i < MAC_CONSTANTS.NUMBER_OF_KEYBOARD_SHORTCUTS; i++) {
return;
}
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) {
if (cookieStoreId !== "none") {
browser.tabs.create({cookieStoreId});
return;
}
break;
}
}
} else if (command.startsWith(MAC_CONSTANTS.REOPEN_IN_CONTAINER_PREFIX)) {
for (let i = 0; i < MAC_CONSTANTS.NUMBER_OF_KEYBOARD_SHORTCUTS; i++) {
const key = MAC_CONSTANTS.REOPEN_IN_CONTAINER_PREFIX + i;
const cookieStoreId = identityState.keyboardShortcut[key];
if (command === key) {
if (cookieStoreId !== "none") {
if (command === reopenKey) {
backgroundLogic.reopenInContainer(cookieStoreId);
}
break;
}
return;
}
}
});
@@ -84,7 +82,7 @@ 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];
@@ -327,7 +325,8 @@ const backgroundLogic = {
});
} else {
// As we get a blank tab here we will need to await the tabs creation
newWindowObj = await browser.windows.create({});
newWindowObj = await browser.windows.create({
});
hiddenDefaultTabToClose = true;
}