diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-07-29 00:04:24 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-29 00:04:24 +0900 |
commit | af90ef59566210fa8715816d639ae1025f2aa2fb (patch) | |
tree | 0c66e88229b11c9b154772a6a93dbb6def0d6dcf /src/background/infrastructures | |
parent | ed2bd7d75ee1e7aa1db7d03c3f908c740ded1983 (diff) | |
parent | 09c5247dbadb468a764eef308634503484d398c5 (diff) |
Merge pull request #441 from ueokande/search-on-paste
Search on paste
Diffstat (limited to 'src/background/infrastructures')
-rw-r--r-- | src/background/infrastructures/content-message-listener.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/background/infrastructures/content-message-listener.js b/src/background/infrastructures/content-message-listener.js index 58716fb..4fcc6a6 100644 --- a/src/background/infrastructures/content-message-listener.js +++ b/src/background/infrastructures/content-message-listener.js @@ -19,7 +19,11 @@ export default class ContentMessageListener { run() { browser.runtime.onMessage.addListener((message, sender) => { try { - return this.onMessage(message, sender).catch((e) => { + let ret = this.onMessage(message, sender); + if (!(ret instanceof Promise)) { + return {}; + } + return ret.catch((e) => { return browser.tabs.sendMessage(sender.tab.id, { type: messages.CONSOLE_SHOW_ERROR, text: e.message, |