From b0c938ea7eac5b6c330bb19be8fbea66319a0f5c Mon Sep 17 00:00:00 2001 From: Cesar Gonzalez Date: Tue, 6 Aug 2024 08:32:16 -0500 Subject: [PATCH] [PM-10654] Inline menu not working in MS Edge (#10414) --- apps/browser/src/autofill/utils/index.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/browser/src/autofill/utils/index.ts b/apps/browser/src/autofill/utils/index.ts index bc486820642..95e84d19d12 100644 --- a/apps/browser/src/autofill/utils/index.ts +++ b/apps/browser/src/autofill/utils/index.ts @@ -105,7 +105,19 @@ export async function sendExtensionMessage( command: string, options: Record = {}, ): Promise { - return chrome.runtime.sendMessage({ command, ...options }); + if (typeof browser !== "undefined") { + return browser.runtime.sendMessage({ command, ...options }); + } + + return new Promise((resolve) => + chrome.runtime.sendMessage(Object.assign({ command }, options), (response) => { + if (chrome.runtime.lastError) { + resolve(null); + } + + resolve(response); + }), + ); } /**