mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 08:43:33 +00:00
[EC-598] fix: race condition when opening new popout
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user