diff --git a/apps/browser/src/autofill/content/content-message-handler.ts b/apps/browser/src/autofill/content/content-message-handler.ts index 05e87c2da8..0cb9f45b43 100644 --- a/apps/browser/src/autofill/content/content-message-handler.ts +++ b/apps/browser/src/autofill/content/content-message-handler.ts @@ -34,9 +34,9 @@ const windowMessageHandlers: ContentMessageWindowEventHandlers = { * @param data - Data from the window message * @param referrer - The referrer of the window */ -async function handleAuthResultMessage(data: ContentMessageWindowData, referrer: string) { +function handleAuthResultMessage(data: ContentMessageWindowData, referrer: string) { const { command, lastpass, code, state } = data; - await chrome.runtime.sendMessage({ command, code, state, lastpass, referrer }); + sendExtensionRuntimeMessage({ command, code, state, lastpass, referrer }); } /** @@ -47,7 +47,7 @@ async function handleAuthResultMessage(data: ContentMessageWindowData, referrer: */ async function handleDuoResultMessage(data: ContentMessageWindowData, referrer: string) { const { command, code, state } = data; - await chrome.runtime.sendMessage({ command, code, state, referrer }); + sendExtensionRuntimeMessage({ command, code, state, referrer }); } /** @@ -56,9 +56,9 @@ async function handleDuoResultMessage(data: ContentMessageWindowData, referrer: * @param data - Data from the window message * @param referrer - The referrer of the window */ -async function handleWebAuthnResultMessage(data: ContentMessageWindowData, referrer: string) { +function handleWebAuthnResultMessage(data: ContentMessageWindowData, referrer: string) { const { command, remember } = data; - await chrome.runtime.sendMessage({ command, data: data.data, remember, referrer }); + sendExtensionRuntimeMessage({ command, data: data.data, remember, referrer }); } /** @@ -96,12 +96,23 @@ const forwardCommands = new Set([ * * @param message - The message from the extension */ -async function handleExtensionMessage(message: any) { +function handleExtensionMessage(message: any) { if (forwardCommands.has(message.command)) { - await chrome.runtime.sendMessage(message); + sendExtensionRuntimeMessage(message); } } +/** + * Sends a message to the extension runtime, and ignores + * any potential promises that should be handled using + * the `void` operator. + * + * @param message - The message to send to the extension runtime + */ +function sendExtensionRuntimeMessage(message: any) { + void chrome.runtime.sendMessage(message); +} + /** * Duplicate implementation of the same named method within `apps/browser/src/autofill/utils/index.ts`. * This is done due to some strange observed compilation behavior present when importing the method from