1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-26 17:08:33 +01:00

[PM-3588] Close duplicate single-action windows (#6091)

* close duplicate single-action windows

* Use longform conditional

Co-authored-by: Cesar Gonzalez <cesar.a.gonzalezcs@gmail.com>

---------

Co-authored-by: Cesar Gonzalez <cesar.a.gonzalezcs@gmail.com>
This commit is contained in:
Jonathan Prusik 2023-08-30 15:08:41 -04:00 committed by GitHub
parent 3340af8084
commit f61793b10b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,7 +12,6 @@ class BrowserPopoutWindowService implements BrowserPopupWindowServiceInterface {
};
async openUnlockPrompt(senderWindowId: number) {
await this.closeUnlockPrompt();
await this.openSingleActionPopout(
senderWindowId,
"popup/index.html?uilocation=popout",
@ -36,8 +35,6 @@ class BrowserPopoutWindowService implements BrowserPopupWindowServiceInterface {
action: string;
}
) {
await this.closePasswordRepromptPrompt();
const promptWindowPath =
"popup/index.html#/view-cipher" +
"?uilocation=popout" +
@ -73,18 +70,16 @@ class BrowserPopoutWindowService implements BrowserPopupWindowServiceInterface {
const popupWindow = await BrowserApi.createWindow(windowOptions);
if (!singleActionPopoutKey) {
return;
}
await this.closeSingleActionPopout(singleActionPopoutKey);
this.singleActionPopoutTabIds[singleActionPopoutKey] = popupWindow?.tabs[0].id;
}
private async closeSingleActionPopout(popoutKey: string) {
const tabId = this.singleActionPopoutTabIds[popoutKey];
if (!tabId) {
return;
if (tabId) {
await BrowserApi.removeTab(tabId);
}
await BrowserApi.removeTab(tabId);
this.singleActionPopoutTabIds[popoutKey] = null;
}
}