From ef86a18cb9777a7785ef6b398c171763da5fd3b7 Mon Sep 17 00:00:00 2001 From: Rostyslav Nihrutsa Date: Tue, 28 Oct 2025 12:56:56 +0200 Subject: [PATCH 1/2] fix(tabs): remove unsupported `documentId` option in sendTabMessage for Firefox --- src/browser.ts | 11 +++++++++++ src/tabs.ts | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/browser.ts b/src/browser.ts index a98adad..f44cbe6 100644 --- a/src/browser.ts +++ b/src/browser.ts @@ -7,3 +7,14 @@ export const browser = (): typeof chrome => { return chrome; }; + +export const isFirefox = (): boolean => { + let isFirefox = false; + + try { + // @ts-expect-error + isFirefox = !!browser().runtime.getBrowserInfo; + } catch (_e) {} + + return isFirefox; +}; diff --git a/src/tabs.ts b/src/tabs.ts index 006095f..2e672a3 100644 --- a/src/tabs.ts +++ b/src/tabs.ts @@ -1,4 +1,4 @@ -import {browser} from "./browser"; +import {browser, isFirefox} from "./browser"; import {throwRuntimeError} from "./runtime"; import {handleListener} from "./utils"; @@ -270,6 +270,9 @@ export const sendTabMessage = ( options: MessageSendOptions = {} ): Promise => new Promise((resolve, reject) => { + // Firefox does not support `documentId` option + if (isFirefox()) delete options.documentId; + tabs().sendMessage(tabId, message, options, response => { try { throwRuntimeError(); From 8658e48a02054e6686ce16c62bfcc8a905723037 Mon Sep 17 00:00:00 2001 From: Rostyslav Nihrutsa Date: Tue, 28 Oct 2025 13:23:50 +0200 Subject: [PATCH 2/2] Revert "fix(tabs): remove unsupported `documentId` option in sendTabMessage for Firefox" This reverts commit ef86a18cb9777a7785ef6b398c171763da5fd3b7. --- src/browser.ts | 11 ----------- src/tabs.ts | 5 +---- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/browser.ts b/src/browser.ts index f44cbe6..a98adad 100644 --- a/src/browser.ts +++ b/src/browser.ts @@ -7,14 +7,3 @@ export const browser = (): typeof chrome => { return chrome; }; - -export const isFirefox = (): boolean => { - let isFirefox = false; - - try { - // @ts-expect-error - isFirefox = !!browser().runtime.getBrowserInfo; - } catch (_e) {} - - return isFirefox; -}; diff --git a/src/tabs.ts b/src/tabs.ts index 2e672a3..006095f 100644 --- a/src/tabs.ts +++ b/src/tabs.ts @@ -1,4 +1,4 @@ -import {browser, isFirefox} from "./browser"; +import {browser} from "./browser"; import {throwRuntimeError} from "./runtime"; import {handleListener} from "./utils"; @@ -270,9 +270,6 @@ export const sendTabMessage = ( options: MessageSendOptions = {} ): Promise => new Promise((resolve, reject) => { - // Firefox does not support `documentId` option - if (isFirefox()) delete options.documentId; - tabs().sendMessage(tabId, message, options, response => { try { throwRuntimeError();