[PM-5189] Working through content script port improvement

This commit is contained in:
Cesar Gonzalez 2024-06-19 02:59:09 -05:00
parent f389263b64
commit f219d71070
No known key found for this signature in database
GPG Key ID: 3381A5457F8CCECF
3 changed files with 8 additions and 8 deletions

View File

@ -99,10 +99,6 @@ export type OverlayBackgroundExtensionMessageHandlers = {
checkIsFieldCurrentlyFilling: () => boolean;
getAutofillInlineMenuVisibility: () => void;
updateAutofillInlineMenuPosition: ({
message,
sender,
}: BackgroundOnMessageHandlerParams) => Promise<void>;
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<void>;
};
export type InlineMenuButtonPortMessageHandlers = {

View File

@ -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),

View File

@ -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,
});
}