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:
parent
4eb68ccc8c
commit
1e5e8e7dd5
@ -311,11 +311,15 @@ export class BrowserFido2UserInterfaceSession implements Fido2UserInterfaceSessi
|
|||||||
}
|
}
|
||||||
|
|
||||||
const queryParams = new URLSearchParams({ sessionId: this.sessionId }).toString();
|
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(
|
this.popout = await this.popupUtilsService.popOut(
|
||||||
null,
|
null,
|
||||||
`popup/index.html?uilocation=popout#/fido2?${queryParams}`,
|
`popup/index.html?uilocation=popout#/fido2?${queryParams}`,
|
||||||
{ center: true }
|
{ center: true }
|
||||||
);
|
);
|
||||||
await firstValueFrom(this.connected$.pipe(filter((connected) => connected === true)));
|
await connectPromise;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user