mirror of
https://github.com/zen-browser/desktop.git
synced 2026-02-07 12:27:14 +00:00
feat: Return a copy of workspaces when trying to fetch it to prevent mutations, b=no-bug, c=tabs, workspaces
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/themes/shared/tabbrowser/tabs.css b/browser/themes/shared/tabbrowser/tabs.css
|
||||
index 8a4d3860b344e2dc2128cfc2b1673de582e19c7c..fef63d687ba4e816d3d36f34d4a39adef06359c9 100644
|
||||
index 8a4d3860b344e2dc2128cfc2b1673de582e19c7c..086171783cd9a8629ccf4b2e90813e58c4793878 100644
|
||||
--- a/browser/themes/shared/tabbrowser/tabs.css
|
||||
+++ b/browser/themes/shared/tabbrowser/tabs.css
|
||||
@@ -21,7 +21,7 @@
|
||||
@@ -111,7 +111,7 @@ index 8a4d3860b344e2dc2128cfc2b1673de582e19c7c..fef63d687ba4e816d3d36f34d4a39ade
|
||||
}
|
||||
|
||||
-#tabbrowser-arrowscrollbox[orient="vertical"] > #tabbrowser-arrowscrollbox-periphery > #tabs-newtab-button,
|
||||
+#tabbrowser-arrowscrollbox[orient="vertical"] #tabbrowser-arrowscrollbox-periphery > #tabs-newtab-button,
|
||||
+#tabs-newtab-button,
|
||||
#vertical-tabs-newtab-button {
|
||||
appearance: none;
|
||||
min-height: var(--tab-min-height);
|
||||
|
||||
@@ -312,7 +312,10 @@ class nsZenWindowSync {
|
||||
if (flags & SYNC_FLAG_ICON) {
|
||||
aTargetItem.removeAttribute('zen-has-static-icon');
|
||||
if (gBrowser.isTab(aOriginalItem)) {
|
||||
gBrowser.setIcon(aTargetItem, gBrowser.getIcon(aOriginalItem));
|
||||
gBrowser.setIcon(
|
||||
aTargetItem,
|
||||
aOriginalItem.getAttribute('image') || gBrowser.getIcon(aOriginalItem)
|
||||
);
|
||||
} else if (aOriginalItem.isZenFolder) {
|
||||
// Icons are a zen-only feature for tab groups.
|
||||
gZenFolders.setFolderUserIcon(aTargetItem, aOriginalItem.iconURL);
|
||||
|
||||
@@ -32,6 +32,7 @@ class ZenPinnedTabsObserver {
|
||||
);
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
E10SUtils: 'resource://gre/modules/E10SUtils.sys.mjs',
|
||||
TabStateCache: 'resource:///modules/sessionstore/TabStateCache.sys.mjs',
|
||||
});
|
||||
this.#listenPinnedTabEvents();
|
||||
}
|
||||
@@ -486,6 +487,9 @@ class nsZenPinnedTabManager extends nsZenDOMOperatedFeature {
|
||||
if (icon) {
|
||||
tab.setAttribute('zen-has-static-icon', 'true');
|
||||
}
|
||||
lazy.TabStateCache.update(tab.permanentKey, {
|
||||
image: null,
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
|
||||
@@ -824,7 +824,7 @@ class nsZenWorkspaces {
|
||||
this.#activeWorkspace = this._tempWorkspace?.uuid;
|
||||
return this._workspaceCache;
|
||||
}
|
||||
return this._workspaceCache;
|
||||
return [...this._workspaceCache];
|
||||
}
|
||||
|
||||
async workspaceBookmarks() {
|
||||
@@ -1210,7 +1210,7 @@ class nsZenWorkspaces {
|
||||
}
|
||||
if (!this.#contextMenuData.workspaceId) {
|
||||
separator.hidden = false;
|
||||
for (const workspace of [...this._workspaceCache].reverse()) {
|
||||
for (const workspace of this.getWorkspaces().reverse()) {
|
||||
const item = this.generateMenuItemForWorkspace(workspace);
|
||||
item.addEventListener('command', (e) => {
|
||||
this.changeWorkspaceWithID(e.target.closest('menuitem').getAttribute('zen-workspace-id'));
|
||||
@@ -1363,7 +1363,7 @@ class nsZenWorkspaces {
|
||||
if (this.privateWindowOrDisabled) {
|
||||
return;
|
||||
}
|
||||
const workspaces = this.getWorkspaces();
|
||||
const workspaces = this._workspaceCache;
|
||||
const workspace = workspaces.find((w) => w.uuid === id);
|
||||
if (!workspace) {
|
||||
console.warn(`Workspace with ID ${id} not found for reordering.`);
|
||||
@@ -1382,8 +1382,10 @@ class nsZenWorkspaces {
|
||||
return;
|
||||
}
|
||||
workspaces.splice(newPosition, 0, workspace);
|
||||
// Propagate the changes
|
||||
this.#propagateWorkspaceData();
|
||||
// Propagate the changes if the order has changed
|
||||
if (currentIndex !== newPosition) {
|
||||
this.#propagateWorkspaceData();
|
||||
}
|
||||
}
|
||||
|
||||
async openWorkspaceCreation() {
|
||||
|
||||
@@ -99,6 +99,8 @@
|
||||
& toolbarbutton {
|
||||
margin: 0;
|
||||
background: transparent;
|
||||
/* Ignore press state when in overflow, to allow clicks to happen */
|
||||
scale: 1 !important;
|
||||
}
|
||||
|
||||
/* Inlcude separately since ther'es a bug in the
|
||||
|
||||
Reference in New Issue
Block a user