[PM-12316] Fixing an edge case issue where updating the overlay ciphers can trigger an update of the passkey auth view before the page is refreshed

This commit is contained in:
Cesar Gonzalez 2024-09-24 09:48:59 -05:00
parent 8af49cc28b
commit 406ccbf7c3
No known key found for this signature in database
GPG Key ID: 3381A5457F8CCECF
1 changed files with 11 additions and 0 deletions

View File

@ -41,6 +41,7 @@ export class AutofillInlineMenuList extends AutofillInlineMenuPageElement {
private passkeysHeadingHeight: number; private passkeysHeadingHeight: number;
private lastPasskeysListItemHeight: number; private lastPasskeysListItemHeight: number;
private ciphersListHeight: number; private ciphersListHeight: number;
private isPasskeyAuthInProgress = false;
private readonly showCiphersPerPage = 6; private readonly showCiphersPerPage = 6;
private readonly headingBorderClass = "inline-menu-list-heading--bordered"; private readonly headingBorderClass = "inline-menu-list-heading--bordered";
private readonly inlineMenuListWindowMessageHandlers: AutofillInlineMenuListWindowMessageHandlers = private readonly inlineMenuListWindowMessageHandlers: AutofillInlineMenuListWindowMessageHandlers =
@ -157,6 +158,10 @@ export class AutofillInlineMenuList extends AutofillInlineMenuPageElement {
ciphers: InlineMenuCipherData[], ciphers: InlineMenuCipherData[],
showInlineMenuAccountCreation?: boolean, showInlineMenuAccountCreation?: boolean,
) { ) {
if (this.isPasskeyAuthInProgress) {
return;
}
this.ciphers = ciphers; this.ciphers = ciphers;
this.currentCipherIndex = 0; this.currentCipherIndex = 0;
this.showInlineMenuAccountCreation = showInlineMenuAccountCreation; this.showInlineMenuAccountCreation = showInlineMenuAccountCreation;
@ -929,6 +934,7 @@ export class AutofillInlineMenuList extends AutofillInlineMenuPageElement {
* Creates an indicator for the user that the passkey is being authenticated. * Creates an indicator for the user that the passkey is being authenticated.
*/ */
private createPasskeyAuthenticatingLoader() { private createPasskeyAuthenticatingLoader() {
this.isPasskeyAuthInProgress = true;
this.resetInlineMenuContainer(); this.resetInlineMenuContainer();
const passkeyAuthenticatingLoader = globalThis.document.createElement("div"); const passkeyAuthenticatingLoader = globalThis.document.createElement("div");
@ -937,6 +943,11 @@ export class AutofillInlineMenuList extends AutofillInlineMenuPageElement {
passkeyAuthenticatingLoader.appendChild(buildSvgDomElement(spinnerIcon)); passkeyAuthenticatingLoader.appendChild(buildSvgDomElement(spinnerIcon));
this.inlineMenuListContainer.appendChild(passkeyAuthenticatingLoader); this.inlineMenuListContainer.appendChild(passkeyAuthenticatingLoader);
globalThis.setTimeout(() => {
this.isPasskeyAuthInProgress = false;
this.postMessageToParent({ command: "checkAutofillInlineMenuButtonFocused" });
}, 4000);
} }
/** /**