From f219d7107085cdf5330a0b9df41c2e966938ef3c Mon Sep 17 00:00:00 2001 From: Cesar Gonzalez Date: Wed, 19 Jun 2024 02:59:09 -0500 Subject: [PATCH] [PM-5189] Working through content script port improvement --- .../background/abstractions/overlay.background.ts | 8 ++++---- .../browser/src/autofill/background/overlay.background.ts | 4 ++-- .../autofill/services/autofill-overlay-content.service.ts | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/browser/src/autofill/background/abstractions/overlay.background.ts b/apps/browser/src/autofill/background/abstractions/overlay.background.ts index 3313d3405ca..5b0ed0cd4c0 100644 --- a/apps/browser/src/autofill/background/abstractions/overlay.background.ts +++ b/apps/browser/src/autofill/background/abstractions/overlay.background.ts @@ -99,10 +99,6 @@ export type OverlayBackgroundExtensionMessageHandlers = { checkIsFieldCurrentlyFilling: () => boolean; getAutofillInlineMenuVisibility: () => void; - updateAutofillInlineMenuPosition: ({ - message, - sender, - }: BackgroundOnMessageHandlerParams) => Promise; toggleAutofillInlineMenuHidden: ({ message, sender }: BackgroundOnMessageHandlerParams) => void; checkIsAutofillInlineMenuButtonVisible: ({ sender }: BackgroundSenderParam) => void; checkIsAutofillInlineMenuListVisible: ({ sender }: BackgroundSenderParam) => void; @@ -144,6 +140,10 @@ export type OverlayContentScriptPortMessageHandlers = { closeAutofillInlineMenu: ({ message, port }: PortOnMessageHandlerParams) => void; checkAutofillInlineMenuFocused: () => void; focusAutofillInlineMenuList: () => void; + updateAutofillInlineMenuPosition: ({ + message, + port, + }: PortOnMessageHandlerParams) => Promise; }; export type InlineMenuButtonPortMessageHandlers = { diff --git a/apps/browser/src/autofill/background/overlay.background.ts b/apps/browser/src/autofill/background/overlay.background.ts index 9d948dd26f9..3989fd66b56 100644 --- a/apps/browser/src/autofill/background/overlay.background.ts +++ b/apps/browser/src/autofill/background/overlay.background.ts @@ -82,8 +82,6 @@ export class OverlayBackground implements OverlayBackgroundInterface { checkIsFieldCurrentlyFilling: () => this.checkIsFieldCurrentlyFilling(), getAutofillInlineMenuVisibility: () => this.getInlineMenuVisibility(), - updateAutofillInlineMenuPosition: ({ message, sender }) => - this.updateInlineMenuPosition(message, sender), toggleAutofillInlineMenuHidden: ({ message, sender }) => this.toggleInlineMenuHidden(message, sender), checkIsAutofillInlineMenuButtonVisible: ({ sender }) => @@ -111,6 +109,8 @@ export class OverlayBackground implements OverlayBackgroundInterface { closeAutofillInlineMenu: ({ message, port }) => this.closeInlineMenu(port.sender, message), checkAutofillInlineMenuFocused: () => this.checkInlineMenuFocused(), focusAutofillInlineMenuList: () => this.focusInlineMenuList(), + updateAutofillInlineMenuPosition: ({ message, port }) => + this.updateInlineMenuPosition(message, port.sender), }; private readonly inlineMenuButtonPortMessageHandlers: InlineMenuButtonPortMessageHandlers = { closeAutofillInlineMenu: ({ message, port }) => this.closeInlineMenu(port.sender, message), diff --git a/apps/browser/src/autofill/services/autofill-overlay-content.service.ts b/apps/browser/src/autofill/services/autofill-overlay-content.service.ts index 07d03b23418..336fea4c2c9 100644 --- a/apps/browser/src/autofill/services/autofill-overlay-content.service.ts +++ b/apps/browser/src/autofill/services/autofill-overlay-content.service.ts @@ -562,7 +562,7 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ * Updates the position of the inline menu button. */ private updateInlineMenuButtonPosition() { - void this.sendExtensionMessage("updateAutofillInlineMenuPosition", { + this.sendPortMessage("updateAutofillInlineMenuPosition", { overlayElement: AutofillOverlayElement.Button, }); } @@ -571,7 +571,7 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ * Updates the position of the inline menu list. */ private updateInlineMenuListPosition() { - void this.sendExtensionMessage("updateAutofillInlineMenuPosition", { + this.sendPortMessage("updateAutofillInlineMenuPosition", { overlayElement: AutofillOverlayElement.List, }); }