diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-06-16 22:22:24 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-16 22:22:24 +0900 |
commit | 9b27e4cd4f483d84baef370fdfddc696d202fe19 (patch) | |
tree | 6ca4a165423147ec610a4a69374f6fd846b246dd /src | |
parent | 356c8d2ac640e27603a438eee60771124dc28ee3 (diff) | |
parent | 8a02b5747c3090ee7ead7e181c533a06c280b6b5 (diff) |
Merge pull request #413 from ueokande/reopen-current-window
Reopen current window
Diffstat (limited to 'src')
-rw-r--r-- | src/background/shared/tabs.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/background/shared/tabs.js b/src/background/shared/tabs.js index 62e26ac..5c67a9f 100644 --- a/src/background/shared/tabs.js +++ b/src/background/shared/tabs.js @@ -59,13 +59,17 @@ const closeTabsByKeywordsForce = (keyword) => { }; const reopenTab = () => { - return browser.sessions.getRecentlyClosed({ - maxResults: 1 + let window = null; + return browser.windows.getCurrent().then().then((w) => { + window = w; + return browser.sessions.getRecentlyClosed(); }).then((sessions) => { - if (sessions.length === 0) { + let session = sessions.find((s) => { + return s.tab && s.tab.windowId === window.id; + }); + if (!session) { return; } - let session = sessions[0]; if (session.tab) { return browser.sessions.restore(session.tab.sessionId); } |