aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/background/index.js7
-rw-r--r--src/components/background.js18
-rw-r--r--src/pages/console.js2
3 files changed, 19 insertions, 8 deletions
diff --git a/src/background/index.js b/src/background/index.js
index 05d3553..b966c13 100644
--- a/src/background/index.js
+++ b/src/background/index.js
@@ -1,5 +1,5 @@
-import * as consoleActions from 'actions/console';
import * as settingsActions from 'actions/setting';
+import messages from 'content/messages';
import BackgroundComponent from 'components/background';
import BackgroundInputComponent from 'components/background-input';
import reducers from 'reducers';
@@ -8,7 +8,10 @@ import { createStore } from 'store';
const store = createStore(reducers, (e, sender) => {
console.error('Vim-Vixen:', e);
if (sender) {
- store.dispatch(consoleActions.showError(e.message), sender);
+ return browser.tabs.sendMessage(sender.tab.id, {
+ type: messages.CONSOLE_SHOW_ERROR,
+ text: e.message,
+ });
}
});
const backgroundComponent = new BackgroundComponent(store);
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:
diff --git a/src/pages/console.js b/src/pages/console.js
index 20a60f6..b7be73d 100644
--- a/src/pages/console.js
+++ b/src/pages/console.js
@@ -27,7 +27,7 @@ browser.runtime.onMessage.addListener((action) => {
case messages.CONSOLE_SHOW_COMMAND:
return store.dispatch(consoleActions.showCommand(action.command));
case messages.CONSOLE_SHOW_ERROR:
- return store.dispatch(consoleActions.showError(action.command));
+ return store.dispatch(consoleActions.showError(action.text));
case messages.CONSOLE_HIDE:
return store.dispatch(consoleActions.hide(action.command));
}