diff --git a/src/browser/components/tabbrowser/content/tabbrowser-js.patch b/src/browser/components/tabbrowser/content/tabbrowser-js.patch index 304c49a53..ecb7aa781 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..7bb218913170222d55e7b7bdf4ca08923f359862 100644 +index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..b46335091e4d4ea71bf5027ea3a472cc839781b8 100644 --- a/browser/components/tabbrowser/content/tabbrowser.js +++ b/browser/components/tabbrowser/content/tabbrowser.js @@ -422,15 +422,60 @@ @@ -293,7 +293,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 } if (!color) { -@@ -3040,7 +3132,12 @@ +@@ -3040,9 +3132,13 @@ label, isAdoptingGroup ); @@ -303,11 +303,13 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 + } + group.essential = tabs.some(tab => tab.hasAttribute("essential")); + group.pinned = group.essential || tabs.some(tab => tab.pinned); -+ ((insertBefore?.group ?? insertBefore).parentNode).insertBefore( ++ insertBefore.before( group, - insertBefore?.group ?? insertBefore +- insertBefore?.group ?? insertBefore ); -@@ -3163,7 +3260,7 @@ + group.addTabs(tabs); + +@@ -3163,7 +3259,7 @@ } this.#handleTabMove(tab, () => @@ -316,7 +318,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 ); } -@@ -3357,6 +3454,7 @@ +@@ -3357,6 +3453,7 @@ openWindowInfo, skipLoad, triggeringRemoteType, @@ -324,7 +326,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 } ) { // If we don't have a preferred remote type (or it is `NOT_REMOTE`), and -@@ -3426,6 +3524,7 @@ +@@ -3426,6 +3523,7 @@ openWindowInfo, name, skipLoad, @@ -332,7 +334,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 }); } -@@ -3613,7 +3712,7 @@ +@@ -3613,7 +3711,7 @@ // Add a new tab if needed. if (!tab) { let createLazyBrowser = @@ -341,7 +343,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 let url = "about:blank"; if (tabData.entries?.length) { -@@ -3650,8 +3749,10 @@ +@@ -3650,8 +3748,10 @@ insertTab: false, skipLoad: true, preferredRemoteType, @@ -353,7 +355,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 if (select) { tabToSelect = tab; } -@@ -3663,7 +3764,8 @@ +@@ -3663,7 +3763,8 @@ this.pinTab(tab); // Then ensure all the tab open/pinning information is sent. this._fireTabOpen(tab, {}); @@ -363,7 +365,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 let { groupId } = tabData; const tabGroup = tabGroupWorkingData.get(groupId); // if a tab refers to a tab group we don't know, skip any group -@@ -3677,7 +3779,10 @@ +@@ -3677,7 +3778,10 @@ tabGroup.stateData.id, tabGroup.stateData.color, tabGroup.stateData.collapsed, @@ -375,7 +377,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 ); tabsFragment.appendChild(tabGroup.node); } -@@ -3722,9 +3827,23 @@ +@@ -3722,9 +3826,23 @@ // to remove the old selected tab. if (tabToSelect) { let leftoverTab = this.selectedTab; @@ -399,7 +401,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 if (tabs.length > 1 || !tabs[0].selected) { this._updateTabsAfterInsert(); -@@ -3919,7 +4038,7 @@ +@@ -3919,7 +4037,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. @@ -408,7 +410,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 if ( !bulkOrderedOpen && ((openerTab && -@@ -3931,7 +4050,7 @@ +@@ -3931,7 +4049,7 @@ let lastRelatedTab = openerTab && this._lastRelatedTabMap.get(openerTab); let previousTab = lastRelatedTab || openerTab || this.selectedTab; @@ -417,7 +419,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 tabGroup = previousTab.group; } if ( -@@ -3942,7 +4061,7 @@ +@@ -3942,7 +4060,7 @@ ) { elementIndex = Infinity; } else if (previousTab.visible) { @@ -426,7 +428,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 } else if (previousTab == FirefoxViewHandler.tab) { elementIndex = 0; } -@@ -3970,14 +4089,14 @@ +@@ -3970,14 +4088,14 @@ } // Ensure index is within bounds. if (tab.pinned) { @@ -445,7 +447,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 // Prevent a flash of unstyled content by setting up the tab content // and inherited attributes before appending it (see Bug 1592054): -@@ -3985,7 +4104,7 @@ +@@ -3985,7 +4103,7 @@ this.tabContainer._invalidateCachedTabs(); @@ -454,7 +456,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 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); -@@ -4018,6 +4137,7 @@ +@@ -4018,6 +4136,7 @@ if (pinned) { this._updateTabBarForPinnedTabs(); } @@ -462,7 +464,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 TabBarVisibility.update(); } -@@ -4307,6 +4427,9 @@ +@@ -4307,6 +4426,9 @@ return; } @@ -472,7 +474,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 this.removeTabs(selectedTabs, { isUserTriggered, telemetrySource }); } -@@ -4568,6 +4691,7 @@ +@@ -4568,6 +4690,7 @@ telemetrySource, } = {} ) { @@ -480,7 +482,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 // When 'closeWindowWithLastTab' pref is enabled, closing all tabs // can be considered equivalent to closing the window. if ( -@@ -4657,6 +4781,7 @@ +@@ -4657,6 +4780,7 @@ if (lastToClose) { this.removeTab(lastToClose, aParams); } @@ -488,7 +490,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 } catch (e) { console.error(e); } -@@ -4695,6 +4820,12 @@ +@@ -4695,6 +4819,12 @@ aTab._closeTimeNoAnimTimerId = Glean.browserTabclose.timeNoAnim.start(); } @@ -501,7 +503,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 // Handle requests for synchronously removing an already // asynchronously closing tab. if (!animate && aTab.closing) { -@@ -4709,6 +4840,9 @@ +@@ -4709,6 +4839,9 @@ // state). let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width; let isLastTab = this.#isLastTabInWindow(aTab); @@ -511,7 +513,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 if ( !this._beginRemoveTab(aTab, { closeWindowFastpath: true, -@@ -4891,7 +5025,7 @@ +@@ -4891,7 +5024,7 @@ closeWindowWithLastTab != null ? closeWindowWithLastTab : !window.toolbar.visible || @@ -520,7 +522,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 if (closeWindow) { // We've already called beforeunload on all the relevant tabs if we get here, -@@ -4915,6 +5049,7 @@ +@@ -4915,6 +5048,7 @@ newTab = true; } @@ -528,7 +530,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 aTab._endRemoveArgs = [closeWindow, newTab]; // swapBrowsersAndCloseOther will take care of closing the window without animation. -@@ -4955,9 +5090,7 @@ +@@ -4955,9 +5089,7 @@ aTab._mouseleave(); if (newTab) { @@ -539,7 +541,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 } else { TabBarVisibility.update(); } -@@ -5090,6 +5223,7 @@ +@@ -5090,6 +5222,7 @@ this.tabs[i]._tPos = i; } @@ -547,7 +549,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 if (!this._windowIsClosing) { // update tab close buttons state this.tabContainer._updateCloseButtons(); -@@ -5302,6 +5436,7 @@ +@@ -5302,6 +5435,7 @@ } let excludeTabs = new Set(aExcludeTabs); @@ -555,7 +557,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 // If this tab has a successor, it should be selectable, since // hiding or closing a tab removes that tab as a successor. -@@ -5314,13 +5449,13 @@ +@@ -5314,13 +5448,13 @@ !excludeTabs.has(aTab.owner) && Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose") ) { @@ -571,7 +573,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 ); let tab = this.tabContainer.findNextTab(aTab, { -@@ -5336,7 +5471,7 @@ +@@ -5336,7 +5470,7 @@ } if (tab) { @@ -580,7 +582,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 } // If no qualifying visible tab was found, see if there is a tab in -@@ -5357,7 +5492,7 @@ +@@ -5357,7 +5491,7 @@ }); } @@ -589,7 +591,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 } _blurTab(aTab) { -@@ -5759,10 +5894,10 @@ +@@ -5759,10 +5893,10 @@ SessionStore.deleteCustomTabValue(aTab, "hiddenBy"); } @@ -602,7 +604,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 aTab.selected || aTab.closing || // Tabs that are sharing the screen, microphone or camera cannot be hidden. -@@ -5952,7 +6087,7 @@ +@@ -5952,7 +6086,7 @@ * `true` if element is a `` */ isTabGroup(element) { @@ -611,7 +613,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 } /** -@@ -6029,7 +6164,7 @@ +@@ -6029,7 +6163,7 @@ // Don't allow mixing pinned and unpinned tabs. if (this.isTab(element) && element.pinned) { @@ -620,7 +622,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 } else { tabIndex = Math.max(tabIndex, this.pinnedTabCount); } -@@ -6055,10 +6190,16 @@ +@@ -6055,10 +6189,16 @@ this.#handleTabMove( element, () => { @@ -639,7 +641,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 if (neighbor && this.isTab(element) && tabIndex > element._tPos) { neighbor.after(element); } else { -@@ -6116,22 +6257,26 @@ +@@ -6116,22 +6256,26 @@ #moveTabNextTo(element, targetElement, moveBefore = false, metricsContext) { if (this.isTabGroupLabel(targetElement)) { targetElement = targetElement.group; @@ -672,7 +674,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 moveBefore = false; } else if (!element.pinned && targetElement && targetElement.pinned) { // If the caller asks to move an unpinned element next to a pinned -@@ -6145,14 +6290,18 @@ +@@ -6145,14 +6289,18 @@ // move the tab group right before the first unpinned tab. // 4. Moving a tab group and the first unpinned tab is grouped: // move the tab group right before the first unpinned tab's tab group. @@ -692,7 +694,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 element.pinned ? this.tabContainer.pinnedTabsContainer : this.tabContainer; -@@ -6161,7 +6310,7 @@ +@@ -6161,7 +6309,7 @@ element, () => { if (moveBefore) { @@ -701,7 +703,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 } else if (targetElement) { targetElement.after(element); } else { -@@ -6210,7 +6359,7 @@ +@@ -6210,7 +6358,7 @@ if (!this.isTab(aTab)) { throw new Error("Can only move a tab into a tab group"); } @@ -710,7 +712,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 return; } if (aTab.group && aTab.group.id === aGroup.id) { -@@ -6304,6 +6453,10 @@ +@@ -6304,6 +6452,10 @@ moveActionCallback(); @@ -721,7 +723,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 // Clear tabs cache after moving nodes because the order of tabs may have // changed. this.tabContainer._invalidateCachedTabs(); -@@ -7198,7 +7351,7 @@ +@@ -7198,7 +7350,7 @@ // preventDefault(). It will still raise the window if appropriate. break; } @@ -730,7 +732,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 window.focus(); aEvent.preventDefault(); break; -@@ -8143,6 +8296,7 @@ +@@ -8143,6 +8295,7 @@ aWebProgress.isTopLevel ) { this.mTab.setAttribute("busy", "true"); @@ -738,7 +740,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 gBrowser._tabAttrModified(this.mTab, ["busy"]); this.mTab._notselectedsinceload = !this.mTab.selected; } -@@ -9108,7 +9262,7 @@ var TabContextMenu = { +@@ -9108,7 +9261,7 @@ var TabContextMenu = { ); contextUnpinSelectedTabs.hidden = !this.contextTab.pinned || !this.multiselected; @@ -747,7 +749,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892 // Move Tab items let contextMoveTabOptions = document.getElementById( "context_moveTabOptions" -@@ -9384,6 +9538,7 @@ var TabContextMenu = { +@@ -9384,6 +9537,7 @@ var TabContextMenu = { ) ); } else {