diff options
-rw-r--r-- | src/content/Application.ts | 19 | ||||
-rw-r--r-- | src/content/MessageListener.ts | 2 |
2 files changed, 10 insertions, 11 deletions
diff --git a/src/content/Application.ts b/src/content/Application.ts index 4c89fa0..9ea047c 100644 --- a/src/content/Application.ts +++ b/src/content/Application.ts @@ -56,16 +56,6 @@ export default class Application { } return undefined; }); - - this.messageListener.onBackgroundMessage((msg: Message) => { - switch (msg.type) { - case messages.ADDON_ENABLED_QUERY: - return this.addonEnabledController.getAddonEnabled(msg); - case messages.TAB_SCROLL_TO: - return this.markController.scrollTo(msg); - } - return undefined; - }); } private routeCommonComponents(): Promise<void> { @@ -102,6 +92,15 @@ export default class Application { case messages.CONSOLE_RESIZE: return this.consoleFrameController.resize(msg); } + + if (window.self === window.top) { + switch (msg.type) { + case messages.ADDON_ENABLED_QUERY: + return this.addonEnabledController.getAddonEnabled(msg); + case messages.TAB_SCROLL_TO: + return this.markController.scrollTo(msg); + } + } }); const inputDriver = new InputDriver(window.document.body); diff --git a/src/content/MessageListener.ts b/src/content/MessageListener.ts index 3fe1dcd..ec6940b 100644 --- a/src/content/MessageListener.ts +++ b/src/content/MessageListener.ts @@ -27,7 +27,7 @@ export default class MessageListener { ) { browser.runtime.onMessage.addListener( (msg: any, sender: WebExtMessageSender) => { - return listener(valueOf(msg), sender); + return Promise.resolve(listener(valueOf(msg), sender)); } ); } |