mirror of
https://github.com/zen-browser/desktop.git
synced 2025-07-10 02:06:24 +02:00
Refactor pinned tab management to improve tab insertion logic and error handling
This commit is contained in:
parent
60e2cab249
commit
20ab35fbf9
4 changed files with 127 additions and 116 deletions
|
@ -220,79 +220,83 @@
|
||||||
|
|
||||||
// Third pass: create new tabs for pins that don't have tabs
|
// Third pass: create new tabs for pins that don't have tabs
|
||||||
for (let pin of pins) {
|
for (let pin of pins) {
|
||||||
if (!pinsToCreate.has(pin.uuid)) {
|
try {
|
||||||
continue; // Skip pins that already have tabs
|
if (!pinsToCreate.has(pin.uuid)) {
|
||||||
}
|
continue; // Skip pins that already have tabs
|
||||||
|
}
|
||||||
|
|
||||||
let params = {
|
let params = {
|
||||||
skipAnimation: true,
|
skipAnimation: true,
|
||||||
allowInheritPrincipal: false,
|
allowInheritPrincipal: false,
|
||||||
skipBackgroundNotify: true,
|
skipBackgroundNotify: true,
|
||||||
userContextId: pin.containerTabId || 0,
|
|
||||||
createLazyBrowser: true,
|
|
||||||
skipLoad: true,
|
|
||||||
noInitialLabel: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Create and initialize the tab
|
|
||||||
let newTab = gBrowser.addTrustedTab(pin.url, params);
|
|
||||||
newTab.setAttribute('zenDefaultUserContextId', true);
|
|
||||||
|
|
||||||
// Set initial label/title
|
|
||||||
if (pin.title) {
|
|
||||||
gBrowser.setInitialTabTitle(newTab, pin.title);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the icon if we have it cached
|
|
||||||
if (pin.iconUrl) {
|
|
||||||
gBrowser.setIcon(newTab, pin.iconUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
newTab.setAttribute('zen-pin-id', pin.uuid);
|
|
||||||
|
|
||||||
if (pin.workspaceUuid) {
|
|
||||||
newTab.setAttribute('zen-workspace-id', pin.workspaceUuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pin.isEssential) {
|
|
||||||
newTab.setAttribute('zen-essential', 'true');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pin.editedTitle) {
|
|
||||||
newTab.setAttribute('zen-has-static-label', 'true');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize browser state if needed
|
|
||||||
if (!newTab.linkedBrowser._remoteAutoRemoved) {
|
|
||||||
let state = {
|
|
||||||
entries: [
|
|
||||||
{
|
|
||||||
url: pin.url,
|
|
||||||
title: pin.title,
|
|
||||||
triggeringPrincipal_base64: E10SUtils.SERIALIZED_SYSTEMPRINCIPAL,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
userContextId: pin.containerTabId || 0,
|
userContextId: pin.containerTabId || 0,
|
||||||
image: pin.iconUrl,
|
createLazyBrowser: true,
|
||||||
|
skipLoad: true,
|
||||||
|
noInitialLabel: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
SessionStore.setTabState(newTab, state);
|
// Create and initialize the tab
|
||||||
}
|
let newTab = gBrowser.addTrustedTab(pin.url, params);
|
||||||
|
newTab.setAttribute('zenDefaultUserContextId', true);
|
||||||
|
|
||||||
this.log(`Created new pinned tab for pin ${pin.uuid} (isEssential: ${pin.isEssential})`);
|
// Set initial label/title
|
||||||
gBrowser.pinTab(newTab);
|
if (pin.title) {
|
||||||
if (!pin.isEssential) {
|
gBrowser.setInitialTabTitle(newTab, pin.title);
|
||||||
const container = document.querySelector(
|
|
||||||
`#vertical-pinned-tabs-container .zen-workspace-tabs-section[zen-workspace-id="${pin.workspaceUuid}"]`
|
|
||||||
);
|
|
||||||
if (container) {
|
|
||||||
container.insertBefore(newTab, container.lastChild);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
gBrowser.tabContainer._invalidateCachedTabs();
|
// Set the icon if we have it cached
|
||||||
newTab.initialize();
|
if (pin.iconUrl) {
|
||||||
if (!ZenWorkspaces.essentialShouldShowTab(newTab)) {
|
gBrowser.setIcon(newTab, pin.iconUrl);
|
||||||
gBrowser.hideTab(newTab, undefined, true);
|
}
|
||||||
|
|
||||||
|
newTab.setAttribute('zen-pin-id', pin.uuid);
|
||||||
|
|
||||||
|
if (pin.workspaceUuid) {
|
||||||
|
newTab.setAttribute('zen-workspace-id', pin.workspaceUuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pin.isEssential) {
|
||||||
|
newTab.setAttribute('zen-essential', 'true');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pin.editedTitle) {
|
||||||
|
newTab.setAttribute('zen-has-static-label', 'true');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize browser state if needed
|
||||||
|
if (!newTab.linkedBrowser._remoteAutoRemoved) {
|
||||||
|
let state = {
|
||||||
|
entries: [
|
||||||
|
{
|
||||||
|
url: pin.url,
|
||||||
|
title: pin.title,
|
||||||
|
triggeringPrincipal_base64: E10SUtils.SERIALIZED_SYSTEMPRINCIPAL,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
userContextId: pin.containerTabId || 0,
|
||||||
|
image: pin.iconUrl,
|
||||||
|
};
|
||||||
|
|
||||||
|
SessionStore.setTabState(newTab, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.log(`Created new pinned tab for pin ${pin.uuid} (isEssential: ${pin.isEssential})`);
|
||||||
|
gBrowser.pinTab(newTab);
|
||||||
|
if (!pin.isEssential) {
|
||||||
|
const container = document.querySelector(
|
||||||
|
`#vertical-pinned-tabs-container .zen-workspace-tabs-section[zen-workspace-id="${pin.workspaceUuid}"]`
|
||||||
|
);
|
||||||
|
if (container) {
|
||||||
|
container.insertBefore(newTab, container.lastChild);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gBrowser.tabContainer._invalidateCachedTabs();
|
||||||
|
newTab.initialize();
|
||||||
|
if (!ZenWorkspaces.essentialShouldShowTab(newTab)) {
|
||||||
|
gBrowser.hideTab(newTab, undefined, true);
|
||||||
|
}
|
||||||
|
} catch (ex) {
|
||||||
|
console.error('Failed to initialize pinned tabs:', ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -267,9 +267,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||||
// remove tab from list
|
// remove tab from list
|
||||||
tabs.splice(tabs.indexOf(tab), 1);
|
tabs.splice(tabs.indexOf(tab), 1);
|
||||||
if (tab.pinned) {
|
if (tab.pinned) {
|
||||||
pinnedSection.appendChild(tab);
|
pinnedSection.insertBefore(tab, pinnedSection.lastChild);
|
||||||
} else {
|
} else {
|
||||||
section.appendChild(tab);
|
section.insertBefore(tab, section.lastChild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
diff --git a/browser/components/tabbrowser/content/tab.js b/browser/components/tabbrowser/content/tab.js
|
diff --git a/browser/components/tabbrowser/content/tab.js b/browser/components/tabbrowser/content/tab.js
|
||||||
index d41c486c02a6f09dcff5741a59ad8b617294c481..efa900725f32d8606ba6d3bb8bff2d0dcb511e78 100644
|
index d41c486c02a6f09dcff5741a59ad8b617294c481..1c150fd8863335ee356601f7872c1fdc2086dcab 100644
|
||||||
--- a/browser/components/tabbrowser/content/tab.js
|
--- a/browser/components/tabbrowser/content/tab.js
|
||||||
+++ b/browser/components/tabbrowser/content/tab.js
|
+++ b/browser/components/tabbrowser/content/tab.js
|
||||||
@@ -16,6 +16,7 @@
|
@@ -16,6 +16,7 @@
|
||||||
|
@ -80,3 +80,12 @@ index d41c486c02a6f09dcff5741a59ad8b617294c481..efa900725f32d8606ba6d3bb8bff2d0d
|
||||||
}
|
}
|
||||||
|
|
||||||
on_dblclick(event) {
|
on_dblclick(event) {
|
||||||
|
@@ -576,6 +590,8 @@
|
||||||
|
animate: true,
|
||||||
|
triggeringEvent: event,
|
||||||
|
});
|
||||||
|
+ } else if (this.hasAttribute('zen-essential')) {
|
||||||
|
+ gZenPinnedTabManager._onTabResetPinButton(event, this, 'reset');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
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 ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf32921591731291f8e9db 100644
|
index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..c8fc61c310df678f7a74f4b0fe390bcb07e02291 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
|
||||||
@@ -406,11 +406,52 @@
|
@@ -406,11 +406,50 @@
|
||||||
return this.tabContainer.visibleTabs;
|
return this.tabContainer.visibleTabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,9 +38,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
+ if (!tab.hasAttribute("zen-essential") && !tab.hasAttribute("zen-glance-tab")) {
|
+ if (!tab.hasAttribute("zen-essential") && !tab.hasAttribute("zen-glance-tab")) {
|
||||||
+ break;
|
+ break;
|
||||||
+ }
|
+ }
|
||||||
+ if (!tab.hidden) {
|
+ i += !tab.hasAttribute("zen-glance-tab");
|
||||||
+ i += !tab.hasAttribute("zen-glance-tab");
|
|
||||||
+ }
|
|
||||||
+ }
|
+ }
|
||||||
+ return i;
|
+ return i;
|
||||||
+ }
|
+ }
|
||||||
|
@ -57,7 +55,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@@ -807,7 +848,7 @@
|
@@ -807,7 +846,7 @@
|
||||||
this.showTab(aTab);
|
this.showTab(aTab);
|
||||||
if (this.tabContainer.verticalMode) {
|
if (this.tabContainer.verticalMode) {
|
||||||
this._handleTabMove(aTab, () =>
|
this._handleTabMove(aTab, () =>
|
||||||
|
@ -66,7 +64,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.moveTabTo(aTab, this.pinnedTabCount, { forceStandaloneTab: true });
|
this.moveTabTo(aTab, this.pinnedTabCount, { forceStandaloneTab: true });
|
||||||
@@ -828,7 +869,7 @@
|
@@ -828,7 +867,7 @@
|
||||||
// the moving of a tab from the vertical pinned tabs container
|
// the moving of a tab from the vertical pinned tabs container
|
||||||
// and back into arrowscrollbox.
|
// and back into arrowscrollbox.
|
||||||
aTab.removeAttribute("pinned");
|
aTab.removeAttribute("pinned");
|
||||||
|
@ -75,7 +73,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.moveTabTo(aTab, this.pinnedTabCount - 1, {
|
this.moveTabTo(aTab, this.pinnedTabCount - 1, {
|
||||||
@@ -1055,6 +1096,8 @@
|
@@ -1055,6 +1094,8 @@
|
||||||
|
|
||||||
let LOCAL_PROTOCOLS = ["chrome:", "about:", "resource:", "data:"];
|
let LOCAL_PROTOCOLS = ["chrome:", "about:", "resource:", "data:"];
|
||||||
|
|
||||||
|
@ -84,7 +82,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
if (
|
if (
|
||||||
aIconURL &&
|
aIconURL &&
|
||||||
!aLoadingPrincipal &&
|
!aLoadingPrincipal &&
|
||||||
@@ -1065,6 +1108,9 @@
|
@@ -1065,6 +1106,9 @@
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +92,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
|
|
||||||
let browser = this.getBrowserForTab(aTab);
|
let browser = this.getBrowserForTab(aTab);
|
||||||
browser.mIconURL = aIconURL;
|
browser.mIconURL = aIconURL;
|
||||||
@@ -1310,6 +1356,7 @@
|
@@ -1310,6 +1354,7 @@
|
||||||
if (!this._previewMode) {
|
if (!this._previewMode) {
|
||||||
newTab.recordTimeFromUnloadToReload();
|
newTab.recordTimeFromUnloadToReload();
|
||||||
newTab.updateLastAccessed();
|
newTab.updateLastAccessed();
|
||||||
|
@ -102,7 +100,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
oldTab.updateLastAccessed();
|
oldTab.updateLastAccessed();
|
||||||
// if this is the foreground window, update the last-seen timestamps.
|
// if this is the foreground window, update the last-seen timestamps.
|
||||||
if (this.ownerGlobal == BrowserWindowTracker.getTopWindow()) {
|
if (this.ownerGlobal == BrowserWindowTracker.getTopWindow()) {
|
||||||
@@ -1462,6 +1509,9 @@
|
@@ -1462,6 +1507,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
let activeEl = document.activeElement;
|
let activeEl = document.activeElement;
|
||||||
|
@ -112,7 +110,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
// If focus is on the old tab, move it to the new tab.
|
// If focus is on the old tab, move it to the new tab.
|
||||||
if (activeEl == oldTab) {
|
if (activeEl == oldTab) {
|
||||||
newTab.focus();
|
newTab.focus();
|
||||||
@@ -1785,7 +1835,7 @@
|
@@ -1785,7 +1833,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
_setTabLabel(aTab, aLabel, { beforeTabOpen, isContentTitle, isURL } = {}) {
|
_setTabLabel(aTab, aLabel, { beforeTabOpen, isContentTitle, isURL } = {}) {
|
||||||
|
@ -121,7 +119,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1888,7 +1938,7 @@
|
@@ -1888,7 +1936,7 @@
|
||||||
newIndex = this.selectedTab._tPos + 1;
|
newIndex = this.selectedTab._tPos + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +128,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
let browser;
|
let browser;
|
||||||
if (targetTab) {
|
if (targetTab) {
|
||||||
browser = this.getBrowserForTab(targetTab);
|
browser = this.getBrowserForTab(targetTab);
|
||||||
@@ -2222,7 +2272,8 @@
|
@@ -2222,7 +2270,8 @@
|
||||||
b.setAttribute("name", name);
|
b.setAttribute("name", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +138,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
b.setAttribute("transparent", "true");
|
b.setAttribute("transparent", "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2387,7 +2438,7 @@
|
@@ -2387,7 +2436,7 @@
|
||||||
|
|
||||||
let panel = this.getPanel(browser);
|
let panel = this.getPanel(browser);
|
||||||
let uniqueId = this._generateUniquePanelID();
|
let uniqueId = this._generateUniquePanelID();
|
||||||
|
@ -149,7 +147,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
aTab.linkedPanel = uniqueId;
|
aTab.linkedPanel = uniqueId;
|
||||||
|
|
||||||
// Inject the <browser> into the DOM if necessary.
|
// Inject the <browser> into the DOM if necessary.
|
||||||
@@ -2446,8 +2497,8 @@
|
@@ -2446,8 +2495,8 @@
|
||||||
// If we transitioned from one browser to two browsers, we need to set
|
// If we transitioned from one browser to two browsers, we need to set
|
||||||
// hasSiblings=false on both the existing browser and the new browser.
|
// hasSiblings=false on both the existing browser and the new browser.
|
||||||
if (this.tabs.length == 2) {
|
if (this.tabs.length == 2) {
|
||||||
|
@ -160,7 +158,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
} else {
|
} else {
|
||||||
aTab.linkedBrowser.browsingContext.hasSiblings = this.tabs.length > 1;
|
aTab.linkedBrowser.browsingContext.hasSiblings = this.tabs.length > 1;
|
||||||
}
|
}
|
||||||
@@ -2679,6 +2730,12 @@
|
@@ -2679,6 +2728,12 @@
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +171,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
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);
|
||||||
}
|
}
|
||||||
@@ -2742,6 +2799,12 @@
|
@@ -2742,6 +2797,12 @@
|
||||||
noInitialLabel,
|
noInitialLabel,
|
||||||
skipBackgroundNotify,
|
skipBackgroundNotify,
|
||||||
});
|
});
|
||||||
|
@ -186,7 +184,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
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
|
||||||
this._insertTabAtIndex(t, {
|
this._insertTabAtIndex(t, {
|
||||||
@@ -2885,6 +2948,9 @@
|
@@ -2885,6 +2946,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +194,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
// Additionally send pinned tab events
|
// Additionally send pinned tab events
|
||||||
if (pinned) {
|
if (pinned) {
|
||||||
this._notifyPinnedStatus(t);
|
this._notifyPinnedStatus(t);
|
||||||
@@ -3403,6 +3469,24 @@
|
@@ -3403,6 +3467,24 @@
|
||||||
) {
|
) {
|
||||||
tabWasReused = true;
|
tabWasReused = true;
|
||||||
tab = this.selectedTab;
|
tab = this.selectedTab;
|
||||||
|
@ -221,7 +219,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
if (!tabData.pinned) {
|
if (!tabData.pinned) {
|
||||||
this.unpinTab(tab);
|
this.unpinTab(tab);
|
||||||
} else {
|
} else {
|
||||||
@@ -3416,6 +3500,7 @@
|
@@ -3416,6 +3498,7 @@
|
||||||
restoreTabsLazily && !select && !tabData.pinned;
|
restoreTabsLazily && !select && !tabData.pinned;
|
||||||
|
|
||||||
let url = "about:blank";
|
let url = "about:blank";
|
||||||
|
@ -229,7 +227,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
if (tabData.entries?.length) {
|
if (tabData.entries?.length) {
|
||||||
let activeIndex = (tabData.index || tabData.entries.length) - 1;
|
let activeIndex = (tabData.index || tabData.entries.length) - 1;
|
||||||
// Ensure the index is in bounds.
|
// Ensure the index is in bounds.
|
||||||
@@ -3451,7 +3536,24 @@
|
@@ -3451,7 +3534,24 @@
|
||||||
skipLoad: true,
|
skipLoad: true,
|
||||||
preferredRemoteType,
|
preferredRemoteType,
|
||||||
});
|
});
|
||||||
|
@ -255,7 +253,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
if (select) {
|
if (select) {
|
||||||
tabToSelect = tab;
|
tabToSelect = tab;
|
||||||
}
|
}
|
||||||
@@ -3464,8 +3566,8 @@
|
@@ -3464,8 +3564,8 @@
|
||||||
// inserted in the DOM. If the tab is not yet in the DOM,
|
// inserted in the DOM. If the tab is not yet in the DOM,
|
||||||
// just insert it in the right place from the start.
|
// just insert it in the right place from the start.
|
||||||
if (!tab.parentNode) {
|
if (!tab.parentNode) {
|
||||||
|
@ -266,7 +264,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
tab.toggleAttribute("pinned", true);
|
tab.toggleAttribute("pinned", true);
|
||||||
this.tabContainer._invalidateCachedTabs();
|
this.tabContainer._invalidateCachedTabs();
|
||||||
// Then ensure all the tab open/pinning information is sent.
|
// Then ensure all the tab open/pinning information is sent.
|
||||||
@@ -3729,7 +3831,7 @@
|
@@ -3729,7 +3829,7 @@
|
||||||
// Ensure we have an index if one was not provided.
|
// Ensure we have an index if one was not provided.
|
||||||
if (typeof index != "number") {
|
if (typeof index != "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.
|
||||||
|
@ -275,7 +273,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
if (
|
if (
|
||||||
!bulkOrderedOpen &&
|
!bulkOrderedOpen &&
|
||||||
((openerTab &&
|
((openerTab &&
|
||||||
@@ -3780,7 +3882,7 @@
|
@@ -3780,7 +3880,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @type {MozTabbrowserTab|undefined} */
|
/** @type {MozTabbrowserTab|undefined} */
|
||||||
|
@ -284,7 +282,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
this.tabContainer._invalidateCachedTabs();
|
this.tabContainer._invalidateCachedTabs();
|
||||||
|
|
||||||
if (tabGroup) {
|
if (tabGroup) {
|
||||||
@@ -4095,6 +4197,9 @@
|
@@ -4095,6 +4195,9 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,7 +292,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
this.removeTabs(selectedTabs);
|
this.removeTabs(selectedTabs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4427,6 +4532,7 @@
|
@@ -4427,6 +4530,7 @@
|
||||||
skipSessionStore,
|
skipSessionStore,
|
||||||
} = {}
|
} = {}
|
||||||
) {
|
) {
|
||||||
|
@ -302,7 +300,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
if (UserInteraction.running("browser.tabs.opening", window)) {
|
if (UserInteraction.running("browser.tabs.opening", window)) {
|
||||||
UserInteraction.finish("browser.tabs.opening", window);
|
UserInteraction.finish("browser.tabs.opening", window);
|
||||||
}
|
}
|
||||||
@@ -4443,6 +4549,12 @@
|
@@ -4443,6 +4547,12 @@
|
||||||
TelemetryStopwatch.start("FX_TAB_CLOSE_TIME_NO_ANIM_MS", aTab);
|
TelemetryStopwatch.start("FX_TAB_CLOSE_TIME_NO_ANIM_MS", aTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,7 +313,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
// 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) {
|
||||||
@@ -4457,7 +4569,9 @@
|
@@ -4457,7 +4567,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;
|
||||||
|
@ -326,7 +324,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
if (
|
if (
|
||||||
!this._beginRemoveTab(aTab, {
|
!this._beginRemoveTab(aTab, {
|
||||||
closeWindowFastpath: true,
|
closeWindowFastpath: true,
|
||||||
@@ -4471,7 +4585,6 @@
|
@@ -4471,7 +4583,6 @@
|
||||||
TelemetryStopwatch.cancel("FX_TAB_CLOSE_TIME_NO_ANIM_MS", aTab);
|
TelemetryStopwatch.cancel("FX_TAB_CLOSE_TIME_NO_ANIM_MS", aTab);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -334,7 +332,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
let lockTabSizing =
|
let lockTabSizing =
|
||||||
!this.tabContainer.verticalMode &&
|
!this.tabContainer.verticalMode &&
|
||||||
!aTab.pinned &&
|
!aTab.pinned &&
|
||||||
@@ -4610,14 +4723,14 @@
|
@@ -4610,14 +4721,14 @@
|
||||||
!!this.tabsInCollapsedTabGroups.length;
|
!!this.tabsInCollapsedTabGroups.length;
|
||||||
if (
|
if (
|
||||||
aTab.visible &&
|
aTab.visible &&
|
||||||
|
@ -351,7 +349,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
|
|
||||||
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,
|
||||||
@@ -4641,6 +4754,7 @@
|
@@ -4641,6 +4752,7 @@
|
||||||
|
|
||||||
newTab = true;
|
newTab = true;
|
||||||
}
|
}
|
||||||
|
@ -359,7 +357,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
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.
|
||||||
@@ -4681,9 +4795,7 @@
|
@@ -4681,9 +4793,7 @@
|
||||||
aTab._mouseleave();
|
aTab._mouseleave();
|
||||||
|
|
||||||
if (newTab) {
|
if (newTab) {
|
||||||
|
@ -370,7 +368,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
} else {
|
} else {
|
||||||
TabBarVisibility.update();
|
TabBarVisibility.update();
|
||||||
}
|
}
|
||||||
@@ -4812,6 +4924,8 @@
|
@@ -4812,6 +4922,8 @@
|
||||||
this.tabs[i]._tPos = i;
|
this.tabs[i]._tPos = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,7 +377,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
if (!this._windowIsClosing) {
|
if (!this._windowIsClosing) {
|
||||||
if (wasPinned) {
|
if (wasPinned) {
|
||||||
this.tabContainer._positionPinnedTabs();
|
this.tabContainer._positionPinnedTabs();
|
||||||
@@ -5025,7 +5139,7 @@
|
@@ -5025,7 +5137,7 @@
|
||||||
!excludeTabs.has(aTab.owner) &&
|
!excludeTabs.has(aTab.owner) &&
|
||||||
Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose")
|
Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose")
|
||||||
) {
|
) {
|
||||||
|
@ -388,7 +386,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to find a remaining tab that comes after the given tab
|
// Try to find a remaining tab that comes after the given tab
|
||||||
@@ -5047,7 +5161,7 @@
|
@@ -5047,7 +5159,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tab) {
|
if (tab) {
|
||||||
|
@ -397,7 +395,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
@@ -5465,10 +5579,10 @@
|
@@ -5465,10 +5577,10 @@
|
||||||
SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
|
SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,19 +408,19 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
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.
|
||||||
@@ -5706,9 +5820,9 @@
|
@@ -5706,9 +5818,9 @@
|
||||||
|
|
||||||
// Don't allow mixing pinned and unpinned tabs.
|
// Don't allow mixing pinned and unpinned tabs.
|
||||||
if (aTab.pinned) {
|
if (aTab.pinned) {
|
||||||
- aIndex = Math.min(aIndex, this.pinnedTabCount - 1);
|
- aIndex = Math.min(aIndex, this.pinnedTabCount - 1);
|
||||||
+ aIndex = Math.min(aIndex, (aTab.hasAttribute('zen-essential') ? this._numZenEssentials : this._numVisiblePinTabsWithoutGlance) - 1);
|
+ aIndex = aTab.hasAttribute('zen-essential') ? Math.min(aIndex, this._numVisiblePinTabsWithoutGlance) : Math.min(aIndex, this._numVisiblePinTabs);
|
||||||
} else {
|
} else {
|
||||||
- aIndex = Math.max(aIndex, this.pinnedTabCount);
|
- aIndex = Math.max(aIndex, this.pinnedTabCount);
|
||||||
+ aIndex = Math.max(aIndex, this._numVisiblePinTabsWithoutGlance);
|
+ aIndex = Math.max(aIndex, this._numVisiblePinTabsWithoutGlance + this._numZenEssentials);
|
||||||
}
|
}
|
||||||
if (aTab._tPos == aIndex) {
|
if (aTab._tPos == aIndex) {
|
||||||
return;
|
return;
|
||||||
@@ -5717,7 +5831,7 @@
|
@@ -5717,7 +5829,7 @@
|
||||||
this._lastRelatedTabMap = new WeakMap();
|
this._lastRelatedTabMap = new WeakMap();
|
||||||
|
|
||||||
this._handleTabMove(aTab, () => {
|
this._handleTabMove(aTab, () => {
|
||||||
|
@ -431,7 +429,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
if (forceStandaloneTab && neighbor.group) {
|
if (forceStandaloneTab && neighbor.group) {
|
||||||
neighbor = neighbor.group;
|
neighbor = neighbor.group;
|
||||||
}
|
}
|
||||||
@@ -5802,7 +5916,7 @@
|
@@ -5802,7 +5914,7 @@
|
||||||
createLazyBrowser,
|
createLazyBrowser,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -440,7 +438,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
if (aIndex < numPinned || (aTab.pinned && aIndex == numPinned)) {
|
if (aIndex < numPinned || (aTab.pinned && aIndex == numPinned)) {
|
||||||
params.pinned = true;
|
params.pinned = true;
|
||||||
}
|
}
|
||||||
@@ -7443,6 +7557,7 @@
|
@@ -7443,6 +7555,7 @@
|
||||||
aWebProgress.isTopLevel
|
aWebProgress.isTopLevel
|
||||||
) {
|
) {
|
||||||
this.mTab.setAttribute("busy", "true");
|
this.mTab.setAttribute("busy", "true");
|
||||||
|
@ -448,7 +446,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
gBrowser._tabAttrModified(this.mTab, ["busy"]);
|
gBrowser._tabAttrModified(this.mTab, ["busy"]);
|
||||||
this.mTab._notselectedsinceload = !this.mTab.selected;
|
this.mTab._notselectedsinceload = !this.mTab.selected;
|
||||||
gBrowser.syncThrobberAnimations(this.mTab);
|
gBrowser.syncThrobberAnimations(this.mTab);
|
||||||
@@ -8411,7 +8526,7 @@ var TabContextMenu = {
|
@@ -8411,7 +8524,7 @@ var TabContextMenu = {
|
||||||
);
|
);
|
||||||
contextUnpinSelectedTabs.hidden =
|
contextUnpinSelectedTabs.hidden =
|
||||||
!this.contextTab.pinned || !multiselectionContext;
|
!this.contextTab.pinned || !multiselectionContext;
|
||||||
|
@ -457,7 +455,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
// Move Tab items
|
// Move Tab items
|
||||||
let contextMoveTabOptions = document.getElementById(
|
let contextMoveTabOptions = document.getElementById(
|
||||||
"context_moveTabOptions"
|
"context_moveTabOptions"
|
||||||
@@ -8444,7 +8559,7 @@ var TabContextMenu = {
|
@@ -8444,7 +8557,7 @@ var TabContextMenu = {
|
||||||
let contextMoveTabToStart = document.getElementById("context_moveToStart");
|
let contextMoveTabToStart = document.getElementById("context_moveToStart");
|
||||||
let isFirstTab =
|
let isFirstTab =
|
||||||
tabsToMove[0] == visibleTabs[0] ||
|
tabsToMove[0] == visibleTabs[0] ||
|
||||||
|
@ -466,7 +464,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..04056ab93316968babcf329215917312
|
||||||
contextMoveTabToStart.disabled = isFirstTab && allSelectedTabsAdjacent;
|
contextMoveTabToStart.disabled = isFirstTab && allSelectedTabsAdjacent;
|
||||||
|
|
||||||
document.getElementById("context_openTabInWindow").disabled =
|
document.getElementById("context_openTabInWindow").disabled =
|
||||||
@@ -8677,6 +8792,7 @@ var TabContextMenu = {
|
@@ -8677,6 +8790,7 @@ var TabContextMenu = {
|
||||||
if (this.contextTab.multiselected) {
|
if (this.contextTab.multiselected) {
|
||||||
gBrowser.removeMultiSelectedTabs();
|
gBrowser.removeMultiSelectedTabs();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue