aboutsummaryrefslogtreecommitdiff
path: root/src/background/actions/tab.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-06-18 20:52:54 +0900
committerGitHub <noreply@github.com>2018-06-18 20:52:54 +0900
commit897e010f42cbc9968cf1058116b0f8bbe9e9a4fd (patch)
tree3cba586e52ef703d1b49a85ad15d91aca4cbc65f /src/background/actions/tab.js
parent7cae7302bd39a7963b765cd3defd05a093c104a6 (diff)
parentb74acf6f6aef4e4241ba62c72ed8ddb21adc751d (diff)
Merge pull request #417 from ueokande/async-function
Use await/async on e2e test
Diffstat (limited to 'src/background/actions/tab.js')
-rw-r--r--src/background/actions/tab.js27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/background/actions/tab.js b/src/background/actions/tab.js
index 0d439fd..5cf1e8c 100644
--- a/src/background/actions/tab.js
+++ b/src/background/actions/tab.js
@@ -1,19 +1,20 @@
import actions from './index';
-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
- });
- });
+const openNewTab = async(
+ url, openerTabId, background = false, adjacent = false
+) => {
+ if (!adjacent) {
+ return browser.tabs.create({ url, active: !background });
}
- return browser.tabs.create({ url, active: !background });
+ let tabs = await browser.tabs.query({
+ active: true, currentWindow: true
+ });
+ return browser.tabs.create({
+ url,
+ openerTabId,
+ active: !background,
+ index: tabs[0].index + 1
+ });
};
const openToTab = (url, tab) => {