Fixed Selective Open not working properly when multiple windows are in session.

This commit is contained in:
itdominator 2024-05-07 20:29:07 -05:00
parent c73b42e451
commit b433161d72
3 changed files with 9 additions and 7 deletions

View File

@ -4,8 +4,8 @@ Easy Session Manager allows you to manage your Firefox session by backing up or
# Download # Download
https://addons.mozilla.org/en-US/firefox/addon/easy-session-manager/ https://addons.mozilla.org/en-US/firefox/addon/easy-session-manager/
# Version: 0.2.3.0 # Version: 0.2.3.2
* Changed menu gutter positioning * Fixed Selective Open not working properly when multiple windows are in session.
# Images # Images

View File

@ -1,7 +1,7 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "Easy Session Manager", "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.", "description": "Easy Session Manager allows you to manage your Firefox session by backing up or loading your saved sessions.",
"browser_specific_settings": { "browser_specific_settings": {

View File

@ -201,6 +201,7 @@ const setKeyData = (_keys, _keysLength) => {
const startLoadSession = () => { const startLoadSession = () => {
sessionData = getSelectionData(container, keys, keysLength); sessionData = getSelectionData(container, keys, keysLength);
keysLength = Object.keys(sessionData).length; keysLength = Object.keys(sessionData).length;
if (keysLength > 0) { if (keysLength > 0) {
loadSession(sessionData, replaceTabs.checked); loadSession(sessionData, replaceTabs.checked);
@ -214,6 +215,7 @@ const startLoadSession = () => {
const loadSession = (json = null, replaceTabs = false) => { const loadSession = (json = null, replaceTabs = false) => {
let keys = Object.keys(json); let keys = Object.keys(json);
let keysLength = Object.keys(json).length; let keysLength = Object.keys(json).length;
try { try {
windowApi.getAll().then(windows => { windowApi.getAll().then(windows => {
windowApi.getCurrent({populate: true}).then(currentWindow => { 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 more than one window, load tabs to new windows.
if (keysLength > 1) { if (keysLength > 1) {
windowMaker(1, keysLength, keys, json) windowMaker(1, keysLength, keys, json);
} }
} else { // Load into new windows... } else { // Load into new windows...
if (keysLength == 1) { if (keysLength == 0) {
windowMaker(0, keysLength, keys, json)
} else if (keysLength == 0) {
messageWindow("error", "Canceled operation; no tabs in session..."); messageWindow("error", "Canceled operation; no tabs in session...");
} else if (keysLength > 0) {
windowMaker(0, keysLength, keys, json);
} }
} }
}); });