Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc-browser.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSami Vänttinen <sami.vanttinen@protonmail.com>2022-06-20 07:09:53 +0300
committerGitHub <noreply@github.com>2022-06-20 07:09:53 +0300
commit32ee5105650ed3917b3d03f25c9a7fc333132b71 (patch)
tree3331eb1648bc25dd5d90b5440c86eb7fb67256d5
parent8beab0e7e8f1b9b8895bc83a9e4e08ee3728c5f1 (diff)
parent41b0a136a8c1887b4a2fdb40f89aea1cc3c7bfeb (diff)
Merge pull request #1643 from libklein/bugfix/set-current-page-id-after-closing-tab
Set currentTabId in remove tab.
-rw-r--r--keepassxc-browser/background/init.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/keepassxc-browser/background/init.js b/keepassxc-browser/background/init.js
index 09fe962..6d84218 100644
--- a/keepassxc-browser/background/init.js
+++ b/keepassxc-browser/background/init.js
@@ -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];
});
/**