From 9c0bfd28db142c64df09b346812b413ff87fc9c6 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Fri, 15 Oct 2021 15:20:00 +0200 Subject: [PATCH] Close login tab before executing existing unlock flow --- src/background/runtime.background.ts | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/background/runtime.background.ts b/src/background/runtime.background.ts index a68c61cf660..44919c9c74a 100644 --- a/src/background/runtime.background.ts +++ b/src/background/runtime.background.ts @@ -54,21 +54,19 @@ export default class RuntimeBackground { switch (msg.command) { case 'loggedIn': case 'unlocked': + if (this.lockedVaultPendingNotifications.length > 0) { + await BrowserApi.closeLoginTab(); + + if (item?.sender?.tab?.id) { + await BrowserApi.focusSpecifiedTab(item.sender.tab.id); + } + await this.processMessage(item.msg, item.sender, null); + } + await this.main.setIcon(); await this.main.refreshBadgeAndMenu(false); this.notificationsService.updateConnection(msg.command === 'unlocked'); this.systemService.cancelProcessReload(); - - if (this.lockedVaultPendingNotifications.length > 0) { - const retryItem = this.lockedVaultPendingNotifications.pop(); - await this.processMessage(retryItem.msg, retryItem.sender, null); - - await BrowserApi.closeLoginTab(); - - if (retryItem?.sender?.tab?.id) { - await BrowserApi.focusSpecifiedTab(retryItem.sender.tab.id); - } - } break; case 'addToLockedVaultPendingNotifications': const retryMessage = {