mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-11 10:10:25 +01:00
[PM-11519] browser global variable triggering error fix jest (#10821)
* [PM-11519] `browser` global reference triggering an error when sending an extension message * [PM-11519] `browser` global reference triggering an error when sending an extension message
This commit is contained in:
parent
4453a5c114
commit
ba42f10ea3
@ -105,7 +105,11 @@ export async function sendExtensionMessage(
|
|||||||
command: string,
|
command: string,
|
||||||
options: Record<string, any> = {},
|
options: Record<string, any> = {},
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
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 });
|
return browser.runtime.sendMessage({ command, ...options });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user