[PM-10654] Inline menu not working in MS Edge (#10414)

This commit is contained in:
Cesar Gonzalez 2024-08-06 08:32:16 -05:00 committed by GitHub
parent 8090a89a32
commit b0c938ea7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 1 deletions

View File

@ -105,7 +105,19 @@ export async function sendExtensionMessage(
command: string,
options: Record<string, any> = {},
): Promise<any> {
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);
}),
);
}
/**