Bug 1935482 - Replace legacy properties with SidebarState properties r=sidebar-reviewers,sessionstore-reviewers,nsharpley,sfoster

- Move resize observer (setting max width) logic over to SidebarState.
- Add `command` property to SidebarState.
- Handle receiving legacy session restore data.
- Add unit tests along with mocking structures to get a better idea of state/controller coupling (which we should ultimately reduce).

Differential Revision: https://phabricator.services.mozilla.com/D232730
This commit is contained in:
Jonathan Sudiaman
2025-01-08 23:06:42 +00:00
parent 2b3143959c
commit 9372222c8c
12 changed files with 157 additions and 83 deletions

View File

@@ -5122,22 +5122,8 @@ var SessionStoreInternal = {
delete winData.hidden;
}
let sidebarBox = aWindow.document.getElementById("sidebar-box");
let command = sidebarBox.getAttribute("sidebarcommand");
winData.sidebar = {};
if (sidebarBox.style.width) {
winData.sidebar.width = sidebarBox.style.width;
}
if (command && sidebarBox.getAttribute("checked") == "true") {
winData.sidebar.command = command;
} else if (winData.sidebar?.command) {
delete winData.sidebar.command;
}
if (aWindow.SidebarController.revampComponentsLoaded) {
const sidebarUIState = aWindow.SidebarController.getUIState();
winData.sidebar = structuredClone(sidebarUIState);
}
const sidebarUIState = aWindow.SidebarController.getUIState();
winData.sidebar = structuredClone(sidebarUIState);
let workspaceID = aWindow.getWorkspaceID();
if (workspaceID) {
@@ -6225,7 +6211,7 @@ var SessionStoreInternal = {
if (!aSidebar || isPopup) {
return;
}
aWindow.SidebarController.setUIState(aSidebar);
aWindow.SidebarController.initializeUIState(aSidebar);
},
/**