forked from ZenBrowserMirrors/zen-desktop
fix: Enable Restore pinned tabs to their originally pinned URL on startup setting does not work, b=(bug #7453), c=tabs
This commit is contained in:
parent
746ac1eec7
commit
ee28417a4c
2 changed files with 20 additions and 20 deletions
|
@ -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 5f406ea5d09273c9b70b84eee24c6267f88692f8..c7c3f7a97c79ce2a298e0673d62587619c4d936b 100644
|
index 5f406ea5d09273c9b70b84eee24c6267f88692f8..be8740305b28cfc7752ad8f48ca94e69f8d324d1 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
|
||||||
@@ -424,11 +424,67 @@
|
@@ -424,11 +424,67 @@
|
||||||
|
@ -347,11 +347,12 @@ index 5f406ea5d09273c9b70b84eee24c6267f88692f8..c7c3f7a97c79ce2a298e0673d6258761
|
||||||
if (!tabData.pinned) {
|
if (!tabData.pinned) {
|
||||||
this.unpinTab(tab);
|
this.unpinTab(tab);
|
||||||
} else {
|
} else {
|
||||||
@@ -3557,7 +3682,27 @@
|
@@ -3557,8 +3682,28 @@
|
||||||
skipLoad: true,
|
skipLoad: true,
|
||||||
preferredRemoteType,
|
preferredRemoteType,
|
||||||
});
|
});
|
||||||
-
|
-
|
||||||
|
- if (select) {
|
||||||
+ if (tabData.zenWorkspace) {
|
+ if (tabData.zenWorkspace) {
|
||||||
+ tab.setAttribute("zen-workspace-id", tabData.zenWorkspace);
|
+ tab.setAttribute("zen-workspace-id", tabData.zenWorkspace);
|
||||||
+ }
|
+ }
|
||||||
|
@ -373,9 +374,10 @@ index 5f406ea5d09273c9b70b84eee24c6267f88692f8..c7c3f7a97c79ce2a298e0673d6258761
|
||||||
+ if (tabData.zenPinnedEntry) {
|
+ if (tabData.zenPinnedEntry) {
|
||||||
+ tab.setAttribute("zen-pinned-entry", tabData.zenPinnedEntry);
|
+ tab.setAttribute("zen-pinned-entry", tabData.zenPinnedEntry);
|
||||||
+ }
|
+ }
|
||||||
if (select) {
|
+ if (select && !tabData.pinned) {
|
||||||
tabToSelect = tab;
|
tabToSelect = tab;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -3570,8 +3715,8 @@
|
@@ -3570,8 +3715,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.
|
||||||
|
|
|
@ -195,15 +195,7 @@
|
||||||
pinsToCreate.delete(pinId);
|
pinsToCreate.delete(pinId);
|
||||||
|
|
||||||
if (lazy.zenPinnedTabRestorePinnedTabsToPinnedUrl && init) {
|
if (lazy.zenPinnedTabRestorePinnedTabsToPinnedUrl && init) {
|
||||||
tab.addEventListener(
|
this._resetTabToStoredState(tab);
|
||||||
'SSTabRestored',
|
|
||||||
() => {
|
|
||||||
this._resetTabToStoredState(event.target);
|
|
||||||
},
|
|
||||||
{
|
|
||||||
once: true,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// This is a pinned tab that no longer has a corresponding pin
|
// This is a pinned tab that no longer has a corresponding pin
|
||||||
|
@ -566,7 +558,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async _resetTabToStoredState(tab) {
|
_resetTabToStoredState(tab) {
|
||||||
const id = tab.getAttribute('zen-pin-id');
|
const id = tab.getAttribute('zen-pin-id');
|
||||||
if (!id) {
|
if (!id) {
|
||||||
return;
|
return;
|
||||||
|
@ -580,13 +572,19 @@
|
||||||
const tabState = SessionStore.getTabState(tab);
|
const tabState = SessionStore.getTabState(tab);
|
||||||
const state = JSON.parse(tabState);
|
const state = JSON.parse(tabState);
|
||||||
|
|
||||||
state.entries = [
|
const foundEntryIndex = state.entries?.findIndex((entry) => entry.url === pin.url);
|
||||||
{
|
if (!foundEntryIndex || foundEntryIndex === -1) {
|
||||||
url: pin.url,
|
state.entries = [
|
||||||
title: pin.title,
|
{
|
||||||
triggeringPrincipal_base64: lazy.E10SUtils.SERIALIZED_SYSTEMPRINCIPAL,
|
url: pin.url,
|
||||||
},
|
title: pin.title,
|
||||||
];
|
triggeringPrincipal_base64: lazy.E10SUtils.SERIALIZED_SYSTEMPRINCIPAL,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
// Remove everything except the entry we want to keep
|
||||||
|
state.entries = [state.entries[foundEntryIndex]];
|
||||||
|
}
|
||||||
|
|
||||||
state.image = pin.iconUrl || null;
|
state.image = pin.iconUrl || null;
|
||||||
state.index = 0;
|
state.index = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue