From 7d51ae1f0717328c3075a89229ce8f9ddc1db43a Mon Sep 17 00:00:00 2001 From: "mr. m" Date: Sat, 14 Jun 2025 13:10:04 +0200 Subject: [PATCH] fix: Fixed bookmarks being weird on private window, b=closes #8995, c=workspaces --- src/zen/workspaces/ZenWorkspaces.mjs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/zen/workspaces/ZenWorkspaces.mjs b/src/zen/workspaces/ZenWorkspaces.mjs index 5dac9e6eb..dcc01900c 100644 --- a/src/zen/workspaces/ZenWorkspaces.mjs +++ b/src/zen/workspaces/ZenWorkspaces.mjs @@ -115,6 +115,8 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature { document.documentElement.setAttribute('zen-private-window', 'true'); } + this.popupOpenHandler = this._popupOpenHandler.bind(this); + window.addEventListener('resize', this.onWindowResize.bind(this)); this.addPopupListeners(); @@ -646,11 +648,22 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature { document.documentElement.removeAttribute('swipe-gesture'); gZenUIManager.tabsWrapper.style.removeProperty('scrollbar-width'); this.updateTabsContainers(); + document.removeEventListener('popupshown', this.popupOpenHandler, { once: true }); }, true ); } + _popupOpenHandler(event) { + // If a popup is opened, we should stop the swipe gesture + if (this._swipeState?.isGestureActive) { + document.documentElement.removeAttribute('swipe-gesture'); + gZenUIManager.tabsWrapper.style.removeProperty('scrollbar-width'); + this.updateTabsContainers(); + this._cancelSwipeAnimation(); + } + } + _handleSwipeMayStart(event) { if (this.privateWindowOrDisabled || this._inChangingWorkspace) return; if (event.target.closest('#zen-sidebar-foot-buttons')) return; @@ -669,6 +682,7 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature { if (!this.workspaceEnabled) return; document.documentElement.setAttribute('swipe-gesture', 'true'); + document.addEventListener('popupshown', this.popupOpenHandler, { once: true }); event.preventDefault(); event.stopPropagation(); @@ -842,6 +856,14 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature { } async workspaceBookmarks() { + if (this.privateWindowOrDisabled) { + this._workspaceBookmarksCache = { + bookmarks: [], + lastChangeTimestamp: 0, + }; + return this._workspaceBookmarksCache; + } + if (this._workspaceBookmarksCache) { return this._workspaceBookmarksCache; }