fix(ext): update message handlers

> If multiple listeners are registered for onMessage,
> only the first listener to respond, reject, or throw
> an error will affect the sender; all other listeners
> will run, but their results will be ignored.
This commit is contained in:
Simon
2026-01-29 18:37:42 +08:00
parent 5d77990187
commit 4e87940127
6 changed files with 18 additions and 16 deletions

View File

@@ -39,9 +39,11 @@ export class TabsController extends EventTarget {
await this.updateCurrentTabId(this.currentTabId)
const tabChangeHandler = (message: any) => {
if (message.type !== 'TAB_CHANGE')
throw new Error(`[TabsController]: Invalid message type: ${message.type}`)
const tabChangeHandler = (message: any): void => {
if (message.type !== 'TAB_CHANGE') {
// throw new Error(`[TabsController]: Invalid message type: ${message.type}`)
return
}
if (message.action === 'created') {
const tab = message.payload.tab as chrome.tabs.Tab