aboutsummaryrefslogtreecommitdiff
path: root/e2e/ambassador/src/background/index.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-02-11 15:40:34 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2018-02-12 22:04:55 +0900
commit3f8bbe11d96b751affa9e2bf0a1995008f9e3220 (patch)
tree70a6f389331ca93bf51b4a5e46a1833817a4bfcf /e2e/ambassador/src/background/index.js
parentcf03d278eb8bb8f7544ae6395b76e1a1e0781053 (diff)
send press key to tabs
Diffstat (limited to 'e2e/ambassador/src/background/index.js')
-rw-r--r--e2e/ambassador/src/background/index.js25
1 files changed, 23 insertions, 2 deletions
diff --git a/e2e/ambassador/src/background/index.js b/e2e/ambassador/src/background/index.js
index 027c953..9e64986 100644
--- a/e2e/ambassador/src/background/index.js
+++ b/e2e/ambassador/src/background/index.js
@@ -1,12 +1,33 @@
-import { WINDOWS_CREATE, WINDOWS_REMOVE } from '../shared/messages';
+import {
+ WINDOWS_CREATE, WINDOWS_REMOVE, TABS_CREATE,
+ EVENT_KEYPRESS, EVENT_KEYDOWN, EVENT_KEYUP,
+} from '../shared/messages';
+import * as tabs from './tabs';
import { receiveContentMessage } from './ipc';
receiveContentMessage((message) => {
switch (message.type) {
case WINDOWS_CREATE:
- return browser.windows.create();
+ return browser.windows.create({ url: message.url });
case WINDOWS_REMOVE:
return browser.windows.remove(message.windowId);
+ case TABS_CREATE:
+ return tabs.create({
+ url: message.url,
+ windowId: message.windowId,
+ });
}
});
+
+receiveContentMessage((message) => {
+ switch (message.type) {
+ case EVENT_KEYPRESS:
+ case EVENT_KEYDOWN:
+ case EVENT_KEYUP:
+ return browser.tabs.sendMessage(
+ message.tabId,
+ message
+ );
+ }
+});