1
0
Fork 1
mirror of https://github.com/zen-browser/desktop.git synced 2025-07-07 21:49:58 +02:00

test: Added more tests for glance, b=(no-bug), c=tests, scripts, tabs, glance, workspaces

This commit is contained in:
Mr. M 2025-05-22 16:57:27 +02:00
parent ad124c9d95
commit addc318f29
No known key found for this signature in database
GPG key ID: 6292C4C8F8652B18
11 changed files with 197 additions and 273 deletions

View file

@ -24,7 +24,8 @@
"prepare": "husky",
"reset-ff": "surfer reset",
"surfer": "surfer",
"test": "python3 scripts/run_tests.py"
"test": "python3 scripts/run_tests.py",
"test:dbg": "python3 scripts/run_tests.py --jsdebugger --debug-on-failure"
},
"repository": {
"type": "git",

View file

@ -5,7 +5,7 @@ from pathlib import Path
def main():
project_root = Path(__file__).resolve().parent
project_root = Path(__file__).resolve().parent.parent
package_json = project_root / 'package.json'
# Ensure script is run from project root
@ -14,10 +14,11 @@ def main():
sys.exit(1)
args = sys.argv[1:]
if not args:
path = ""
else:
path = args[0]
path = ""
for arg in args:
if not arg.startswith("--"):
path = arg
break
# Collect any additional arguments
other_args = [arg for arg in args if arg != path]

View file

@ -1,15 +1,11 @@
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247ecdebcfc 100644
index d5aa64842a35c6697263c63fd3a0571b64b01344..bcae8a44593d7b3e5efdd999b4c2f5bcac221632 100644
--- a/browser/components/tabbrowser/content/tabbrowser.js
+++ b/browser/components/tabbrowser/content/tabbrowser.js
@@ -413,11 +413,45 @@
@@ -413,11 +413,41 @@
return this.tabContainer.visibleTabs;
}
+ zenInsertTabAtIndex(...args) {
+ return this.#insertTabAtIndex(...args);
+ }
+
+ get _numVisiblePinTabsWithoutCollapsed() {
+ let i = 0;
+ for (let item of this.tabContainer.ariaFocusableItems) {
@ -50,7 +46,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
}
return i;
}
@@ -569,6 +603,7 @@
@@ -569,6 +599,7 @@
this.tabpanels.appendChild(panel);
let tab = this.tabs[0];
@ -58,7 +54,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
tab.linkedPanel = uniqueId;
this._selectedTab = tab;
this._selectedBrowser = browser;
@@ -834,11 +869,13 @@
@@ -834,11 +865,13 @@
}
this.showTab(aTab);
@ -75,7 +71,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
this.moveTabTo(aTab, {
tabIndex: this.pinnedTabCount,
forceUngrouped: true,
@@ -855,12 +892,15 @@
@@ -855,12 +888,15 @@
}
if (this.tabContainer.verticalMode) {
@ -92,7 +88,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
});
} else {
this.moveTabTo(aTab, {
@@ -1044,6 +1084,8 @@
@@ -1044,6 +1080,8 @@
let LOCAL_PROTOCOLS = ["chrome:", "about:", "resource:", "data:"];
@ -101,7 +97,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
if (
aIconURL &&
!aLoadingPrincipal &&
@@ -1054,6 +1096,9 @@
@@ -1054,6 +1092,9 @@
);
return;
}
@ -111,7 +107,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
let browser = this.getBrowserForTab(aTab);
browser.mIconURL = aIconURL;
@@ -1303,6 +1348,7 @@
@@ -1303,6 +1344,7 @@
if (!this._previewMode) {
newTab.recordTimeFromUnloadToReload();
newTab.updateLastAccessed();
@ -119,7 +115,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
oldTab.updateLastAccessed();
// if this is the foreground window, update the last-seen timestamps.
if (this.ownerGlobal == BrowserWindowTracker.getTopWindow()) {
@@ -1455,6 +1501,9 @@
@@ -1455,6 +1497,9 @@
}
let activeEl = document.activeElement;
@ -129,7 +125,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
// If focus is on the old tab, move it to the new tab.
if (activeEl == oldTab) {
newTab.focus();
@@ -1778,7 +1827,8 @@
@@ -1778,7 +1823,8 @@
}
_setTabLabel(aTab, aLabel, { beforeTabOpen, isContentTitle, isURL } = {}) {
@ -139,7 +135,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
return false;
}
@@ -1886,7 +1936,7 @@
@@ -1886,7 +1932,7 @@
newIndex = this.selectedTab._tPos + 1;
}
@ -148,7 +144,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
if (this.isTabGroupLabel(targetTab)) {
throw new Error(
"Replacing a tab group label with a tab is not supported"
@@ -2150,6 +2200,7 @@
@@ -2150,6 +2196,7 @@
uriIsAboutBlank,
userContextId,
skipLoad,
@ -156,7 +152,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
} = {}) {
let b = document.createXULElement("browser");
// Use the JSM global to create the permanentKey, so that if the
@@ -2223,8 +2274,7 @@
@@ -2223,8 +2270,7 @@
// we use a different attribute name for this?
b.setAttribute("name", name);
}
@ -166,7 +162,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
b.setAttribute("transparent", "true");
}
@@ -2389,7 +2439,7 @@
@@ -2389,7 +2435,7 @@
let panel = this.getPanel(browser);
let uniqueId = this._generateUniquePanelID();
@ -175,7 +171,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
aTab.linkedPanel = uniqueId;
// Inject the <browser> into the DOM if necessary.
@@ -2448,8 +2498,8 @@
@@ -2448,8 +2494,8 @@
// If we transitioned from one browser to two browsers, we need to set
// hasSiblings=false on both the existing browser and the new browser.
if (this.tabs.length == 2) {
@ -186,7 +182,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
} else {
aTab.linkedBrowser.browsingContext.hasSiblings = this.tabs.length > 1;
}
@@ -2680,6 +2730,7 @@
@@ -2680,6 +2726,7 @@
schemelessInput,
hasValidUserGestureActivation = false,
textDirectiveUserActivation = false,
@ -194,7 +190,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
} = {}
) {
// all callers of addTab that pass a params object need to pass
@@ -2690,6 +2741,12 @@
@@ -2690,6 +2737,12 @@
);
}
@ -207,7 +203,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
if (!UserInteraction.running("browser.tabs.opening", window)) {
UserInteraction.start("browser.tabs.opening", "initting", window);
}
@@ -2753,6 +2810,16 @@
@@ -2753,6 +2806,16 @@
noInitialLabel,
skipBackgroundNotify,
});
@ -224,7 +220,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
if (insertTab) {
// Insert the tab into the tab container in the correct position.
// For now, we support `index` as an alias for `tabIndex`.
@@ -2783,6 +2850,7 @@
@@ -2783,6 +2846,7 @@
openWindowInfo,
skipLoad,
triggeringRemoteType,
@ -232,7 +228,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
}));
if (focusUrlBar) {
@@ -2902,6 +2970,12 @@
@@ -2902,6 +2966,12 @@
}
}
@ -245,7 +241,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
// Additionally send pinned tab events
if (pinned) {
this._notifyPinnedStatus(t);
@@ -2990,10 +3064,10 @@
@@ -2990,10 +3060,10 @@
isAdoptingGroup = false,
isUserTriggered = false,
telemetryUserCreateSource = "unknown",
@ -257,7 +253,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
}
if (!color) {
@@ -3014,7 +3088,12 @@
@@ -3014,7 +3084,12 @@
label,
isAdoptingGroup
);
@ -271,7 +267,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
group,
insertBefore?.group ?? insertBefore
);
@@ -3303,6 +3382,7 @@
@@ -3303,6 +3378,7 @@
openWindowInfo,
skipLoad,
triggeringRemoteType,
@ -279,7 +275,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
}
) {
// If we don't have a preferred remote type (or it is `NOT_REMOTE`), and
@@ -3372,6 +3452,7 @@
@@ -3372,6 +3448,7 @@
openWindowInfo,
name,
skipLoad,
@ -287,7 +283,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
});
}
@@ -3560,7 +3641,7 @@
@@ -3560,7 +3637,7 @@
// Add a new tab if needed.
if (!tab) {
let createLazyBrowser =
@ -296,7 +292,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
let url = "about:blank";
if (tabData.entries?.length) {
@@ -3598,7 +3679,29 @@
@@ -3598,7 +3675,29 @@
skipLoad: true,
preferredRemoteType,
});
@ -326,7 +322,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
if (select) {
tabToSelect = tab;
}
@@ -3622,7 +3725,8 @@
@@ -3622,7 +3721,8 @@
// needs calling:
shouldUpdateForPinnedTabs = true;
}
@ -336,7 +332,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
let { groupId } = tabData;
const tabGroup = tabGroupWorkingData.get(groupId);
// if a tab refers to a tab group we don't know, skip any group
@@ -3636,7 +3740,10 @@
@@ -3636,7 +3736,10 @@
tabGroup.stateData.id,
tabGroup.stateData.color,
tabGroup.stateData.collapsed,
@ -348,7 +344,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
);
tabsFragment.appendChild(tabGroup.node);
}
@@ -3684,8 +3791,16 @@
@@ -3684,8 +3787,16 @@
// to remove the old selected tab.
if (tabToSelect) {
let leftoverTab = this.selectedTab;
@ -367,7 +363,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
}
if (tabs.length > 1 || !tabs[0].selected) {
@@ -3881,7 +3996,7 @@
@@ -3881,7 +3992,7 @@
// Ensure we have an index if one was not provided.
if (typeof elementIndex != "number" && typeof tabIndex != "number") {
// Move the new tab after another tab if needed, to the end otherwise.
@ -376,7 +372,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
if (
!bulkOrderedOpen &&
((openerTab &&
@@ -3904,7 +4019,7 @@
@@ -3904,7 +4015,7 @@
) {
elementIndex = Infinity;
} else if (previousTab.visible) {
@ -385,7 +381,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
} else if (previousTab == FirefoxViewHandler.tab) {
elementIndex = 0;
}
@@ -3932,14 +4047,14 @@
@@ -3932,10 +4043,10 @@
}
// Ensure index is within bounds.
if (tab.pinned) {
@ -399,12 +395,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
index = Math.min(index, allItems.length);
}
/** @type {MozTabbrowserTab|undefined} */
- let itemAfter = allItems.at(index);
+ let itemAfter = allItems.filter(tab => !tab.hasAttribute("zen-glance-tab")).at(index);
// Prevent a flash of unstyled content by setting up the tab content
// and inherited attributes before appending it (see Bug 1592054):
@@ -3947,7 +4062,7 @@
@@ -3947,7 +4058,7 @@
this.tabContainer._invalidateCachedTabs();
@ -413,7 +404,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
if (this.isTab(itemAfter) && itemAfter.group == tabGroup) {
// Place at the front of, or between tabs in, the same tab group
this.tabContainer.insertBefore(tab, itemAfter);
@@ -4268,6 +4383,9 @@
@@ -4268,6 +4379,9 @@
return;
}
@ -423,7 +414,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
this.removeTabs(selectedTabs, { telemetrySource });
}
@@ -4520,6 +4638,7 @@
@@ -4520,6 +4634,7 @@
telemetrySource,
} = {}
) {
@ -431,7 +422,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
// When 'closeWindowWithLastTab' pref is enabled, closing all tabs
// can be considered equivalent to closing the window.
if (
@@ -4604,6 +4723,7 @@
@@ -4604,6 +4719,7 @@
if (lastToClose) {
this.removeTab(lastToClose, aParams);
}
@ -439,7 +430,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
} catch (e) {
console.error(e);
}
@@ -4641,6 +4761,12 @@
@@ -4641,6 +4757,12 @@
aTab._closeTimeNoAnimTimerId = Glean.browserTabclose.timeNoAnim.start();
}
@ -452,7 +443,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
// Handle requests for synchronously removing an already
// asynchronously closing tab.
if (!animate && aTab.closing) {
@@ -4655,7 +4781,9 @@
@@ -4655,7 +4777,9 @@
// frame created for it (for example, by updating the visually selected
// state).
let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width;
@ -463,7 +454,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
if (
!this._beginRemoveTab(aTab, {
closeWindowFastpath: true,
@@ -4821,7 +4949,7 @@
@@ -4821,7 +4945,7 @@
closeWindowWithLastTab != null
? closeWindowWithLastTab
: !window.toolbar.visible ||
@ -472,7 +463,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
if (closeWindow) {
// We've already called beforeunload on all the relevant tabs if we get here,
@@ -4845,6 +4973,7 @@
@@ -4845,6 +4969,7 @@
newTab = true;
}
@ -480,7 +471,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
aTab._endRemoveArgs = [closeWindow, newTab];
// swapBrowsersAndCloseOther will take care of closing the window without animation.
@@ -4885,9 +5014,7 @@
@@ -4885,9 +5010,7 @@
aTab._mouseleave();
if (newTab) {
@ -491,7 +482,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
} else {
TabBarVisibility.update();
}
@@ -5016,6 +5143,8 @@
@@ -5016,6 +5139,8 @@
this.tabs[i]._tPos = i;
}
@ -500,7 +491,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
if (!this._windowIsClosing) {
if (wasPinned) {
this.tabContainer._positionPinnedTabs();
@@ -5141,8 +5270,8 @@
@@ -5141,8 +5266,8 @@
return closedCount;
}
@ -511,7 +502,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
if (unloadBlocked) {
return;
}
@@ -5230,6 +5359,7 @@
@@ -5230,6 +5355,7 @@
}
let excludeTabs = new Set(aExcludeTabs);
@ -519,7 +510,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
// If this tab has a successor, it should be selectable, since
// hiding or closing a tab removes that tab as a successor.
@@ -5242,13 +5372,13 @@
@@ -5242,13 +5368,13 @@
!excludeTabs.has(aTab.owner) &&
Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose")
) {
@ -535,7 +526,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
);
let tab = this.tabContainer.findNextTab(aTab, {
@@ -5264,7 +5394,7 @@
@@ -5264,7 +5390,7 @@
}
if (tab) {
@ -544,7 +535,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
}
// If no qualifying visible tab was found, see if there is a tab in
@@ -5285,7 +5415,7 @@
@@ -5285,7 +5411,7 @@
});
}
@ -553,7 +544,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
}
_blurTab(aTab) {
@@ -5686,10 +5816,10 @@
@@ -5686,10 +5812,10 @@
SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
}
@ -566,7 +557,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
aTab.selected ||
aTab.closing ||
// Tabs that are sharing the screen, microphone or camera cannot be hidden.
@@ -5986,7 +6116,7 @@
@@ -5986,7 +6112,7 @@
// Don't allow mixing pinned and unpinned tabs.
if (this.isTab(element) && element.pinned) {
@ -575,13 +566,13 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
} else {
tabIndex = Math.max(tabIndex, this.pinnedTabCount);
}
@@ -6012,10 +6142,16 @@
@@ -6012,10 +6138,16 @@
this.#handleTabMove(
element,
() => {
- let neighbor = this.tabs[tabIndex];
- if (forceUngrouped && neighbor?.group) {
+ let neighbor = gZenGlanceManager.getTabOrGlanceParent(this.tabs.filter(tab => !tab.hasAttribute("zen-glance-tab"))[tabIndex]);
+ let neighbor = gZenGlanceManager.getTabOrGlanceParent(this.tabs[tabIndex]);
+ if ((forceUngrouped && neighbor?.group) || neighbor?.group?.hasAttribute("split-view-group")) {
neighbor = neighbor.group;
}
@ -594,7 +585,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
if (neighbor && this.isTab(element) && tabIndex > element._tPos) {
neighbor.after(element);
} else {
@@ -6084,7 +6220,9 @@
@@ -6084,17 +6216,26 @@
targetElement = targetElement.group;
}
}
@ -604,8 +595,12 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
+ }
// Don't allow mixing pinned and unpinned tabs.
if (element.pinned && !targetElement?.pinned) {
targetElement = this.tabs[this.pinnedTabCount - 1];
@@ -6094,7 +6232,14 @@
- targetElement = this.tabs[this.pinnedTabCount - 1];
+ targetElement = this.tabs.filter(tab => !tab.hasAttribute('zen-glance-tab'))[this.pinnedTabCount - 1];
moveBefore = false;
} else if (!element.pinned && targetElement && targetElement.pinned) {
- targetElement = this.tabs[this.pinnedTabCount];
+ targetElement = this.tabs.filter(tab => !tab.hasAttribute('zen-glance-tab'))[this.pinnedTabCount];
moveBefore = true;
}
@ -620,7 +615,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
if (element.pinned && this.tabContainer.verticalMode) {
return this.tabContainer.verticalPinnedTabsContainer;
}
@@ -6154,7 +6299,7 @@
@@ -6154,7 +6295,7 @@
if (!this.isTab(aTab)) {
throw new Error("Can only move a tab into a tab group");
}
@ -629,7 +624,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
return;
}
if (aTab.group && aTab.group.id === aGroup.id) {
@@ -6248,6 +6393,10 @@
@@ -6248,6 +6389,10 @@
moveActionCallback();
@ -640,7 +635,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
// Clear tabs cache after moving nodes because the order of tabs may have
// changed.
this.tabContainer._invalidateCachedTabs();
@@ -7145,7 +7294,7 @@
@@ -7145,7 +7290,7 @@
// preventDefault(). It will still raise the window if appropriate.
break;
}
@ -649,7 +644,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
window.focus();
aEvent.preventDefault();
break;
@@ -8044,6 +8193,7 @@
@@ -8044,6 +8189,7 @@
aWebProgress.isTopLevel
) {
this.mTab.setAttribute("busy", "true");
@ -657,7 +652,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
gBrowser._tabAttrModified(this.mTab, ["busy"]);
this.mTab._notselectedsinceload = !this.mTab.selected;
}
@@ -9009,7 +9159,7 @@ var TabContextMenu = {
@@ -9009,7 +9155,7 @@ var TabContextMenu = {
);
contextUnpinSelectedTabs.hidden =
!this.contextTab.pinned || !this.multiselected;
@ -666,7 +661,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..7e9aa77a5ea59b9002c7ce4b88432247
// Move Tab items
let contextMoveTabOptions = document.getElementById(
"context_moveTabOptions"
@@ -9278,6 +9428,7 @@ var TabContextMenu = {
@@ -9278,6 +9424,7 @@ var TabContextMenu = {
telemetrySource: gBrowser.TabMetrics.METRIC_SOURCE.TAB_STRIP,
});
} else {

View file

@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js
index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bcdc076dfc 100644
index 84d633471c89230b981d8a07babef4e0c76c0338..1a9c56846ff27d68c16b939fb759ea9596403cef 100644
--- a/browser/components/tabbrowser/content/tabs.js
+++ b/browser/components/tabbrowser/content/tabs.js
@@ -83,7 +83,7 @@
@ -33,7 +33,7 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
// In expanded vertical mode, the max number of pinned tabs per row is dynamic
// Set this before adjusting dragged tab's position
- let pinnedTabs = this.visibleTabs.slice(0, gBrowser.pinnedTabCount);
+ let pinnedTabs = this.visibleTabs.filter(tab => !tab.hasAttribute("zen-glance-tab")).slice(0, gBrowser._numZenEssentials);
+ let pinnedTabs = this.ariaFocusableItems.slice(0, gBrowser._numZenEssentials);
let tabsPerRow = 0;
let position = 0;
for (let pinnedTab of pinnedTabs) {
@ -81,12 +81,11 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
} else {
let isPinned = draggedTab.pinned;
- let numPinned = gBrowser.pinnedTabCount;
- let tabs = this.ariaFocusableItems.slice(
- isPinned ? 0 : numPinned,
- isPinned ? numPinned : undefined
+ let numPinned = gBrowser._numVisiblePinTabsWithoutCollapsed;
+ let essential = draggedTab.hasAttribute("zen-essential");
+ let tabs = this.ariaFocusableItems.filter(tab => !tab.hasAttribute("zen-glance-tab")).slice(
let tabs = this.ariaFocusableItems.slice(
- isPinned ? 0 : numPinned,
- isPinned ? numPinned : undefined
+ isPinned ? (essential ? 0 : gBrowser._numZenEssentials) : numPinned,
+ isPinned ? (essential ? gBrowser._numZenEssentials : numPinned) : undefined
);
@ -136,7 +135,7 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
}
get verticalMode() {
@@ -1621,29 +1651,55 @@
@@ -1621,29 +1651,54 @@
if (this.#allTabs) {
return this.#allTabs;
}
@ -174,14 +173,13 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
];
+ const lastPinnedTabIdx = pinnedTabs.length - 1;
+ let i = 0;
+ for (const tab of allTabs) {
+ for (const tab of [...allTabs]) {
+ // add glance tabs (tabs inside tabs) to the list
+ const glanceTab = tab.glanceTab;
+ if (glanceTab) {
+ // insert right after the parent tab. note: it must be inserted before
+ // the last pinned tab so it can be inserted in the correct order
+ allTabs.splice(Math.max(i + 1, lastPinnedTabIdx), 0, glanceTab);
+ i++;
+ allTabs.splice(Math.max(i++, lastPinnedTabIdx), 0, glanceTab);
+ } else if (tab.classList.contains("vertical-pinned-tabs-container-separator")) {
+ // remove the separator from the list
+ allTabs.splice(i, 1);
@ -200,16 +198,7 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
}
/**
@@ -1663,7 +1719,7 @@
*/
get visibleTabs() {
if (!this.#visibleTabs) {
- this.#visibleTabs = this.openTabs.filter(tab => tab.visible);
+ this.#visibleTabs = this.openTabs.filter(tab => tab.visible && !tab.hasAttribute("zen-empty-tab"));
}
return this.#visibleTabs;
}
@@ -1698,36 +1754,40 @@
@@ -1698,23 +1753,18 @@
}
let elementIndex = 0;
@ -237,21 +226,7 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
let visibleTabsInGroup = child.tabs.filter(tab => tab.visible);
visibleTabsInGroup.forEach(tab => {
tab.elementIndex = elementIndex++;
});
focusableItems.push(...visibleTabsInGroup);
}
+ for (let tab of child.tabs) {
+ let glanceTab = tab.glanceTab;
+ if (isTab(glanceTab)) {
+ glanceTab.elementIndex = elementIndex - 1;
+ focusableItems.push(glanceTab);
+ }
+ }
+ }
+ let glanceTab = child.glanceTab;
+ if (isTab(child) && glanceTab) {
+ glanceTab.elementIndex = elementIndex - 1;
+ focusableItems.push(glanceTab);
@@ -1724,10 +1774,7 @@
}
}
@ -263,7 +238,7 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
return this.#focusableItems;
}
@@ -1735,6 +1795,7 @@
@@ -1735,6 +1782,7 @@
_invalidateCachedTabs() {
this.#allTabs = null;
this._invalidateCachedVisibleTabs();
@ -271,7 +246,7 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
}
_invalidateCachedVisibleTabs() {
@@ -1749,8 +1810,8 @@
@@ -1749,8 +1797,8 @@
#isContainerVerticalPinnedGrid(tab) {
return (
this.verticalMode &&
@ -282,7 +257,7 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
!this.expandOnHover
);
}
@@ -1766,7 +1827,7 @@
@@ -1766,7 +1814,7 @@
if (node == null) {
// We have a container for non-tab elements at the end of the scrollbox.
@ -291,7 +266,7 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
}
node.before(tab);
@@ -1861,7 +1922,7 @@
@@ -1861,7 +1909,7 @@
// There are separate "new tab" buttons for horizontal tabs toolbar, vertical tabs and
// for when the tab strip is overflowed (which is shared by vertical and horizontal tabs);
// Attach the long click popup to all of them.
@ -300,7 +275,7 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
const newTab2 = this.newTabButton;
const newTabVertical = document.getElementById(
"vertical-tabs-newtab-button"
@@ -1956,10 +2017,12 @@
@@ -1956,10 +2004,12 @@
_handleTabSelect(aInstant) {
let selectedTab = this.selectedItem;
@ -313,68 +288,24 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
selectedTab._notselectedsinceload = false;
}
@@ -2100,16 +2163,15 @@
// Move pinned tabs to another container when the tabstrip is toggled to vertical
// and when session restore code calls _positionPinnedTabs; update styling whenever
// the number of pinned tabs changes.
- let verticalTabsContainer = document.getElementById(
- "vertical-pinned-tabs-container"
- );
+ let verticalTabsContainer = this.verticalPinnedTabsContainer;
let numPinned = gBrowser.pinnedTabCount;
-
- if (gBrowser.pinnedTabCount !== verticalTabsContainer.children.length) {
- let tabs = this.visibleTabs;
+ if (!gZenWorkspaces._hasInitializedTabsStrip) return;
+ let count = gZenWorkspaces.makeSurePinTabIsInCorrectPosition();
+ if (gBrowser.pinnedTabCount !== (verticalTabsContainer.children.length - count - 1 + gZenWorkspaces.getCurrentEssentialsContainer().children.length)) {
+ let tabs = this.allTabs.filter(tab => !tab.hasAttribute("zen-glance-tab"));
for (let i = 0; i < numPinned; i++) {
tabs[i].style.marginInlineStart = "";
- verticalTabsContainer.appendChild(tabs[i]);
+ tabs[i].hasAttribute("zen-essential") ? gZenWorkspaces.getCurrentEssentialsContainer().appendChild(tabs[i].group?.hasAttribute("split-view-group") ? tabs[i].group : tabs[i]) : verticalTabsContainer.insertBefore(tabs[i].group?.hasAttribute("split-view-group") ? tabs[i].group : tabs[i], verticalTabsContainer.lastChild);
}
}
@@ -2117,9 +2179,7 @@
}
_resetVerticalPinnedTabs() {
- let verticalTabsContainer = document.getElementById(
- "vertical-pinned-tabs-container"
- );
+ let verticalTabsContainer = this.verticalPinnedTabsContainer;
if (!verticalTabsContainer.children.length) {
return;
@@ -2132,7 +2192,7 @@
@@ -2132,6 +2182,7 @@
}
_positionPinnedTabs() {
- let tabs = this.visibleTabs;
+ let tabs = this.visibleTabs.filter(tab => !tab.hasAttribute("zen-glance-tab"));
+ if (true) return;
let tabs = this.visibleTabs;
let numPinned = gBrowser.pinnedTabCount;
let absPositionHorizontalTabs =
this.overflowing && tabs.length > numPinned && numPinned > 0;
@@ -2142,7 +2202,7 @@
if (this.verticalMode) {
this._updateVerticalPinnedTabs();
- } else if (absPositionHorizontalTabs) {
+ } else if (absPositionHorizontalTabs && false) {
let layoutData = this._pinnedTabsLayoutCache;
let uiDensity = document.documentElement.getAttribute("uidensity");
if (!layoutData || layoutData.uiDensity != uiDensity) {
@@ -2206,7 +2266,7 @@
@@ -2206,7 +2257,7 @@
return;
}
- let tabs = this.visibleTabs.slice(0, gBrowser.pinnedTabCount);
+ let tabs = this.visibleTabs.filter(tab => !tab.hasAttribute("zen-glance-tab")).slice(0, gBrowser._numZenEssentials);
+ let tabs = this.ariaFocusableItems.slice(0, gBrowser._numZenEssentials);
let directionX = screenX > dragData.animLastScreenX;
let directionY = screenY > dragData.animLastScreenY;
@@ -2214,7 +2274,7 @@
@@ -2214,7 +2265,7 @@
dragData.animLastScreenX = screenX;
let { width: tabWidth, height: tabHeight } =
@ -383,28 +314,18 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
let shiftSizeX = tabWidth * movingTabs.length;
let shiftSizeY = tabHeight;
dragData.tabWidth = tabWidth;
@@ -2277,7 +2337,7 @@
// * We're doing a binary search in order to reduce the amount of
// tabs we need to check.
- tabs = tabs.filter(t => !movingTabs.includes(t) || t == draggedTab);
+ tabs = tabs.filter(t => !movingTabs.includes(t) || t == draggedTab && !t.hasAttribute("zen-glance-tab"));
let firstTabCenterX = firstMovingTabScreenX + translateX + tabWidth / 2;
let lastTabCenterX = lastMovingTabScreenX + translateX + tabWidth / 2;
let tabCenterX = directionX ? lastTabCenterX : firstTabCenterX;
@@ -2389,12 +2449,16 @@
@@ -2389,12 +2440,16 @@
this.#clearDragOverCreateGroupTimer();
- let isPinned = draggedTab.pinned;
- let numPinned = gBrowser.pinnedTabCount;
- let tabs = this.ariaFocusableItems.slice(
- isPinned ? 0 : numPinned,
- isPinned ? numPinned : undefined
+ let isPinned = draggedTab?.group ? draggedTab.group.pinned : draggedTab.pinned;
+ let numPinned = gBrowser._numVisiblePinTabsWithoutCollapsed;
+ let essential = draggedTab.hasAttribute("zen-essential");
+ let tabs = this.ariaFocusableItems.filter(tab => !tab.hasAttribute("zen-glance-tab")).slice(
let tabs = this.ariaFocusableItems.slice(
- isPinned ? 0 : numPinned,
- isPinned ? numPinned : undefined
+ isPinned ? (essential ? 0 : gBrowser._numZenEssentials) : numPinned,
+ isPinned ? (essential ? gBrowser._numZenEssentials : numPinned) : undefined
);
@ -414,7 +335,7 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
if (this.#rtlMode) {
tabs.reverse();
@@ -2408,7 +2472,7 @@
@@ -2408,7 +2463,7 @@
let size = this.verticalMode ? "height" : "width";
let translateAxis = this.verticalMode ? "translateY" : "translateX";
let scrollDirection = this.verticalMode ? "scrollTop" : "scrollLeft";
@ -423,7 +344,7 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
let translateX = event.screenX - dragData.screenX;
let translateY = event.screenY - dragData.screenY;
@@ -2422,12 +2486,21 @@
@@ -2422,12 +2477,21 @@
let lastTab = tabs.at(-1);
let lastMovingTab = movingTabs.at(-1);
let firstMovingTab = movingTabs[0];
@ -446,7 +367,7 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
translate +=
this.arrowScrollbox.scrollbox[scrollDirection] - dragData.scrollPos;
} else if (isPinned && this.verticalMode) {
@@ -2446,12 +2519,15 @@
@@ -2446,6 +2510,9 @@
// Shift the `.tab-group-label-container` to shift the label element.
item = item.parentElement;
}
@ -456,14 +377,7 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
item.style.transform = `${translateAxis}(${translate}px)`;
}
dragData.translatePos = translate;
- tabs = tabs.filter(t => !movingTabs.includes(t) || t == draggedTab);
+ tabs = tabs.filter(t => !movingTabs.includes(t) || t == draggedTab && !t.hasAttribute("zen-glance-tab"));
/**
* When the `draggedTab` is just starting to move, the `draggedTab` is in
@@ -2583,6 +2659,9 @@
@@ -2583,6 +2650,9 @@
break;
}
let element = tabs[mid];
@ -473,20 +387,18 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
let elementForSize = isTabGroupLabel(element)
? element.parentElement
: element;
@@ -2603,7 +2682,11 @@
let dropElement = getOverlappedElement();
@@ -2605,6 +2675,10 @@
if (!dropElement) {
- dropElement = this.ariaFocusableItems[oldDropElementIndex];
+ dropElement = this.ariaFocusableItems.filter(tab => !tab.hasAttribute("zen-glance-tab"))[oldDropElementIndex];
+ }
dropElement = this.ariaFocusableItems[oldDropElementIndex];
}
+ if (dropElement?.group?.hasAttribute("split-view-group")) {
+ // We focus the group label element, not the group itself.
+ dropElement = dropElement.group.labelElement;
}
+ }
let newDropElementIndex = dropElement
? dropElement.elementIndex
@@ -2613,7 +2696,7 @@
: oldDropElementIndex;
@@ -2613,7 +2687,7 @@
let shouldCreateGroupOnDrop;
let dropBefore;
if (dropElement) {
@ -495,7 +407,7 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
? dropElement.parentElement
: dropElement;
@@ -2675,12 +2758,12 @@
@@ -2675,12 +2749,12 @@
}
}
@ -510,7 +422,7 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
dropElement != draggedTab &&
isTab(dropElement) &&
!dropElement?.group &&
@@ -2750,7 +2833,7 @@
@@ -2750,7 +2824,7 @@
// Shift background tabs to leave a gap where the dragged tab
// would currently be dropped.
for (let item of tabs) {
@ -519,7 +431,7 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
continue;
}
@@ -2759,6 +2842,9 @@
@@ -2759,6 +2833,9 @@
if (isTabGroupLabel(item)) {
// Shift the `.tab-group-label-container` to shift the label element.
item = item.parentElement;
@ -529,7 +441,7 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
}
item.style.transform = transform;
}
@@ -2811,8 +2897,9 @@
@@ -2811,8 +2888,9 @@
);
}
@ -541,7 +453,7 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
return;
}
@@ -2824,6 +2911,12 @@
@@ -2824,6 +2902,12 @@
item = item.parentElement;
}
item.style.transform = "";
@ -554,7 +466,7 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
item.removeAttribute("dragover-createGroup");
}
this.removeAttribute("movingtab-createGroup");
@@ -2870,7 +2963,7 @@
@@ -2870,7 +2954,7 @@
let postTransitionCleanup = () => {
movingTab._moveTogetherSelectedTabsData.animate = false;
};
@ -563,7 +475,7 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
postTransitionCleanup();
} else {
let onTransitionEnd = transitionendEvent => {
@@ -3043,7 +3136,7 @@
@@ -3043,7 +3127,7 @@
}
_notifyBackgroundTab(aTab) {
@ -572,7 +484,7 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..13d1191438daa4e213c0ffd1fffca4bc
return;
}
@@ -3169,6 +3262,9 @@
@@ -3169,6 +3253,9 @@
return null;
}
}

View file

@ -1,5 +1,5 @@
diff --git a/browser/themes/shared/tabbrowser/tabs.css b/browser/themes/shared/tabbrowser/tabs.css
index 5b9ad123d819c6ef068acd427416957a1d0939fe..ab4cc6b8ea05bceaed6f62ab6570f0c12214f459 100644
index 5b9ad123d819c6ef068acd427416957a1d0939fe..311caa27ee268c95215d459be02a93d20e129f8b 100644
--- a/browser/themes/shared/tabbrowser/tabs.css
+++ b/browser/themes/shared/tabbrowser/tabs.css
@@ -33,7 +33,7 @@
@ -37,7 +37,7 @@ index 5b9ad123d819c6ef068acd427416957a1d0939fe..ab4cc6b8ea05bceaed6f62ab6570f0c1
&::before {
position: absolute;
@@ -459,6 +458,7 @@
@@ -459,14 +458,11 @@
.tab-icon-image {
-moz-context-properties: fill, stroke;
fill: currentColor;
@ -45,7 +45,26 @@ index 5b9ad123d819c6ef068acd427416957a1d0939fe..ab4cc6b8ea05bceaed6f62ab6570f0c1
/* stylelint-disable-next-line media-query-no-invalid */
@media -moz-pref("browser.tabs.fadeOutUnloadedTabs") {
@@ -559,7 +559,7 @@
&[pending] {
- filter: grayscale(100%);
- @media (prefers-color-scheme: dark) {
- filter: grayscale(100%) invert();
- }
opacity: 0.5;
/* Fade the favicon out */
transition-property: filter, opacity;
@@ -483,10 +479,6 @@
/* stylelint-disable-next-line media-query-no-invalid */
@media -moz-pref("browser.tabs.fadeOutExplicitlyUnloadedTabs") {
&[pending][discarded] {
- filter: grayscale(100%);
- @media (prefers-color-scheme: dark) {
- filter: grayscale(100%) invert();
- }
opacity: 0.5;
/* Fade the favicon out */
transition-property: filter, opacity;
@@ -559,7 +551,7 @@
z-index: 1; /* Overlay tab title */
#tabbrowser-tabs[orient=vertical] & {
@ -54,7 +73,7 @@ index 5b9ad123d819c6ef068acd427416957a1d0939fe..ab4cc6b8ea05bceaed6f62ab6570f0c1
}
&[crashed] {
@@ -567,7 +567,7 @@
@@ -567,7 +559,7 @@
}
#tabbrowser-tabs[orient="vertical"]:not([expanded]) &:not([crashed]),
@ -63,7 +82,7 @@ index 5b9ad123d819c6ef068acd427416957a1d0939fe..ab4cc6b8ea05bceaed6f62ab6570f0c1
&[soundplaying] {
list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio-playing-small.svg");
}
@@ -597,7 +597,7 @@
@@ -597,7 +589,7 @@
background-image: linear-gradient(var(--audio-overlay-extra-background)),
linear-gradient(var(--toolbox-bgcolor));
-moz-context-properties: fill;
@ -72,7 +91,7 @@ index 5b9ad123d819c6ef068acd427416957a1d0939fe..ab4cc6b8ea05bceaed6f62ab6570f0c1
color-scheme: var(--tab-selected-color-scheme);
border-radius: var(--border-radius-circle);
@@ -1365,7 +1365,7 @@ tab-group {
@@ -1365,7 +1357,7 @@ tab-group {
}
}
@ -81,7 +100,7 @@ index 5b9ad123d819c6ef068acd427416957a1d0939fe..ab4cc6b8ea05bceaed6f62ab6570f0c1
#vertical-tabs-newtab-button {
appearance: none;
min-height: var(--tab-min-height);
@@ -1376,7 +1376,7 @@ tab-group {
@@ -1376,7 +1368,7 @@ tab-group {
margin-inline: var(--tab-inner-inline-margin);
#tabbrowser-tabs[orient="vertical"]:not([expanded]) & > .toolbarbutton-text {
@ -90,7 +109,7 @@ index 5b9ad123d819c6ef068acd427416957a1d0939fe..ab4cc6b8ea05bceaed6f62ab6570f0c1
}
&:hover {
@@ -1400,7 +1400,7 @@ tab-group {
@@ -1400,7 +1392,7 @@ tab-group {
* flex container. #tabs-newtab-button is a child of the arrowscrollbox where
* we don't want a gap (between tabs), so we have to add some margin.
*/
@ -99,7 +118,7 @@ index 5b9ad123d819c6ef068acd427416957a1d0939fe..ab4cc6b8ea05bceaed6f62ab6570f0c1
margin-block: var(--tab-block-margin);
}
@@ -1474,8 +1474,6 @@ tab-group {
@@ -1474,8 +1466,6 @@ tab-group {
}
:root:not([sidebar-expand-on-hover]) & {
@ -108,7 +127,7 @@ index 5b9ad123d819c6ef068acd427416957a1d0939fe..ab4cc6b8ea05bceaed6f62ab6570f0c1
/* stylelint-disable-next-line media-query-no-invalid */
@media not -moz-pref("sidebar.visibility", "expand-on-hover") {
/* We need these rules to apply at all times when the sidebar.visibility
@@ -1585,7 +1583,6 @@ tab-group {
@@ -1585,7 +1575,6 @@ tab-group {
&:not([expanded]) {
.tabbrowser-tab[pinned] {
@ -116,7 +135,7 @@ index 5b9ad123d819c6ef068acd427416957a1d0939fe..ab4cc6b8ea05bceaed6f62ab6570f0c1
}
.tab-background {
@@ -1716,7 +1713,7 @@ tab-group {
@@ -1716,7 +1705,7 @@ tab-group {
toolbarbutton:not(#firefox-view-button),
toolbarpaletteitem:not(#wrapper-firefox-view-button)
) ~ #tabbrowser-tabs {
@ -125,7 +144,7 @@ index 5b9ad123d819c6ef068acd427416957a1d0939fe..ab4cc6b8ea05bceaed6f62ab6570f0c1
padding-inline-start: calc(var(--tab-overflow-pinned-tabs-width) + 2px);
margin-inline-start: 2px;
}
@@ -1750,7 +1747,6 @@ toolbar:not(#TabsToolbar) #firefox-view-button {
@@ -1750,7 +1739,6 @@ toolbar:not(#TabsToolbar) #firefox-view-button {
list-style-image: url(chrome://global/skin/icons/plus.svg);
}

View file

@ -83,17 +83,12 @@
}
}
getTabPosition(tab) {
return tab._tPos;
}
createBrowserElement(url, currentTab, existingTab = null) {
const newTabOptions = {
userContextId: currentTab.getAttribute('usercontextid') || '',
skipBackgroundNotify: true,
insertTab: true,
skipLoad: false,
index: this.getTabPosition(currentTab) + 1,
};
currentTab._selected = true;
const newUUID = gZenUIManager.generateUuidv4();
@ -294,9 +289,7 @@
this.closingGlance = true;
this._animating = true;
gBrowser.zenInsertTabAtIndex(this.#currentTab, {
tabIndex: this.getTabPosition(this.#currentParentTab),
});
gBrowser.moveTabAfter(this.#currentTab, this.#currentParentTab);
let quikcCloseZen = false;
if (onTabClose) {
@ -629,9 +622,7 @@
this.animatingFullOpen = true;
this.#currentTab.setAttribute('zen-dont-split-glance', true);
gBrowser.zenInsertTabAtIndex(this.#currentTab, {
tabIndex: this.getTabPosition(this.#currentTab),
});
gBrowser.moveTabAfter(this.#currentTab, this.#currentParentTab);
this.#currentTab.removeAttribute('zen-glance-tab');
this._clearContainerStyles(this.browserWrapper);

View file

@ -6,3 +6,5 @@ support-files = [
["browser_glance_basic.js"]
["browser_glance_expand.js"]
["browser_glance_close.js"]
["browser_glance_next_tab.js"]
["browser_glance_prev_tab.js"]

View file

@ -62,8 +62,8 @@ add_task(async function test_Glance_Basic_Open() {
await openGlanceOnTab(async (glanceTab) => {
await gZenGlanceManager.fullyOpenGlance();
Assert.equal(
glanceTab._tPos,
3,
glanceTab,
gBrowser.visibleTabs.find((tab) => !tab.pinned),
'The glance tab should be the first normal tab (Ignoring empty tabs)'
);
BrowserTestUtils.removeTab(glanceTab);
@ -84,13 +84,8 @@ add_task(async function test_Glance_New_From_essential() {
skipAnimation: true,
});
Assert.equal(
gBrowser.selectedTab._tPos,
1,
'The new tab should be the first normal tab (Ignoring empty tabs)'
);
Assert.equal(
glanceTab._tPos,
2,
glanceTab,
gBrowser.visibleTabs[2],
'The glance tab should be the second normal tab (Ignoring empty tabs)'
);
await BrowserTestUtils.removeTab(gBrowser.selectedTab);

View file

@ -0,0 +1,22 @@
/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
'use strict';
add_task(async function test_Glance_Next_Tab() {
const selectedTab = gBrowser.selectedTab;
await BrowserTestUtils.openNewForegroundTab(window.gBrowser, 'https://example.com/', true, {
skipAnimation: true,
});
const tabToCheck = gBrowser.selectedTab;
gBrowser.selectedTab = selectedTab;
await openGlanceOnTab(async (glanceTab) => {
const next = gBrowser.tabContainer.findNextTab(glanceTab, { direction: 1 });
Assert.equal(
next,
tabToCheck,
'The glance tab should be the second normal tab (Ignoring empty tabs)'
);
});
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
});

View file

@ -0,0 +1,21 @@
/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
'use strict';
add_task(async function test_Glance_Next_Tab() {
await BrowserTestUtils.withNewTab({ gBrowser, url: 'https://example.com/' }, async (browser) => {
const tabToCheck = gBrowser.selectedTab;
await openGlanceOnTab(async (glanceTab) => {
await BrowserTestUtils.openNewForegroundTab(window.gBrowser, 'https://example.com/', true, {
skipAnimation: true,
});
const next = gBrowser.tabContainer.findNextTab(glanceTab, { direction: -1 });
Assert.equal(
next,
tabToCheck,
'The glance tab should be the second normal tab (Ignoring empty tabs)'
);
});
});
});

View file

@ -2766,41 +2766,6 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
}
}
makeSurePinTabIsInCorrectPosition() {
if (!this.pinnedTabsContainer) {
return 0; // until we initialize the pinned tabs container
}
const tabsInsidePinTab = Array.from(this.pinnedTabsContainer.parentElement.children).filter(
(child) => child.tagName === 'tab'
);
let changed = false;
for (const tab of tabsInsidePinTab) {
if (tab.getAttribute('zen-glance-tab') === 'true') {
continue;
}
if (tab.getAttribute('zen-essential') === 'true') {
const container = this.getCurrentEssentialsContainer();
container.appendChild(tab);
changed = true;
continue;
}
const workspaceId = tab.getAttribute('zen-workspace-id');
if (!workspaceId) {
continue;
}
const contaienr = this.workspaceElement(workspaceId).pinnedTabsContainer;
contaienr.insertBefore(tab, contaienr.lastChild);
changed = true;
}
if (changed) {
gBrowser.tabContainer._invalidateCachedTabs();
}
// Return the number of essentials INSIDE the pinned tabs container so we can correctly change their parent
return Array.from(this.pinnedTabsContainer.children).filter(
(child) => child.getAttribute('zen-essential') === 'true'
).length;
}
// Context menu management
_contextMenuId = null;