test: Fix default app dir for XDG and import sandbox tests, b=bug #11917, c=tests

This commit is contained in:
mr. m
2026-01-17 14:13:06 +01:00
parent 7668c26ce5
commit 56c5f2fb6d
27 changed files with 2623 additions and 34 deletions

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae944551f9 100644
index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..ec11f894f18140b8e7ceb65e6ca4a2f27b5ba520 100644
--- a/browser/components/tabbrowser/content/tabbrowser.js
+++ b/browser/components/tabbrowser/content/tabbrowser.js
@@ -398,6 +398,7 @@
@@ -458,10 +458,10 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
+ gZenWorkspaces._initialTab._shouldRemove = true;
+ }
+ }
+ }
}
+ else {
+ gZenWorkspaces._tabToRemoveForEmpty = this.selectedTab;
}
+ }
+ this._hasAlreadyInitializedZenSessionStore = true;
if (tabs.length > 1 || !tabs[0].selected) {
@@ -650,7 +650,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
// If this tab has a successor, it should be selectable, since
// hiding or closing a tab removes that tab as a successor.
@@ -5744,13 +5908,13 @@
@@ -5744,15 +5908,22 @@
!excludeTabs.has(aTab.owner) &&
Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose")
) {
@@ -662,11 +662,20 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
let remainingTabs = Array.prototype.filter.call(
this.visibleTabs,
- tab => !excludeTabs.has(tab)
+ tab => !excludeTabs.has(tab) && gZenWorkspaces._shouldChangeToTab(tab)
+ tab => !excludeTabs.has(tab) && gZenWorkspaces._shouldChangeToTab(tab) && tab !== aTab
);
+ if (remainingTabs.length > 0 && Services.prefs.getBoolPref("zen.tabs.select-recently-used-on-close")) {
+ let mostRecentTab = remainingTabs.reduce((a, b) =>
+ b.lastAccessed > a.lastAccessed ? b : a
+ );
+ return gZenWorkspaces.findTabToBlur(mostRecentTab);
+ }
+
let tab = this.tabContainer.findNextTab(aTab, {
@@ -5766,7 +5930,7 @@
direction: 1,
filter: _tab => remainingTabs.includes(_tab),
@@ -5766,7 +5937,7 @@
}
if (tab) {
@@ -675,7 +684,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
}
// If no qualifying visible tab was found, see if there is a tab in
@@ -5787,7 +5951,7 @@
@@ -5787,7 +5958,7 @@
});
}
@@ -684,7 +693,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
}
_blurTab(aTab) {
@@ -5798,7 +5962,7 @@
@@ -5798,7 +5969,7 @@
* @returns {boolean}
* False if swapping isn't permitted, true otherwise.
*/
@@ -693,7 +702,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
// Do not allow transfering a private tab to a non-private window
// and vice versa.
if (
@@ -5852,6 +6016,7 @@
@@ -5852,6 +6023,7 @@
// fire the beforeunload event in the process. Close the other
// window if this was its last tab.
if (
@@ -701,7 +710,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
!remoteBrowser._beginRemoveTab(aOtherTab, {
adoptedByTab: aOurTab,
closeWindowWithLastTab: true,
@@ -5863,7 +6028,7 @@
@@ -5863,7 +6035,7 @@
// If this is the last tab of the window, hide the window
// immediately without animation before the docshell swap, to avoid
// about:blank being painted.
@@ -710,7 +719,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
if (closeWindow) {
let win = aOtherTab.ownerGlobal;
win.windowUtils.suppressAnimation(true);
@@ -5987,11 +6152,13 @@
@@ -5987,11 +6159,13 @@
}
// Finish tearing down the tab that's going away.
@@ -724,7 +733,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
this.setTabTitle(aOurTab);
@@ -6193,10 +6360,10 @@
@@ -6193,10 +6367,10 @@
SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
}
@@ -737,7 +746,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
aTab.selected ||
aTab.closing ||
// Tabs that are sharing the screen, microphone or camera cannot be hidden.
@@ -6254,7 +6421,8 @@
@@ -6254,7 +6428,8 @@
*
* @param {MozTabbrowserTab|MozTabbrowserTabGroup|MozTabbrowserTabGroup.labelElement} aTab
*/
@@ -747,7 +756,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
if (this.tabs.length == 1) {
return null;
}
@@ -6278,12 +6446,14 @@
@@ -6278,12 +6453,14 @@
}
// tell a new window to take the "dropped" tab
@@ -763,7 +772,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
}
/**
@@ -6388,7 +6558,7 @@
@@ -6388,7 +6565,7 @@
* `true` if element is a `<tab-group>`
*/
isTabGroup(element) {
@@ -772,7 +781,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
}
/**
@@ -6473,8 +6643,8 @@
@@ -6473,8 +6650,8 @@
}
// Don't allow mixing pinned and unpinned tabs.
@@ -783,7 +792,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
} else {
tabIndex = Math.max(tabIndex, this.pinnedTabCount);
}
@@ -6500,10 +6670,16 @@
@@ -6500,10 +6677,16 @@
this.#handleTabMove(
element,
() => {
@@ -802,7 +811,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
if (neighbor && this.isTab(element) && tabIndex > element._tPos) {
neighbor.after(element);
} else {
@@ -6561,23 +6737,31 @@
@@ -6561,23 +6744,31 @@
#moveTabNextTo(element, targetElement, moveBefore = false, metricsContext) {
if (this.isTabGroupLabel(targetElement)) {
targetElement = targetElement.group;
@@ -840,7 +849,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
} else if (!element.pinned && targetElement && targetElement.pinned) {
// If the caller asks to move an unpinned element next to a pinned
// tab, move the unpinned element to be the first unpinned element
@@ -6590,14 +6774,34 @@
@@ -6590,14 +6781,34 @@
// 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.
@@ -876,7 +885,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
element.pinned
? this.tabContainer.pinnedTabsContainer
: this.tabContainer;
@@ -6606,7 +6810,7 @@
@@ -6606,7 +6817,7 @@
element,
() => {
if (moveBefore) {
@@ -885,7 +894,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
} else if (targetElement) {
targetElement.after(element);
} else {
@@ -6676,10 +6880,10 @@
@@ -6676,10 +6887,10 @@
* @param {TabMetricsContext} [metricsContext]
*/
moveTabToExistingGroup(aTab, aGroup, metricsContext) {
@@ -898,7 +907,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
return;
}
if (aTab.group && aTab.group.id === aGroup.id) {
@@ -6751,6 +6955,7 @@
@@ -6751,6 +6962,7 @@
let state = {
tabIndex: tab._tPos,
@@ -906,7 +915,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
};
if (tab.visible) {
state.elementIndex = tab.elementIndex;
@@ -6777,7 +6982,7 @@
@@ -6777,7 +6989,7 @@
let changedTabGroup =
previousTabState.tabGroupId != currentTabState.tabGroupId;
@@ -915,7 +924,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
tab.dispatchEvent(
new CustomEvent("TabMove", {
bubbles: true,
@@ -6818,6 +7023,10 @@
@@ -6818,6 +7030,10 @@
moveActionCallback();
@@ -926,7 +935,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
// Clear tabs cache after moving nodes because the order of tabs may have
// changed.
this.tabContainer._invalidateCachedTabs();
@@ -6869,6 +7078,19 @@
@@ -6869,6 +7085,19 @@
* The new tab in the current window, null if the tab couldn't be adopted.
*/
adoptTab(aTab, { elementIndex, tabIndex, selectTab = false } = {}) {
@@ -946,7 +955,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
// Swap the dropped tab with a new one we create and then close
// it in the other window (making it seem to have moved between
// windows). We also ensure that the tab we create to swap into has
@@ -6910,6 +7132,8 @@
@@ -6910,6 +7139,8 @@
params.userContextId = aTab.getAttribute("usercontextid");
}
let newTab = this.addWebTab("about:blank", params);
@@ -955,7 +964,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
let newBrowser = this.getBrowserForTab(newTab);
aTab.container.tabDragAndDrop.finishAnimateTabMove();
@@ -7718,7 +7942,7 @@
@@ -7718,7 +7949,7 @@
// preventDefault(). It will still raise the window if appropriate.
break;
}
@@ -964,7 +973,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
window.focus();
aEvent.preventDefault();
break;
@@ -7735,7 +7959,6 @@
@@ -7735,7 +7966,6 @@
}
case "TabGroupCollapse":
aEvent.target.tabs.forEach(tab => {
@@ -972,7 +981,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
});
break;
case "TabGroupCreateByUser":
@@ -7895,7 +8118,9 @@
@@ -7895,7 +8125,9 @@
let filter = this._tabFilters.get(tab);
if (filter) {
@@ -982,7 +991,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
let listener = this._tabListeners.get(tab);
if (listener) {
@@ -8698,6 +8923,7 @@
@@ -8698,6 +8930,7 @@
aWebProgress.isTopLevel
) {
this.mTab.setAttribute("busy", "true");
@@ -990,7 +999,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
gBrowser._tabAttrModified(this.mTab, ["busy"]);
this.mTab._notselectedsinceload = !this.mTab.selected;
}
@@ -8778,6 +9004,7 @@
@@ -8778,6 +9011,7 @@
// known defaults. Note we use the original URL since about:newtab
// redirects to a prerendered page.
const shouldRemoveFavicon =
@@ -998,7 +1007,7 @@ index 0eaca7a58e0026237b71b2ad515efe84d9e8c779..5f58cf2009dfe869d05b896b609c7bae
!this.mBrowser.mIconURL &&
!ignoreBlank &&
!(originalLocation.spec in FAVICON_DEFAULTS);
@@ -9803,7 +10030,7 @@ var TabContextMenu = {
@@ -9803,7 +10037,7 @@ var TabContextMenu = {
);
contextUnpinSelectedTabs.hidden =
!this.contextTab.pinned || !this.multiselected;