diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-10-07 11:00:34 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-10-07 11:44:19 +0900 |
commit | 9fb7bf96be786acfbad97f7c76bc423a401dd657 (patch) | |
tree | 69a096e9a8610ae8966af05e91355efdd27ea811 /src/components/background.js | |
parent | 45368384d1bbcbc005bf1eb3cdc7f7c8b137c28c (diff) |
fix console errors
Diffstat (limited to 'src/components/background.js')
-rw-r--r-- | src/components/background.js | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/components/background.js b/src/components/background.js index 195cfd9..487e3af 100644 --- a/src/components/background.js +++ b/src/components/background.js @@ -1,5 +1,4 @@ import messages from 'content/messages'; -import * as consoleActions from 'actions/console'; import * as inputActions from 'actions/input'; import * as settingsActions from 'actions/setting'; import * as tabActions from 'actions/tab'; @@ -14,7 +13,10 @@ export default class BackgroundComponent { try { return this.onMessage(message, sender); } catch (e) { - this.store.dispatch(consoleActions.showError(e.message), sender); + return browser.tabs.sendMessage(sender.tab.id, { + type: messages.CONSOLE_SHOW_ERROR, + text: e.message, + }); } }); } @@ -44,10 +46,16 @@ export default class BackgroundComponent { return this.store.dispatch( tabActions.openToTab(message.url, sender.tab), sender); case messages.CONSOLE_BLURRED: - return this.store.dispatch( - consoleActions.hide(), sender); + return browser.tabs.sendMessage(sender.tab.id, { + type: messages.CONSOLE_HIDE, + }); case messages.CONSOLE_ENTERED: - return commands.exec(message.text, this.settings); + return commands.exec(message.text, this.settings).catch((e) => { + return browser.tabs.sendMessage(sender.tab.id, { + type: messages.CONSOLE_SHOW_ERROR, + text: e.message, + }); + }); case messages.CONSOLE_QUERY_COMPLETIONS: return commands.complete(message.text, this.settings); case messages.SETTINGS_RELOAD: |