From d0df3d5a52be0a18b336eb10380c32c26529c94e Mon Sep 17 00:00:00 2001 From: "mr. m" Date: Wed, 23 Jul 2025 12:11:32 +0200 Subject: [PATCH] test: Fixed drag and drop tests hanging on some cases, b=no-bug, c=tests, tabs, workspaces --- .../components/tabbrowser/content/tabbrowser-js.patch | 4 ++-- src/zen/tests/tabs/browser_drag_drop_vertical.js | 8 ++++---- src/zen/workspaces/ZenWorkspaces.mjs | 11 +++-------- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/browser/components/tabbrowser/content/tabbrowser-js.patch b/src/browser/components/tabbrowser/content/tabbrowser-js.patch index b67064647..e72703430 100644 --- a/src/browser/components/tabbrowser/content/tabbrowser-js.patch +++ b/src/browser/components/tabbrowser/content/tabbrowser-js.patch @@ -1,5 +1,5 @@ diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js -index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..4ad544fe4dae7b7619b629aa33df6b1066502675 100644 +index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a0291b4d8d35 100644 --- a/browser/components/tabbrowser/content/tabbrowser.js +++ b/browser/components/tabbrowser/content/tabbrowser.js @@ -422,15 +422,49 @@ @@ -667,7 +667,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..4ad544fe4dae7b7619b629aa33df6b10 moveActionCallback(); -+ gZenWorkspaces._makeSureEmptyTabIsLast(); ++ gZenWorkspaces.makeSureEmptyTabIsFirst(); + gZenViewSplitter._maybeRemoveFakeBrowser(false); + gZenViewSplitter._canDrop = false; + diff --git a/src/zen/tests/tabs/browser_drag_drop_vertical.js b/src/zen/tests/tabs/browser_drag_drop_vertical.js index 2037cb2c5..2afddb81f 100644 --- a/src/zen/tests/tabs/browser_drag_drop_vertical.js +++ b/src/zen/tests/tabs/browser_drag_drop_vertical.js @@ -152,13 +152,13 @@ add_task(async function test_basic_unpinned_vertical_ltr() { await dropAfter(tab1, tab2, window); Assert.deepEqual( gBrowser.tabs, - [tab2, tab1, tab3, emptyTab], + [emptyTab, tab2, tab1, tab3], 'confirm that tab1 moved after tab2' ); await dropAfter(tab1, tab3, window); Assert.deepEqual( gBrowser.tabs, - [tab2, tab3, tab1, emptyTab], + [emptyTab, tab2, tab3, tab1], 'confirm that tab1 moved after tab3' ); @@ -166,13 +166,13 @@ add_task(async function test_basic_unpinned_vertical_ltr() { await dropBefore(tab1, tab3, window); Assert.deepEqual( gBrowser.tabs, - [tab2, tab1, tab3, emptyTab], + [emptyTab, tab2, tab1, tab3], 'confirm that tab1 moved before tab3' ); await dropBefore(tab1, tab2, window); Assert.deepEqual( gBrowser.tabs, - [tab1, tab2, tab3, emptyTab], + [emptyTab, tab1, tab2, tab3], 'confirm that tab1 moved before tab2' ); }); diff --git a/src/zen/workspaces/ZenWorkspaces.mjs b/src/zen/workspaces/ZenWorkspaces.mjs index 3a95f9acf..363d94e54 100644 --- a/src/zen/workspaces/ZenWorkspaces.mjs +++ b/src/zen/workspaces/ZenWorkspaces.mjs @@ -1540,8 +1540,6 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature { gBrowser.pinnedTabsContainer = this.pinnedTabsContainer || gBrowser.pinnedTabsContainer; gBrowser.tabContainer.pinnedTabsContainer = this.pinnedTabsContainer || gBrowser.tabContainer.pinnedTabsContainer; - // Move empty tab to the new workspace - this._moveEmptyTabToWorkspace(workspace.uuid); this.tabContainer._invalidateCachedTabs(); if (!whileScrolling) { @@ -1563,16 +1561,12 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature { }); } - _moveEmptyTabToWorkspace(workspaceUuid) { - this._makeSureEmptyTabIsLast(); - } - - _makeSureEmptyTabIsLast() { + makeSureEmptyTabIsFirst() { const emptyTab = this._emptyTab; if (emptyTab) { const container = this.activeWorkspaceStrip; if (container) { - container.insertBefore(emptyTab, container.lastChild); + container.insertBefore(emptyTab, container.firstChild); } } this._fixTabPositions(); @@ -2316,6 +2310,7 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature { } async updateTabsContainers(target = undefined, forAnimation = false) { + this.makeSureEmptyTabIsFirst(); if (target && !target.target?.parentNode) { target = null; }