Bug 1838871 - Fallback to previous behaviour of Ctrl-Shift-T if the in-memory undo actions list is empty. r=dao,sessionstore-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D181273
This commit is contained in:
Mike Conley
2023-06-16 17:57:23 +00:00
parent 0b9106cb6c
commit 470fcfac2b
2 changed files with 105 additions and 9 deletions

View File

@@ -8163,12 +8163,24 @@ function AddKeywordForSearchField() {
function restoreLastClosedTabOrWindowOrSession() {
let lastActionTaken = SessionStore.popLastClosedAction();
if (!lastActionTaken && SessionStore.canRestoreLastSession) {
SessionStore.restoreLastSession();
} else if (lastActionTaken?.type == SessionStore.LAST_ACTION_CLOSED_TAB) {
this.undoCloseTab();
} else if (lastActionTaken?.type == SessionStore.LAST_ACTION_CLOSED_WINDOW) {
this.undoCloseWindow();
if (lastActionTaken) {
switch (lastActionTaken.type) {
case SessionStore.LAST_ACTION_CLOSED_TAB: {
undoCloseTab();
break;
}
case SessionStore.LAST_ACTION_CLOSED_WINDOW: {
undoCloseWindow();
break;
}
}
} else {
let closedTabCount = SessionStore.getLastClosedTabCount(window);
if (closedTabCount) {
undoCloseTab();
} else if (SessionStore.canRestoreLastSession) {
SessionStore.restoreLastSession();
}
}
}