From fbff608aae16b7e534561f083138bf6f7ac53ee8 Mon Sep 17 00:00:00 2001 From: joey Date: Mon, 6 Apr 2020 14:32:08 -0400 Subject: [PATCH 1/3] fixed window close issue --- src/js/background/backgroundLogic.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/js/background/backgroundLogic.js b/src/js/background/backgroundLogic.js index de9f402..4589807 100644 --- a/src/js/background/backgroundLogic.js +++ b/src/js/background/backgroundLogic.js @@ -238,7 +238,7 @@ const backgroundLogic = { }, async sortTabsByWindow() { - let windows = await browser.windows.getAll(); + const windows = await browser.windows.getAll(); let containers = new Set(); // loop through each tab to find all active containers @@ -257,13 +257,6 @@ const backgroundLogic = { await this._sortTabsByWindowInternal(windowId, containers[i]); } - // Logically, there shouldn't be any redundant windows - // but, maybe other addons/features conflicts, so double check to - // delete redundant windows here. - windows = await browser.windows.getAll(); - for (let i = containers.length; i < windows.length; i++) { - await browser.windows.remove(windows[i].id); - } }, async _sortTabsByWindowInternal(windowId, cookieStoreId) { @@ -276,11 +269,12 @@ const backgroundLogic = { if (windowId === -1) { const newWindowObj = await browser.windows.create(); windowId = newWindowObj.id; + // take the tab is from the newly created window for deleting uses newlyOpenedTabId = newWindowObj.tabs[0].id; } // move all tabs - browser.tabs.move(tabs.map((tab) => tab.id), { + await browser.tabs.move(tabs.map((tab) => tab.id), { windowId: windowId, index: -1 }); From 29947c52a57cb4ea6ea9070c234f156a627c9e50 Mon Sep 17 00:00:00 2001 From: joey Date: Mon, 6 Apr 2020 14:55:46 -0400 Subject: [PATCH 2/3] updated comments --- src/js/background/backgroundLogic.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/js/background/backgroundLogic.js b/src/js/background/backgroundLogic.js index 4589807..78c3550 100644 --- a/src/js/background/backgroundLogic.js +++ b/src/js/background/backgroundLogic.js @@ -269,7 +269,8 @@ const backgroundLogic = { if (windowId === -1) { const newWindowObj = await browser.windows.create(); windowId = newWindowObj.id; - // take the tab is from the newly created window for deleting uses + // Since creating new window will have opened n default tab, + // take the tab id here, and we could delete it after moving newlyOpenedTabId = newWindowObj.tabs[0].id; } From c2eab092fda004de401fe4447fcb32d807f42754 Mon Sep 17 00:00:00 2001 From: joey Date: Mon, 6 Apr 2020 14:57:33 -0400 Subject: [PATCH 3/3] fixed typo --- src/js/background/backgroundLogic.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/background/backgroundLogic.js b/src/js/background/backgroundLogic.js index 78c3550..59fc7a6 100644 --- a/src/js/background/backgroundLogic.js +++ b/src/js/background/backgroundLogic.js @@ -269,7 +269,7 @@ const backgroundLogic = { if (windowId === -1) { const newWindowObj = await browser.windows.create(); windowId = newWindowObj.id; - // Since creating new window will have opened n default tab, + // Since creating new window will open a default tab, // take the tab id here, and we could delete it after moving newlyOpenedTabId = newWindowObj.tabs[0].id; }