From b433161d72555bbeddb242e765aa49d5be403ffb Mon Sep 17 00:00:00 2001 From: itdominator <1itdominator@gmail.com> Date: Tue, 7 May 2024 20:29:07 -0500 Subject: [PATCH] Fixed Selective Open not working properly when multiple windows are in session. --- README.md | 4 ++-- src/manifest.json | 2 +- src/scripts/session-manager.js | 10 ++++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 3315d69..e3d4bac 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ Easy Session Manager allows you to manage your Firefox session by backing up or # Download https://addons.mozilla.org/en-US/firefox/addon/easy-session-manager/ -# Version: 0.2.3.0 -* Changed menu gutter positioning +# Version: 0.2.3.2 +* Fixed Selective Open not working properly when multiple windows are in session. # Images diff --git a/src/manifest.json b/src/manifest.json index 1d20e2d..7339d5a 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Easy Session Manager", - "version": "0.2.3.1", + "version": "0.2.3.2", "description": "Easy Session Manager allows you to manage your Firefox session by backing up or loading your saved sessions.", "browser_specific_settings": { diff --git a/src/scripts/session-manager.js b/src/scripts/session-manager.js index 62440a3..fbe25e3 100644 --- a/src/scripts/session-manager.js +++ b/src/scripts/session-manager.js @@ -201,6 +201,7 @@ const setKeyData = (_keys, _keysLength) => { const startLoadSession = () => { sessionData = getSelectionData(container, keys, keysLength); + keysLength = Object.keys(sessionData).length; if (keysLength > 0) { loadSession(sessionData, replaceTabs.checked); @@ -214,6 +215,7 @@ const startLoadSession = () => { const loadSession = (json = null, replaceTabs = false) => { let keys = Object.keys(json); let keysLength = Object.keys(json).length; + try { windowApi.getAll().then(windows => { windowApi.getCurrent({populate: true}).then(currentWindow => { @@ -250,13 +252,13 @@ const loadSession = (json = null, replaceTabs = false) => { // If more than one window, load tabs to new windows. if (keysLength > 1) { - windowMaker(1, keysLength, keys, json) + windowMaker(1, keysLength, keys, json); } } else { // Load into new windows... - if (keysLength == 1) { - windowMaker(0, keysLength, keys, json) - } else if (keysLength == 0) { + if (keysLength == 0) { messageWindow("error", "Canceled operation; no tabs in session..."); + } else if (keysLength > 0) { + windowMaker(0, keysLength, keys, json); } } });