1
0
Fork 1
mirror of https://github.com/zen-browser/desktop.git synced 2025-07-10 06:45:29 +02:00

chore: Update patches, b=(no-bug), c=no-component

This commit is contained in:
Mr. M 2025-06-02 11:28:34 +02:00
parent 2a64d867cc
commit c823adb259
No known key found for this signature in database
GPG key ID: 6292C4C8F8652B18
2 changed files with 86 additions and 75 deletions

View file

@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c209d70f44 100644
index d5aa64842a35c6697263c63fd3a0571b64b01344..e6dd6f42cb2bb1fc8957ea3c4bfe87d6538a1f24 100644
--- a/browser/components/tabbrowser/content/tabbrowser.js
+++ b/browser/components/tabbrowser/content/tabbrowser.js
@@ -413,11 +413,41 @@
@ -9,7 +9,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
+ get _numVisiblePinTabsWithoutCollapsed() {
+ let i = 0;
+ for (let item of this.tabContainer.ariaFocusableItems) {
+ if (!!item?.classList?.contains("tab-group-label") && item.closest("tab-folder")) {
+ if (!!item?.classList?.contains("tab-group-label") && item.closest("tab-folder").pinned) {
+ i += 1;
+ continue;
+ }
@ -182,15 +182,16 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
} else {
aTab.linkedBrowser.browsingContext.hasSiblings = this.tabs.length > 1;
}
@@ -2680,6 +2726,7 @@
@@ -2680,6 +2726,8 @@
schemelessInput,
hasValidUserGestureActivation = false,
textDirectiveUserActivation = false,
+ _forZenEmptyTab,
+ essential,
} = {}
) {
// all callers of addTab that pass a params object need to pass
@@ -2690,6 +2737,12 @@
@@ -2690,6 +2738,12 @@
);
}
@ -203,7 +204,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
if (!UserInteraction.running("browser.tabs.opening", window)) {
UserInteraction.start("browser.tabs.opening", "initting", window);
}
@@ -2753,6 +2806,16 @@
@@ -2753,6 +2807,19 @@
noInitialLabel,
skipBackgroundNotify,
});
@ -216,11 +217,22 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
+ }
+ if (_forZenEmptyTab) {
+ t.setAttribute("zen-empty-tab", "true");
+ }
+ if (essential) {
+ t.setAttribute("zen-essential", "true");
+ }
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 +2846,7 @@
@@ -2765,6 +2832,7 @@
ownerTab,
openerTab,
pinned,
+ essential,
bulkOrderedOpen,
tabGroup: tabGroup ?? openerTab?.group,
});
@@ -2783,6 +2851,7 @@
openWindowInfo,
skipLoad,
triggeringRemoteType,
@ -228,7 +240,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
}));
if (focusUrlBar) {
@@ -2902,6 +2966,12 @@
@@ -2902,6 +2971,12 @@
}
}
@ -241,7 +253,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
// Additionally send pinned tab events
if (pinned) {
this._notifyPinnedStatus(t);
@@ -2990,10 +3060,10 @@
@@ -2990,10 +3065,10 @@
isAdoptingGroup = false,
isUserTriggered = false,
telemetryUserCreateSource = "unknown",
@ -253,7 +265,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
}
if (!color) {
@@ -3014,7 +3084,12 @@
@@ -3014,7 +3089,12 @@
label,
isAdoptingGroup
);
@ -267,7 +279,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
group,
insertBefore?.group ?? insertBefore
);
@@ -3303,6 +3378,7 @@
@@ -3303,6 +3383,7 @@
openWindowInfo,
skipLoad,
triggeringRemoteType,
@ -275,7 +287,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
}
) {
// If we don't have a preferred remote type (or it is `NOT_REMOTE`), and
@@ -3372,6 +3448,7 @@
@@ -3372,6 +3453,7 @@
openWindowInfo,
name,
skipLoad,
@ -283,7 +295,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
});
}
@@ -3560,7 +3637,7 @@
@@ -3560,7 +3642,7 @@
// Add a new tab if needed.
if (!tab) {
let createLazyBrowser =
@ -292,37 +304,17 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
let url = "about:blank";
if (tabData.entries?.length) {
@@ -3598,7 +3675,29 @@
@@ -3598,7 +3680,8 @@
skipLoad: true,
preferredRemoteType,
});
-
+ tab._originalUrl = url;
+ if (tabData.zenWorkspace) {
+ tab.setAttribute("zen-workspace-id", tabData.zenWorkspace);
+ }
+ if (tabData.zenPinnedId) {
+ tab.setAttribute("zen-pin-id", tabData.zenPinnedId);
+ }
+ if (tabData.zenIsEmpty) {
+ tab.setAttribute("zen-empty-tab", "true");
+ }
+ if (tabData.zenHasStaticLabel) {
+ tab.setAttribute("zen-has-static-label", "true");
+ }
+ if (tabData.zenEssential) {
+ tab.setAttribute("zen-essential", "true");
+ }
+ if (tabData.zenDefaultUserContextId) {
+ tab.setAttribute("zenDefaultUserContextId", "true");
+ }
+ if (tabData.zenPinnedEntry) {
+ tab.setAttribute("zen-pinned-entry", tabData.zenPinnedEntry);
+ }
+ gZenSessionStore.restoreInitialTabData(tab, tabData);
if (select) {
tabToSelect = tab;
}
@@ -3622,7 +3721,8 @@
@@ -3622,7 +3705,8 @@
// needs calling:
shouldUpdateForPinnedTabs = true;
}
@ -332,7 +324,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
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 +3736,10 @@
@@ -3636,7 +3720,10 @@
tabGroup.stateData.id,
tabGroup.stateData.color,
tabGroup.stateData.collapsed,
@ -344,7 +336,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
);
tabsFragment.appendChild(tabGroup.node);
}
@@ -3684,8 +3787,16 @@
@@ -3684,8 +3771,16 @@
// to remove the old selected tab.
if (tabToSelect) {
let leftoverTab = this.selectedTab;
@ -363,7 +355,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
}
if (tabs.length > 1 || !tabs[0].selected) {
@@ -3881,7 +3992,7 @@
@@ -3881,7 +3976,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.
@ -372,16 +364,16 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
if (
!bulkOrderedOpen &&
((openerTab &&
@@ -3904,7 +4015,7 @@
@@ -3904,7 +3999,7 @@
) {
elementIndex = Infinity;
} else if (previousTab.visible) {
- elementIndex = previousTab.elementIndex + 1;
+ elementIndex = (typeof previousTab.elementIndex === 'undefined') ? index : (previousTab.elementIndex + 1);
+ elementIndex = (typeof previousTab.elementIndex === 'undefined') ? elementIndex : (previousTab.elementIndex + 1);
} else if (previousTab == FirefoxViewHandler.tab) {
elementIndex = 0;
}
@@ -3932,10 +4043,10 @@
@@ -3932,14 +4027,14 @@
}
// Ensure index is within bounds.
if (tab.pinned) {
@ -395,7 +387,12 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
index = Math.min(index, allItems.length);
}
/** @type {MozTabbrowserTab|undefined} */
@@ -3947,7 +4058,7 @@
- let itemAfter = allItems.at(index);
+ let itemAfter = gZenGlanceManager.getTabOrGlanceParent(allItems.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 +4042,7 @@
this.tabContainer._invalidateCachedTabs();
@ -404,7 +401,15 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
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 +4379,9 @@
@@ -3980,6 +4075,7 @@
if (pinned) {
this._updateTabBarForPinnedTabs();
}
+ gZenWorkspaces.fixTabInsertLocation(tab, itemAfter);
TabBarVisibility.update();
}
@@ -4268,6 +4364,9 @@
return;
}
@ -414,7 +419,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
this.removeTabs(selectedTabs, { telemetrySource });
}
@@ -4520,6 +4634,7 @@
@@ -4520,6 +4619,7 @@
telemetrySource,
} = {}
) {
@ -422,7 +427,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
// When 'closeWindowWithLastTab' pref is enabled, closing all tabs
// can be considered equivalent to closing the window.
if (
@@ -4604,6 +4719,7 @@
@@ -4604,6 +4704,7 @@
if (lastToClose) {
this.removeTab(lastToClose, aParams);
}
@ -430,7 +435,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
} catch (e) {
console.error(e);
}
@@ -4641,6 +4757,12 @@
@@ -4641,6 +4742,12 @@
aTab._closeTimeNoAnimTimerId = Glean.browserTabclose.timeNoAnim.start();
}
@ -443,7 +448,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
// Handle requests for synchronously removing an already
// asynchronously closing tab.
if (!animate && aTab.closing) {
@@ -4655,7 +4777,9 @@
@@ -4655,7 +4762,9 @@
// frame created for it (for example, by updating the visually selected
// state).
let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width;
@ -454,7 +459,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
if (
!this._beginRemoveTab(aTab, {
closeWindowFastpath: true,
@@ -4821,7 +4945,7 @@
@@ -4821,7 +4930,7 @@
closeWindowWithLastTab != null
? closeWindowWithLastTab
: !window.toolbar.visible ||
@ -463,7 +468,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
if (closeWindow) {
// We've already called beforeunload on all the relevant tabs if we get here,
@@ -4845,6 +4969,7 @@
@@ -4845,6 +4954,7 @@
newTab = true;
}
@ -471,7 +476,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
aTab._endRemoveArgs = [closeWindow, newTab];
// swapBrowsersAndCloseOther will take care of closing the window without animation.
@@ -4885,9 +5010,7 @@
@@ -4885,9 +4995,7 @@
aTab._mouseleave();
if (newTab) {
@ -482,7 +487,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
} else {
TabBarVisibility.update();
}
@@ -5016,6 +5139,8 @@
@@ -5016,6 +5124,8 @@
this.tabs[i]._tPos = i;
}
@ -491,7 +496,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
if (!this._windowIsClosing) {
if (wasPinned) {
this.tabContainer._positionPinnedTabs();
@@ -5230,6 +5355,7 @@
@@ -5230,6 +5340,7 @@
}
let excludeTabs = new Set(aExcludeTabs);
@ -499,7 +504,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
// If this tab has a successor, it should be selectable, since
// hiding or closing a tab removes that tab as a successor.
@@ -5242,13 +5368,13 @@
@@ -5242,13 +5353,13 @@
!excludeTabs.has(aTab.owner) &&
Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose")
) {
@ -515,7 +520,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
);
let tab = this.tabContainer.findNextTab(aTab, {
@@ -5264,7 +5390,7 @@
@@ -5264,7 +5375,7 @@
}
if (tab) {
@ -524,7 +529,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
}
// If no qualifying visible tab was found, see if there is a tab in
@@ -5285,7 +5411,7 @@
@@ -5285,7 +5396,7 @@
});
}
@ -533,7 +538,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
}
_blurTab(aTab) {
@@ -5686,10 +5812,10 @@
@@ -5686,10 +5797,10 @@
SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
}
@ -546,7 +551,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
aTab.selected ||
aTab.closing ||
// Tabs that are sharing the screen, microphone or camera cannot be hidden.
@@ -5909,7 +6035,7 @@
@@ -5909,7 +6020,7 @@
* `true` if element is a `<tab-group>`
*/
isTabGroup(element) {
@ -555,7 +560,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
}
/**
@@ -5986,7 +6112,7 @@
@@ -5986,7 +6097,7 @@
// Don't allow mixing pinned and unpinned tabs.
if (this.isTab(element) && element.pinned) {
@ -564,7 +569,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
} else {
tabIndex = Math.max(tabIndex, this.pinnedTabCount);
}
@@ -6012,10 +6138,16 @@
@@ -6012,10 +6123,16 @@
this.#handleTabMove(
element,
() => {
@ -583,7 +588,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
if (neighbor && this.isTab(element) && tabIndex > element._tPos) {
neighbor.after(element);
} else {
@@ -6084,17 +6216,26 @@
@@ -6084,17 +6201,29 @@
targetElement = targetElement.group;
}
}
@ -592,8 +597,12 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
+ element = element.group;
+ }
// Don't allow mixing pinned and unpinned tabs.
if (element.pinned && !targetElement?.pinned) {
- if (element.pinned && !targetElement?.pinned) {
- targetElement = this.tabs[this.pinnedTabCount - 1];
+ if (element.hasAttribute('zen-essential') && !targetElement?.hasAttribute('zen-essential')) {
+ targetElement = this.tabs.filter(tab => !tab.hasAttribute('zen-glance-tab'))[this._numZenEssentials - 1];
+ moveBefore = false;
+ } else if (element.pinned && !targetElement?.pinned) {
+ targetElement = this.tabs.filter(tab => !tab.hasAttribute('zen-glance-tab'))[this.pinnedTabCount - 1];
moveBefore = false;
} else if (!element.pinned && targetElement && targetElement.pinned) {
@ -613,7 +622,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
if (element.pinned && this.tabContainer.verticalMode) {
return this.tabContainer.verticalPinnedTabsContainer;
}
@@ -6154,7 +6295,7 @@
@@ -6154,7 +6283,7 @@
if (!this.isTab(aTab)) {
throw new Error("Can only move a tab into a tab group");
}
@ -622,7 +631,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
return;
}
if (aTab.group && aTab.group.id === aGroup.id) {
@@ -6248,6 +6389,10 @@
@@ -6248,6 +6377,10 @@
moveActionCallback();
@ -633,7 +642,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
// Clear tabs cache after moving nodes because the order of tabs may have
// changed.
this.tabContainer._invalidateCachedTabs();
@@ -7145,7 +7290,7 @@
@@ -7145,7 +7278,7 @@
// preventDefault(). It will still raise the window if appropriate.
break;
}
@ -642,7 +651,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
window.focus();
aEvent.preventDefault();
break;
@@ -8044,6 +8189,7 @@
@@ -8044,6 +8177,7 @@
aWebProgress.isTopLevel
) {
this.mTab.setAttribute("busy", "true");
@ -650,7 +659,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
gBrowser._tabAttrModified(this.mTab, ["busy"]);
this.mTab._notselectedsinceload = !this.mTab.selected;
}
@@ -9009,7 +9155,7 @@ var TabContextMenu = {
@@ -9009,7 +9143,7 @@ var TabContextMenu = {
);
contextUnpinSelectedTabs.hidden =
!this.contextTab.pinned || !this.multiselected;
@ -659,7 +668,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..475838b0fcfab3074116111d971d77c2
// Move Tab items
let contextMoveTabOptions = document.getElementById(
"context_moveTabOptions"
@@ -9278,6 +9424,7 @@ var TabContextMenu = {
@@ -9278,6 +9412,7 @@ var TabContextMenu = {
telemetrySource: gBrowser.TabMetrics.METRIC_SOURCE.TAB_STRIP,
});
} else {