aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-06-16 10:47:37 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2018-06-16 11:13:14 +0900
commitf43345a3a57b8fa37dd318a5bac9afcaf8390c07 (patch)
tree00ae0193f4eb9c0082feda8408f7f6099e480f5a
parent9a4dfcbb9f643eee7edb009c1004114b196795f5 (diff)
Reopen a tab on only current tab
-rw-r--r--src/background/shared/tabs.js12
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);
}