aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/background/index.js2
-rw-r--r--src/console/console-frame.js2
-rw-r--r--src/console/console.js11
-rw-r--r--src/content/index.js11
4 files changed, 15 insertions, 11 deletions
diff --git a/src/background/index.js b/src/background/index.js
index 171f90e..61d4895 100644
--- a/src/background/index.js
+++ b/src/background/index.js
@@ -96,5 +96,7 @@ browser.runtime.onMessage.addListener((request, sender) => {
items: items
};
});
+ default:
+ return browser.tabs.sendMessage(sender.tab.id, request);
}
});
diff --git a/src/console/console-frame.js b/src/console/console-frame.js
index e6bf3f5..a590da9 100644
--- a/src/console/console-frame.js
+++ b/src/console/console-frame.js
@@ -22,8 +22,8 @@ export default class ConsoleFrame {
type: 'vimvixen.console.show.command',
text: text
};
- messages.send(this.element.contentWindow, message);
this.errorShown = false;
+ return browser.runtime.sendMessage(message);
}
showError(text) {
diff --git a/src/console/console.js b/src/console/console.js
index c32eca0..ae05001 100644
--- a/src/console/console.js
+++ b/src/console/console.js
@@ -195,9 +195,6 @@ const selectCompletion = (target) => {
messages.receive(window, (message) => {
switch (message.type) {
- case 'vimvixen.console.show.command':
- showCommand(message.text);
- break;
case 'vimvixen.console.show.error':
showError(message.text);
break;
@@ -206,3 +203,11 @@ messages.receive(window, (message) => {
break;
}
});
+
+browser.runtime.onMessage.addListener((action) => {
+ switch (action.type) {
+ case 'vimvixen.console.show.command':
+ return showCommand(action.text);
+ }
+ return Promise.resolve();
+});
diff --git a/src/content/index.js b/src/content/index.js
index d5cca94..a2a864d 100644
--- a/src/content/index.js
+++ b/src/content/index.js
@@ -11,19 +11,16 @@ let vvConsole = new ConsoleFrame(window);
browser.runtime.onMessage.addListener((action) => {
switch (action.type) {
case actions.CMD_OPEN:
- vvConsole.showCommand('');
- break;
+ return vvConsole.showCommand('');
case actions.CMD_TABS_OPEN:
if (action.alter) {
// alter url
- vvConsole.showCommand('open ' + window.location.href);
+ return vvConsole.showCommand('open ' + window.location.href);
} else {
- vvConsole.showCommand('open ');
+ return vvConsole.showCommand('open ');
}
- break;
case actions.CMD_BUFFER:
- vvConsole.showCommand('buffer ');
- break;
+ return vvConsole.showCommand('buffer ');
case actions.SCROLL_LINES:
scrolls.scrollLines(window, action.count);
break;