diff --git a/src/background/runtime.background.ts b/src/background/runtime.background.ts index 96c492b0f3..48c9c182de 100644 --- a/src/background/runtime.background.ts +++ b/src/background/runtime.background.ts @@ -42,15 +42,6 @@ export default class RuntimeBackground { } }, true); - this.runtime.addEventListener('message', async (msgEvent: any) => { - await this.processMessage(msgEvent.message, { - tab: { - id: null, // TODO - }, - frameId: null, - }, () => { /* No responses in Safari */ }); - }, false); - return; } @@ -67,7 +58,7 @@ export default class RuntimeBackground { }); } - this.runtime.onMessage.addListener(async (msg: any, sender: any, sendResponse: any) => { + BrowserApi.messageListener(async (msg: any, sender: any, sendResponse: any) => { await this.processMessage(msg, sender, sendResponse); }); } diff --git a/src/browser/browserApi.ts b/src/browser/browserApi.ts index a4a975e4ae..2b8974b696 100644 --- a/src/browser/browserApi.ts +++ b/src/browser/browserApi.ts @@ -167,7 +167,14 @@ class BrowserApi { callback(msg, sender, response); }); } else if (BrowserApi.isSafariApi) { - // TODO + safari.application.addEventListener('message', async (msgEvent: any) => { + callback(msgEvent.message, { + tab: { + id: null, // TODO + }, + frameId: null, + }, () => { /* No responses in Safari */ }); + }, false); } } }