feat: Unload a workspace context menu, p=#10688

Co-authored-by: mr. m <91018726+mr-cheffy@users.noreply.github.com>
This commit is contained in:
atharva kamble
2025-10-05 17:55:29 -04:00
committed by GitHub
parent 9bf8bd97b2
commit d6ac283388
5 changed files with 29 additions and 0 deletions

View File

@@ -1479,6 +1479,26 @@ var gZenWorkspaces = new (class extends nsZenMultiWindowFeature {
});
}
async unloadWorkspace() {
const workspaceId = this.#contextMenuData?.workspaceId || this.activeWorkspace;
const tabsToUnload = this.allStoredTabs.filter(
(tab) =>
tab.getAttribute('zen-workspace-id') === workspaceId &&
!tab.hasAttribute('zen-empty-tab') &&
!tab.hasAttribute('zen-essential') &&
!tab.hasAttribute('pending')
);
if (tabsToUnload.length === 0) {
return;
}
this.log('Unloading workspace', workspaceId);
await gBrowser.explicitUnloadTabs(tabsToUnload); // TODO: unit test this
}
moveTabToWorkspace(tab, workspaceID) {
return this.moveTabsToWorkspace([tab], workspaceID);
}