test: Fixed drag and drop tests hanging on some cases, b=no-bug, c=tests, tabs, workspaces

This commit is contained in:
mr. m
2025-07-23 12:11:32 +02:00
parent ca289363c3
commit d0df3d5a52
3 changed files with 9 additions and 14 deletions

View File

@@ -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;
+

View File

@@ -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'
);
});

View File

@@ -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;
}