1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-20 21:01:29 +01:00

[EC-598] fix: race condition when opening new popout

This commit is contained in:
Andreas Coroiu 2023-04-28 11:37:11 +02:00
parent 4eb68ccc8c
commit 1e5e8e7dd5
No known key found for this signature in database
GPG Key ID: E70B5FFC81DFEC1A

View File

@ -311,11 +311,15 @@ export class BrowserFido2UserInterfaceSession implements Fido2UserInterfaceSessi
}
const queryParams = new URLSearchParams({ sessionId: this.sessionId }).toString();
// create promise first to avoid race condition where the popout opens before we start listening
const connectPromise = firstValueFrom(
this.connected$.pipe(filter((connected) => connected === true))
);
this.popout = await this.popupUtilsService.popOut(
null,
`popup/index.html?uilocation=popout#/fido2?${queryParams}`,
{ center: true }
);
await firstValueFrom(this.connected$.pipe(filter((connected) => connected === true)));
await connectPromise;
}
}