Close loginTab after login was done by user

This commit is contained in:
Daniel James Smith 2021-10-08 15:27:20 +02:00
parent f56a9146be
commit 89344a7c36
No known key found for this signature in database
GPG Key ID: 03E4BD365FF06726
2 changed files with 16 additions and 0 deletions

View File

@ -77,6 +77,8 @@ export default class RuntimeBackground {
if (this.lockedVaultPendingNotifications.length > 0) {
const retryItem = this.lockedVaultPendingNotifications.pop();
await this.processMessage(retryItem.msg, retryItem.sender, null);
await BrowserApi.closeLoginTab();
}
break;
case 'addToLockedVaultPendingNotifications':

View File

@ -97,6 +97,20 @@ export class BrowserApi {
});
}
static async closeLoginTab() {
const tabs = await BrowserApi.tabsQuery({
active: true,
title: 'Bitwarden',
});
if (tabs.length === 0) {
return;
}
const tabToClose = tabs[tabs.length - 1].id;
chrome.tabs.remove(tabToClose);
}
static closePopup(win: Window) {
if (BrowserApi.isWebExtensionsApi && BrowserApi.isFirefoxOnAndroid) {
// Reactivating the active tab dismisses the popup tab. The promise final