From 6ec6310bb47c97c0a20393f73c56170638135411 Mon Sep 17 00:00:00 2001 From: Cesar Gonzalez Date: Tue, 11 Jun 2024 09:33:28 -0500 Subject: [PATCH] [PM-5189] Refactoring implementation --- .../content/autofill-inline-menu-content.service.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/browser/src/autofill/overlay/inline-menu/content/autofill-inline-menu-content.service.ts b/apps/browser/src/autofill/overlay/inline-menu/content/autofill-inline-menu-content.service.ts index 5106d5ee003..2fe6d812a1d 100644 --- a/apps/browser/src/autofill/overlay/inline-menu/content/autofill-inline-menu-content.service.ts +++ b/apps/browser/src/autofill/overlay/inline-menu/content/autofill-inline-menu-content.service.ts @@ -37,8 +37,7 @@ export class AutofillInlineMenuContentService implements AutofillInlineMenuConte private readonly _extensionMessageHandlers: InlineMenuExtensionMessageHandlers = { closeAutofillInlineMenu: ({ message }) => this.removeInlineMenu(message), appendAutofillInlineMenuToDom: ({ message }) => this.appendInlineMenuElements(message), - toggleAutofillInlineMenuHidden: ({ message }) => - this.toggleInlineMenuHidden(message.isInlineMenuHidden), + toggleAutofillInlineMenuHidden: ({ message }) => this.toggleInlineMenuHidden(message), checkIsAutofillInlineMenuButtonVisible: () => this.isInlineMenuButtonVisible(), checkIsAutofillInlineMenuListVisible: () => this.isInlineMenuListVisible(), }; @@ -66,11 +65,12 @@ export class AutofillInlineMenuContentService implements AutofillInlineMenuConte /** * Sends a message that facilitates hiding the inline menu elements. * - * @param isHidden - Indicates if the inline menu elements should be hidden. + * @param message - The message that contains the visibility state of the inline menu elements. */ - private toggleInlineMenuHidden(isHidden: boolean) { - this.isButtonVisible = !!this.buttonElement && !isHidden; - this.isListVisible = !!this.listElement && !isHidden; + private toggleInlineMenuHidden(message: AutofillExtensionMessage) { + const { isInlineMenuHidden } = message; + this.isButtonVisible = !!this.buttonElement && !isInlineMenuHidden; + this.isListVisible = !!this.listElement && !isInlineMenuHidden; } /** @@ -419,6 +419,7 @@ export class AutofillInlineMenuContentService implements AutofillInlineMenuConte return false; } + destroy() { this.documentElementMutationObserver?.disconnect(); this.removeInlineMenu();