aboutsummaryrefslogtreecommitdiff
path: root/src/background/actions/tab.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-05-01 15:51:40 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2018-05-01 15:51:40 +0900
commit9da2f5fd786ff7ef64eca0a86efb1c0b9a164244 (patch)
treeb888349817d0016dc1499932671bbe6cd95efdaa /src/background/actions/tab.js
parentf9889b7f2b634bfe5a540633d8952f4a6f900658 (diff)
parent89d6afecfd257ff4fc62748f771abf37ef3a2852 (diff)
Merge remote-tracking branch 'origin/master' into patch-1
Diffstat (limited to 'src/background/actions/tab.js')
-rw-r--r--src/background/actions/tab.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/background/actions/tab.js b/src/background/actions/tab.js
index e512b6f..3c642fd 100644
--- a/src/background/actions/tab.js
+++ b/src/background/actions/tab.js
@@ -1,9 +1,21 @@
-const openNewTab = (url) => {
- return browser.tabs.create({ url: url });
+const openNewTab = (url, openerTabId, background = false, adjacent = false) => {
+ if (adjacent) {
+ return browser.tabs.query({
+ active: true, currentWindow: true
+ }).then((tabs) => {
+ return browser.tabs.create({
+ url,
+ openerTabId,
+ active: !background,
+ index: tabs[0].index + 1
+ });
+ });
+ }
+ return browser.tabs.create({ url, active: !background });
};
const openToTab = (url, tab) => {
return browser.tabs.update(tab.id, { url: url });
};
-export { openToTab, openNewTab };
+export { openNewTab, openToTab };