mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-16 14:56:14 +00:00
fix: FIxed restoring pined and essential tabs not being on the correct parent element, b=(bug #8726), c=tests, workspaces
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
diff --git a/browser/components/sessionstore/SessionStore.sys.mjs b/browser/components/sessionstore/SessionStore.sys.mjs
|
diff --git a/browser/components/sessionstore/SessionStore.sys.mjs b/browser/components/sessionstore/SessionStore.sys.mjs
|
||||||
index 8c6047e1ada5a22e57e1e665965237c9e22641d7..8d0585e738a5a758ebbddfa0787c71d634dadd4d 100644
|
index 8c6047e1ada5a22e57e1e665965237c9e22641d7..16b171c56081759e81d3efa6c0c7840fbd7902ff 100644
|
||||||
--- a/browser/components/sessionstore/SessionStore.sys.mjs
|
--- a/browser/components/sessionstore/SessionStore.sys.mjs
|
||||||
+++ b/browser/components/sessionstore/SessionStore.sys.mjs
|
+++ b/browser/components/sessionstore/SessionStore.sys.mjs
|
||||||
@@ -2088,7 +2088,6 @@ var SessionStoreInternal = {
|
@@ -2088,7 +2088,6 @@ var SessionStoreInternal = {
|
||||||
@@ -43,7 +43,15 @@ index 8c6047e1ada5a22e57e1e665965237c9e22641d7..8d0585e738a5a758ebbddfa0787c71d6
|
|||||||
|
|
||||||
if (inBackground === false) {
|
if (inBackground === false) {
|
||||||
aWindow.gBrowser.selectedTab = newTab;
|
aWindow.gBrowser.selectedTab = newTab;
|
||||||
@@ -5239,7 +5241,7 @@ var SessionStoreInternal = {
|
@@ -4361,6 +4363,7 @@ var SessionStoreInternal = {
|
||||||
|
// Append the tab if we're opening into a different window,
|
||||||
|
index: aSource == aTargetWindow ? pos : Infinity,
|
||||||
|
pinned: state.pinned,
|
||||||
|
+ essential: state.zenEssential,
|
||||||
|
userContextId: state.userContextId,
|
||||||
|
skipLoad: true,
|
||||||
|
preferredRemoteType,
|
||||||
|
@@ -5239,7 +5242,7 @@ var SessionStoreInternal = {
|
||||||
}
|
}
|
||||||
|
|
||||||
let workspaceID = aWindow.getWorkspaceID();
|
let workspaceID = aWindow.getWorkspaceID();
|
||||||
@@ -52,7 +60,7 @@ index 8c6047e1ada5a22e57e1e665965237c9e22641d7..8d0585e738a5a758ebbddfa0787c71d6
|
|||||||
winData.workspaceID = workspaceID;
|
winData.workspaceID = workspaceID;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -5430,14 +5432,15 @@ var SessionStoreInternal = {
|
@@ -5430,14 +5433,15 @@ var SessionStoreInternal = {
|
||||||
}
|
}
|
||||||
|
|
||||||
let tabbrowser = aWindow.gBrowser;
|
let tabbrowser = aWindow.gBrowser;
|
||||||
@@ -70,7 +78,7 @@ index 8c6047e1ada5a22e57e1e665965237c9e22641d7..8d0585e738a5a758ebbddfa0787c71d6
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let tabData = lazy.TabState.collect(tab, TAB_CUSTOM_VALUES.get(tab));
|
let tabData = lazy.TabState.collect(tab, TAB_CUSTOM_VALUES.get(tab));
|
||||||
@@ -5456,8 +5459,8 @@ var SessionStoreInternal = {
|
@@ -5456,8 +5460,8 @@ var SessionStoreInternal = {
|
||||||
// We don't store the Firefox View tab in Session Store, so if it was the last selected "tab" when
|
// We don't store the Firefox View tab in Session Store, so if it was the last selected "tab" when
|
||||||
// a window is closed, point to the first item in the tab strip instead (it will never be the Firefox View tab,
|
// a window is closed, point to the first item in the tab strip instead (it will never be the Firefox View tab,
|
||||||
// since it's only inserted into the tab strip after it's selected).
|
// since it's only inserted into the tab strip after it's selected).
|
||||||
@@ -81,7 +89,7 @@ index 8c6047e1ada5a22e57e1e665965237c9e22641d7..8d0585e738a5a758ebbddfa0787c71d6
|
|||||||
winData.title = tabbrowser.tabs[0].label;
|
winData.title = tabbrowser.tabs[0].label;
|
||||||
}
|
}
|
||||||
winData.selected = selectedIndex;
|
winData.selected = selectedIndex;
|
||||||
@@ -5569,8 +5572,8 @@ var SessionStoreInternal = {
|
@@ -5569,8 +5573,8 @@ var SessionStoreInternal = {
|
||||||
// selectTab represents.
|
// selectTab represents.
|
||||||
let selectTab = 0;
|
let selectTab = 0;
|
||||||
if (overwriteTabs) {
|
if (overwriteTabs) {
|
||||||
@@ -92,7 +100,7 @@ index 8c6047e1ada5a22e57e1e665965237c9e22641d7..8d0585e738a5a758ebbddfa0787c71d6
|
|||||||
selectTab = Math.min(selectTab, winData.tabs.length);
|
selectTab = Math.min(selectTab, winData.tabs.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5613,6 +5616,7 @@ var SessionStoreInternal = {
|
@@ -5613,6 +5617,7 @@ var SessionStoreInternal = {
|
||||||
winData.tabs,
|
winData.tabs,
|
||||||
winData.groups ?? []
|
winData.groups ?? []
|
||||||
);
|
);
|
||||||
@@ -100,7 +108,7 @@ index 8c6047e1ada5a22e57e1e665965237c9e22641d7..8d0585e738a5a758ebbddfa0787c71d6
|
|||||||
this._log.debug(
|
this._log.debug(
|
||||||
`restoreWindow, createTabsForSessionRestore returned ${tabs.length} tabs`
|
`restoreWindow, createTabsForSessionRestore returned ${tabs.length} tabs`
|
||||||
);
|
);
|
||||||
@@ -6162,6 +6166,22 @@ var SessionStoreInternal = {
|
@@ -6162,6 +6167,22 @@ var SessionStoreInternal = {
|
||||||
|
|
||||||
// Most of tabData has been restored, now continue with restoring
|
// Most of tabData has been restored, now continue with restoring
|
||||||
// attributes that may trigger external events.
|
// attributes that may trigger external events.
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
|
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
|
||||||
index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861a8911fc9 100644
|
index d5aa64842a35c6697263c63fd3a0571b64b01344..37c84d1f61e76bfcf4fdead2299f748ac461f6a9 100644
|
||||||
--- a/browser/components/tabbrowser/content/tabbrowser.js
|
--- a/browser/components/tabbrowser/content/tabbrowser.js
|
||||||
+++ b/browser/components/tabbrowser/content/tabbrowser.js
|
+++ b/browser/components/tabbrowser/content/tabbrowser.js
|
||||||
@@ -413,11 +413,41 @@
|
@@ -413,11 +413,41 @@
|
||||||
@@ -182,15 +182,16 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
} else {
|
} else {
|
||||||
aTab.linkedBrowser.browsingContext.hasSiblings = this.tabs.length > 1;
|
aTab.linkedBrowser.browsingContext.hasSiblings = this.tabs.length > 1;
|
||||||
}
|
}
|
||||||
@@ -2680,6 +2726,7 @@
|
@@ -2680,6 +2726,8 @@
|
||||||
schemelessInput,
|
schemelessInput,
|
||||||
hasValidUserGestureActivation = false,
|
hasValidUserGestureActivation = false,
|
||||||
textDirectiveUserActivation = false,
|
textDirectiveUserActivation = false,
|
||||||
+ _forZenEmptyTab,
|
+ _forZenEmptyTab,
|
||||||
|
+ essential,
|
||||||
} = {}
|
} = {}
|
||||||
) {
|
) {
|
||||||
// all callers of addTab that pass a params object need to pass
|
// 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..42788853cde2523b4020cb499383f861
|
|||||||
if (!UserInteraction.running("browser.tabs.opening", window)) {
|
if (!UserInteraction.running("browser.tabs.opening", window)) {
|
||||||
UserInteraction.start("browser.tabs.opening", "initting", window);
|
UserInteraction.start("browser.tabs.opening", "initting", window);
|
||||||
}
|
}
|
||||||
@@ -2753,6 +2806,16 @@
|
@@ -2753,6 +2807,19 @@
|
||||||
noInitialLabel,
|
noInitialLabel,
|
||||||
skipBackgroundNotify,
|
skipBackgroundNotify,
|
||||||
});
|
});
|
||||||
@@ -216,11 +217,22 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
+ }
|
+ }
|
||||||
+ if (_forZenEmptyTab) {
|
+ if (_forZenEmptyTab) {
|
||||||
+ t.setAttribute("zen-empty-tab", "true");
|
+ t.setAttribute("zen-empty-tab", "true");
|
||||||
|
+ }
|
||||||
|
+ if (essential) {
|
||||||
|
+ t.setAttribute("zen-essential", "true");
|
||||||
+ }
|
+ }
|
||||||
if (insertTab) {
|
if (insertTab) {
|
||||||
// Insert the tab into the tab container in the correct position.
|
// Insert the tab into the tab container in the correct position.
|
||||||
// For now, we support `index` as an alias for `tabIndex`.
|
// 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,
|
openWindowInfo,
|
||||||
skipLoad,
|
skipLoad,
|
||||||
triggeringRemoteType,
|
triggeringRemoteType,
|
||||||
@@ -228,7 +240,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
if (focusUrlBar) {
|
if (focusUrlBar) {
|
||||||
@@ -2902,6 +2966,12 @@
|
@@ -2902,6 +2971,12 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,7 +253,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
// Additionally send pinned tab events
|
// Additionally send pinned tab events
|
||||||
if (pinned) {
|
if (pinned) {
|
||||||
this._notifyPinnedStatus(t);
|
this._notifyPinnedStatus(t);
|
||||||
@@ -2990,10 +3060,10 @@
|
@@ -2990,10 +3065,10 @@
|
||||||
isAdoptingGroup = false,
|
isAdoptingGroup = false,
|
||||||
isUserTriggered = false,
|
isUserTriggered = false,
|
||||||
telemetryUserCreateSource = "unknown",
|
telemetryUserCreateSource = "unknown",
|
||||||
@@ -253,7 +265,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!color) {
|
if (!color) {
|
||||||
@@ -3014,7 +3084,12 @@
|
@@ -3014,7 +3089,12 @@
|
||||||
label,
|
label,
|
||||||
isAdoptingGroup
|
isAdoptingGroup
|
||||||
);
|
);
|
||||||
@@ -267,7 +279,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
group,
|
group,
|
||||||
insertBefore?.group ?? insertBefore
|
insertBefore?.group ?? insertBefore
|
||||||
);
|
);
|
||||||
@@ -3303,6 +3378,7 @@
|
@@ -3303,6 +3383,7 @@
|
||||||
openWindowInfo,
|
openWindowInfo,
|
||||||
skipLoad,
|
skipLoad,
|
||||||
triggeringRemoteType,
|
triggeringRemoteType,
|
||||||
@@ -275,7 +287,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
// If we don't have a preferred remote type (or it is `NOT_REMOTE`), and
|
// If we don't have a preferred remote type (or it is `NOT_REMOTE`), and
|
||||||
@@ -3372,6 +3448,7 @@
|
@@ -3372,6 +3453,7 @@
|
||||||
openWindowInfo,
|
openWindowInfo,
|
||||||
name,
|
name,
|
||||||
skipLoad,
|
skipLoad,
|
||||||
@@ -283,7 +295,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3560,7 +3637,7 @@
|
@@ -3560,7 +3642,7 @@
|
||||||
// Add a new tab if needed.
|
// Add a new tab if needed.
|
||||||
if (!tab) {
|
if (!tab) {
|
||||||
let createLazyBrowser =
|
let createLazyBrowser =
|
||||||
@@ -292,7 +304,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
|
|
||||||
let url = "about:blank";
|
let url = "about:blank";
|
||||||
if (tabData.entries?.length) {
|
if (tabData.entries?.length) {
|
||||||
@@ -3598,7 +3675,8 @@
|
@@ -3598,7 +3680,8 @@
|
||||||
skipLoad: true,
|
skipLoad: true,
|
||||||
preferredRemoteType,
|
preferredRemoteType,
|
||||||
});
|
});
|
||||||
@@ -302,7 +314,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
if (select) {
|
if (select) {
|
||||||
tabToSelect = tab;
|
tabToSelect = tab;
|
||||||
}
|
}
|
||||||
@@ -3622,7 +3700,8 @@
|
@@ -3622,7 +3705,8 @@
|
||||||
// needs calling:
|
// needs calling:
|
||||||
shouldUpdateForPinnedTabs = true;
|
shouldUpdateForPinnedTabs = true;
|
||||||
}
|
}
|
||||||
@@ -312,7 +324,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
let { groupId } = tabData;
|
let { groupId } = tabData;
|
||||||
const tabGroup = tabGroupWorkingData.get(groupId);
|
const tabGroup = tabGroupWorkingData.get(groupId);
|
||||||
// if a tab refers to a tab group we don't know, skip any group
|
// if a tab refers to a tab group we don't know, skip any group
|
||||||
@@ -3636,7 +3715,10 @@
|
@@ -3636,7 +3720,10 @@
|
||||||
tabGroup.stateData.id,
|
tabGroup.stateData.id,
|
||||||
tabGroup.stateData.color,
|
tabGroup.stateData.color,
|
||||||
tabGroup.stateData.collapsed,
|
tabGroup.stateData.collapsed,
|
||||||
@@ -324,7 +336,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
);
|
);
|
||||||
tabsFragment.appendChild(tabGroup.node);
|
tabsFragment.appendChild(tabGroup.node);
|
||||||
}
|
}
|
||||||
@@ -3684,8 +3766,16 @@
|
@@ -3684,8 +3771,16 @@
|
||||||
// to remove the old selected tab.
|
// to remove the old selected tab.
|
||||||
if (tabToSelect) {
|
if (tabToSelect) {
|
||||||
let leftoverTab = this.selectedTab;
|
let leftoverTab = this.selectedTab;
|
||||||
@@ -343,7 +355,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tabs.length > 1 || !tabs[0].selected) {
|
if (tabs.length > 1 || !tabs[0].selected) {
|
||||||
@@ -3881,7 +3971,7 @@
|
@@ -3881,7 +3976,7 @@
|
||||||
// Ensure we have an index if one was not provided.
|
// Ensure we have an index if one was not provided.
|
||||||
if (typeof elementIndex != "number" && typeof tabIndex != "number") {
|
if (typeof elementIndex != "number" && typeof tabIndex != "number") {
|
||||||
// Move the new tab after another tab if needed, to the end otherwise.
|
// Move the new tab after another tab if needed, to the end otherwise.
|
||||||
@@ -352,7 +364,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
if (
|
if (
|
||||||
!bulkOrderedOpen &&
|
!bulkOrderedOpen &&
|
||||||
((openerTab &&
|
((openerTab &&
|
||||||
@@ -3904,7 +3994,7 @@
|
@@ -3904,7 +3999,7 @@
|
||||||
) {
|
) {
|
||||||
elementIndex = Infinity;
|
elementIndex = Infinity;
|
||||||
} else if (previousTab.visible) {
|
} else if (previousTab.visible) {
|
||||||
@@ -361,7 +373,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
} else if (previousTab == FirefoxViewHandler.tab) {
|
} else if (previousTab == FirefoxViewHandler.tab) {
|
||||||
elementIndex = 0;
|
elementIndex = 0;
|
||||||
}
|
}
|
||||||
@@ -3932,14 +4022,14 @@
|
@@ -3932,14 +4027,14 @@
|
||||||
}
|
}
|
||||||
// Ensure index is within bounds.
|
// Ensure index is within bounds.
|
||||||
if (tab.pinned) {
|
if (tab.pinned) {
|
||||||
@@ -380,7 +392,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
|
|
||||||
// Prevent a flash of unstyled content by setting up the tab content
|
// Prevent a flash of unstyled content by setting up the tab content
|
||||||
// and inherited attributes before appending it (see Bug 1592054):
|
// and inherited attributes before appending it (see Bug 1592054):
|
||||||
@@ -3947,7 +4037,7 @@
|
@@ -3947,7 +4042,7 @@
|
||||||
|
|
||||||
this.tabContainer._invalidateCachedTabs();
|
this.tabContainer._invalidateCachedTabs();
|
||||||
|
|
||||||
@@ -389,7 +401,15 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
if (this.isTab(itemAfter) && itemAfter.group == tabGroup) {
|
if (this.isTab(itemAfter) && itemAfter.group == tabGroup) {
|
||||||
// Place at the front of, or between tabs in, the same tab group
|
// Place at the front of, or between tabs in, the same tab group
|
||||||
this.tabContainer.insertBefore(tab, itemAfter);
|
this.tabContainer.insertBefore(tab, itemAfter);
|
||||||
@@ -4268,6 +4358,9 @@
|
@@ -3980,6 +4075,7 @@
|
||||||
|
if (pinned) {
|
||||||
|
this._updateTabBarForPinnedTabs();
|
||||||
|
}
|
||||||
|
+ gZenWorkspaces.fixTabInsertLocation(tab, itemAfter);
|
||||||
|
|
||||||
|
TabBarVisibility.update();
|
||||||
|
}
|
||||||
|
@@ -4268,6 +4364,9 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -399,7 +419,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
this.removeTabs(selectedTabs, { telemetrySource });
|
this.removeTabs(selectedTabs, { telemetrySource });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4520,6 +4613,7 @@
|
@@ -4520,6 +4619,7 @@
|
||||||
telemetrySource,
|
telemetrySource,
|
||||||
} = {}
|
} = {}
|
||||||
) {
|
) {
|
||||||
@@ -407,7 +427,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
// When 'closeWindowWithLastTab' pref is enabled, closing all tabs
|
// When 'closeWindowWithLastTab' pref is enabled, closing all tabs
|
||||||
// can be considered equivalent to closing the window.
|
// can be considered equivalent to closing the window.
|
||||||
if (
|
if (
|
||||||
@@ -4604,6 +4698,7 @@
|
@@ -4604,6 +4704,7 @@
|
||||||
if (lastToClose) {
|
if (lastToClose) {
|
||||||
this.removeTab(lastToClose, aParams);
|
this.removeTab(lastToClose, aParams);
|
||||||
}
|
}
|
||||||
@@ -415,7 +435,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
@@ -4641,6 +4736,12 @@
|
@@ -4641,6 +4742,12 @@
|
||||||
aTab._closeTimeNoAnimTimerId = Glean.browserTabclose.timeNoAnim.start();
|
aTab._closeTimeNoAnimTimerId = Glean.browserTabclose.timeNoAnim.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -428,7 +448,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
// Handle requests for synchronously removing an already
|
// Handle requests for synchronously removing an already
|
||||||
// asynchronously closing tab.
|
// asynchronously closing tab.
|
||||||
if (!animate && aTab.closing) {
|
if (!animate && aTab.closing) {
|
||||||
@@ -4655,7 +4756,9 @@
|
@@ -4655,7 +4762,9 @@
|
||||||
// frame created for it (for example, by updating the visually selected
|
// frame created for it (for example, by updating the visually selected
|
||||||
// state).
|
// state).
|
||||||
let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width;
|
let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width;
|
||||||
@@ -439,7 +459,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
if (
|
if (
|
||||||
!this._beginRemoveTab(aTab, {
|
!this._beginRemoveTab(aTab, {
|
||||||
closeWindowFastpath: true,
|
closeWindowFastpath: true,
|
||||||
@@ -4821,7 +4924,7 @@
|
@@ -4821,7 +4930,7 @@
|
||||||
closeWindowWithLastTab != null
|
closeWindowWithLastTab != null
|
||||||
? closeWindowWithLastTab
|
? closeWindowWithLastTab
|
||||||
: !window.toolbar.visible ||
|
: !window.toolbar.visible ||
|
||||||
@@ -448,7 +468,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
|
|
||||||
if (closeWindow) {
|
if (closeWindow) {
|
||||||
// We've already called beforeunload on all the relevant tabs if we get here,
|
// We've already called beforeunload on all the relevant tabs if we get here,
|
||||||
@@ -4845,6 +4948,7 @@
|
@@ -4845,6 +4954,7 @@
|
||||||
|
|
||||||
newTab = true;
|
newTab = true;
|
||||||
}
|
}
|
||||||
@@ -456,7 +476,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
aTab._endRemoveArgs = [closeWindow, newTab];
|
aTab._endRemoveArgs = [closeWindow, newTab];
|
||||||
|
|
||||||
// swapBrowsersAndCloseOther will take care of closing the window without animation.
|
// swapBrowsersAndCloseOther will take care of closing the window without animation.
|
||||||
@@ -4885,9 +4989,7 @@
|
@@ -4885,9 +4995,7 @@
|
||||||
aTab._mouseleave();
|
aTab._mouseleave();
|
||||||
|
|
||||||
if (newTab) {
|
if (newTab) {
|
||||||
@@ -467,7 +487,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
} else {
|
} else {
|
||||||
TabBarVisibility.update();
|
TabBarVisibility.update();
|
||||||
}
|
}
|
||||||
@@ -5016,6 +5118,8 @@
|
@@ -5016,6 +5124,8 @@
|
||||||
this.tabs[i]._tPos = i;
|
this.tabs[i]._tPos = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -476,7 +496,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
if (!this._windowIsClosing) {
|
if (!this._windowIsClosing) {
|
||||||
if (wasPinned) {
|
if (wasPinned) {
|
||||||
this.tabContainer._positionPinnedTabs();
|
this.tabContainer._positionPinnedTabs();
|
||||||
@@ -5230,6 +5334,7 @@
|
@@ -5230,6 +5340,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
let excludeTabs = new Set(aExcludeTabs);
|
let excludeTabs = new Set(aExcludeTabs);
|
||||||
@@ -484,7 +504,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
|
|
||||||
// If this tab has a successor, it should be selectable, since
|
// If this tab has a successor, it should be selectable, since
|
||||||
// hiding or closing a tab removes that tab as a successor.
|
// hiding or closing a tab removes that tab as a successor.
|
||||||
@@ -5242,13 +5347,13 @@
|
@@ -5242,13 +5353,13 @@
|
||||||
!excludeTabs.has(aTab.owner) &&
|
!excludeTabs.has(aTab.owner) &&
|
||||||
Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose")
|
Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose")
|
||||||
) {
|
) {
|
||||||
@@ -500,7 +520,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
);
|
);
|
||||||
|
|
||||||
let tab = this.tabContainer.findNextTab(aTab, {
|
let tab = this.tabContainer.findNextTab(aTab, {
|
||||||
@@ -5264,7 +5369,7 @@
|
@@ -5264,7 +5375,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tab) {
|
if (tab) {
|
||||||
@@ -509,7 +529,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If no qualifying visible tab was found, see if there is a tab in
|
// If no qualifying visible tab was found, see if there is a tab in
|
||||||
@@ -5285,7 +5390,7 @@
|
@@ -5285,7 +5396,7 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -518,7 +538,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
}
|
}
|
||||||
|
|
||||||
_blurTab(aTab) {
|
_blurTab(aTab) {
|
||||||
@@ -5686,10 +5791,10 @@
|
@@ -5686,10 +5797,10 @@
|
||||||
SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
|
SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -531,7 +551,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
aTab.selected ||
|
aTab.selected ||
|
||||||
aTab.closing ||
|
aTab.closing ||
|
||||||
// Tabs that are sharing the screen, microphone or camera cannot be hidden.
|
// Tabs that are sharing the screen, microphone or camera cannot be hidden.
|
||||||
@@ -5986,7 +6091,7 @@
|
@@ -5986,7 +6097,7 @@
|
||||||
|
|
||||||
// Don't allow mixing pinned and unpinned tabs.
|
// Don't allow mixing pinned and unpinned tabs.
|
||||||
if (this.isTab(element) && element.pinned) {
|
if (this.isTab(element) && element.pinned) {
|
||||||
@@ -540,7 +560,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
} else {
|
} else {
|
||||||
tabIndex = Math.max(tabIndex, this.pinnedTabCount);
|
tabIndex = Math.max(tabIndex, this.pinnedTabCount);
|
||||||
}
|
}
|
||||||
@@ -6012,10 +6117,16 @@
|
@@ -6012,10 +6123,16 @@
|
||||||
this.#handleTabMove(
|
this.#handleTabMove(
|
||||||
element,
|
element,
|
||||||
() => {
|
() => {
|
||||||
@@ -559,7 +579,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
if (neighbor && this.isTab(element) && tabIndex > element._tPos) {
|
if (neighbor && this.isTab(element) && tabIndex > element._tPos) {
|
||||||
neighbor.after(element);
|
neighbor.after(element);
|
||||||
} else {
|
} else {
|
||||||
@@ -6084,17 +6195,29 @@
|
@@ -6084,17 +6201,29 @@
|
||||||
targetElement = targetElement.group;
|
targetElement = targetElement.group;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -593,7 +613,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
if (element.pinned && this.tabContainer.verticalMode) {
|
if (element.pinned && this.tabContainer.verticalMode) {
|
||||||
return this.tabContainer.verticalPinnedTabsContainer;
|
return this.tabContainer.verticalPinnedTabsContainer;
|
||||||
}
|
}
|
||||||
@@ -6154,7 +6277,7 @@
|
@@ -6154,7 +6283,7 @@
|
||||||
if (!this.isTab(aTab)) {
|
if (!this.isTab(aTab)) {
|
||||||
throw new Error("Can only move a tab into a tab group");
|
throw new Error("Can only move a tab into a tab group");
|
||||||
}
|
}
|
||||||
@@ -602,7 +622,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (aTab.group && aTab.group.id === aGroup.id) {
|
if (aTab.group && aTab.group.id === aGroup.id) {
|
||||||
@@ -6248,6 +6371,10 @@
|
@@ -6248,6 +6377,10 @@
|
||||||
|
|
||||||
moveActionCallback();
|
moveActionCallback();
|
||||||
|
|
||||||
@@ -613,7 +633,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
// Clear tabs cache after moving nodes because the order of tabs may have
|
// Clear tabs cache after moving nodes because the order of tabs may have
|
||||||
// changed.
|
// changed.
|
||||||
this.tabContainer._invalidateCachedTabs();
|
this.tabContainer._invalidateCachedTabs();
|
||||||
@@ -7145,7 +7272,7 @@
|
@@ -7145,7 +7278,7 @@
|
||||||
// preventDefault(). It will still raise the window if appropriate.
|
// preventDefault(). It will still raise the window if appropriate.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -622,7 +642,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
window.focus();
|
window.focus();
|
||||||
aEvent.preventDefault();
|
aEvent.preventDefault();
|
||||||
break;
|
break;
|
||||||
@@ -8044,6 +8171,7 @@
|
@@ -8044,6 +8177,7 @@
|
||||||
aWebProgress.isTopLevel
|
aWebProgress.isTopLevel
|
||||||
) {
|
) {
|
||||||
this.mTab.setAttribute("busy", "true");
|
this.mTab.setAttribute("busy", "true");
|
||||||
@@ -630,7 +650,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
gBrowser._tabAttrModified(this.mTab, ["busy"]);
|
gBrowser._tabAttrModified(this.mTab, ["busy"]);
|
||||||
this.mTab._notselectedsinceload = !this.mTab.selected;
|
this.mTab._notselectedsinceload = !this.mTab.selected;
|
||||||
}
|
}
|
||||||
@@ -9009,7 +9137,7 @@ var TabContextMenu = {
|
@@ -9009,7 +9143,7 @@ var TabContextMenu = {
|
||||||
);
|
);
|
||||||
contextUnpinSelectedTabs.hidden =
|
contextUnpinSelectedTabs.hidden =
|
||||||
!this.contextTab.pinned || !this.multiselected;
|
!this.contextTab.pinned || !this.multiselected;
|
||||||
@@ -639,7 +659,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..42788853cde2523b4020cb499383f861
|
|||||||
// Move Tab items
|
// Move Tab items
|
||||||
let contextMoveTabOptions = document.getElementById(
|
let contextMoveTabOptions = document.getElementById(
|
||||||
"context_moveTabOptions"
|
"context_moveTabOptions"
|
||||||
@@ -9278,6 +9406,7 @@ var TabContextMenu = {
|
@@ -9278,6 +9412,7 @@ var TabContextMenu = {
|
||||||
telemetrySource: gBrowser.TabMetrics.METRIC_SOURCE.TAB_STRIP,
|
telemetrySource: gBrowser.TabMetrics.METRIC_SOURCE.TAB_STRIP,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@@ -14,3 +14,4 @@
|
|||||||
["browser_pinned_to_essential.js"]
|
["browser_pinned_to_essential.js"]
|
||||||
|
|
||||||
["browser_issue_7654.js"]
|
["browser_issue_7654.js"]
|
||||||
|
["browser_issue_8726.js"]
|
||||||
|
59
src/zen/tests/pinned/browser_issue_8726.js
Normal file
59
src/zen/tests/pinned/browser_issue_8726.js
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
|
https://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { TabStateFlusher } = ChromeUtils.importESModule(
|
||||||
|
'resource:///modules/sessionstore/TabStateFlusher.sys.mjs'
|
||||||
|
);
|
||||||
|
|
||||||
|
add_task(async function test_Restore_Pinned_Tab() {
|
||||||
|
await BrowserTestUtils.withNewTab(
|
||||||
|
{
|
||||||
|
gBrowser,
|
||||||
|
url: 'https://example.com/',
|
||||||
|
},
|
||||||
|
async function (browser) {
|
||||||
|
let tab = gBrowser.getTabForBrowser(browser);
|
||||||
|
gBrowser.pinTab(tab);
|
||||||
|
ok(tab.pinned, 'The tab should be pinned after being created');
|
||||||
|
await BrowserTestUtils.removeTab(tab);
|
||||||
|
await TabStateFlusher.flushWindow(window);
|
||||||
|
restoreLastClosedTabOrWindowOrSession();
|
||||||
|
tab = gBrowser.selectedTab;
|
||||||
|
ok(tab.pinned, 'The tab should be pinned after restore');
|
||||||
|
ok(
|
||||||
|
tab.parentElement.closest('.zen-workspace-pinned-tabs-section'),
|
||||||
|
'The tab should be in the pinned tabs section after restore'
|
||||||
|
);
|
||||||
|
await BrowserTestUtils.removeTab(tab);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
add_task(async function test_Restore_Essential_Tab() {
|
||||||
|
await BrowserTestUtils.withNewTab(
|
||||||
|
{
|
||||||
|
gBrowser,
|
||||||
|
url: 'https://example.com/',
|
||||||
|
},
|
||||||
|
async function (browser) {
|
||||||
|
let tab = gBrowser.getTabForBrowser(browser);
|
||||||
|
gZenPinnedTabManager.addToEssentials(tab);
|
||||||
|
ok(
|
||||||
|
tab.hasAttribute('zen-essential'),
|
||||||
|
'The tab should be marked as essential after being created'
|
||||||
|
);
|
||||||
|
await BrowserTestUtils.removeTab(tab);
|
||||||
|
await TabStateFlusher.flushWindow(window);
|
||||||
|
restoreLastClosedTabOrWindowOrSession();
|
||||||
|
tab = gBrowser.selectedTab;
|
||||||
|
ok(tab.hasAttribute('zen-essential'), 'The tab should be marked as essential after restore');
|
||||||
|
ok(
|
||||||
|
tab.parentElement.closest('.zen-essentials-container'),
|
||||||
|
'The tab should be in the essentials tabs section after restore'
|
||||||
|
);
|
||||||
|
await BrowserTestUtils.removeTab(tab);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
@@ -3322,4 +3322,20 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fixTabInsertLocation(tab) {
|
||||||
|
if (tab.hasAttribute('zen-essential')) {
|
||||||
|
// Essential tabs should always be inserted at the end of the essentials section
|
||||||
|
const essentialsSection = this.getEssentialsSection(tab);
|
||||||
|
if (essentialsSection) {
|
||||||
|
essentialsSection.appendChild(tab);
|
||||||
|
}
|
||||||
|
} else if (tab.pinned) {
|
||||||
|
// Pinned tabs should always be inserted at the end of the pinned tabs container
|
||||||
|
const pinnedContainer = this.pinnedTabsContainer;
|
||||||
|
if (pinnedContainer) {
|
||||||
|
pinnedContainer.insertBefore(tab, pinnedContainer.lastChild);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
|
Reference in New Issue
Block a user