mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Set currentTabId in remove tab.
This commit is contained in:
parent
8beab0e7e8
commit
41b0a136a8
1 changed files with 8 additions and 3 deletions
|
|
@ -37,11 +37,16 @@ browser.tabs.onCreated.addListener((tab) => {
|
|||
* @param {integer} tabId
|
||||
* @param {object} removeInfo
|
||||
*/
|
||||
browser.tabs.onRemoved.addListener((tabId, removeInfo) => {
|
||||
delete page.tabs[tabId];
|
||||
browser.tabs.onRemoved.addListener(async function(tabId, removeInfo) {
|
||||
if (page.currentTabId === tabId) {
|
||||
page.currentTabId = -1;
|
||||
const activeTabs = await browser.tabs.query({ active: true, currentWindow: true });
|
||||
if (activeTabs.length > 0) {
|
||||
page.currentTabId = activeTabs[0].id;
|
||||
} else {
|
||||
page.currentTabId = -1;
|
||||
}
|
||||
}
|
||||
delete page.tabs[tabId];
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue