diff --git a/apps/browser/src/autofill/utils/index.ts b/apps/browser/src/autofill/utils/index.ts index ad9fa3a9a8..98e58a022e 100644 --- a/apps/browser/src/autofill/utils/index.ts +++ b/apps/browser/src/autofill/utils/index.ts @@ -105,7 +105,11 @@ export async function sendExtensionMessage( command: string, options: Record = {}, ): Promise { - if (typeof browser?.runtime?.sendMessage !== "undefined") { + if ( + typeof browser !== "undefined" && + typeof browser.runtime !== "undefined" && + typeof browser.runtime.sendMessage !== "undefined" + ) { return browser.runtime.sendMessage({ command, ...options }); }