(fix) Migrate pinned tabs from older Zen versions

If there are no pinned tabs in the database on startup,
assume it's a migration from an older version and save all
currently pinned tabs to the database.  Previously, Zen
would remove any pinned tabs that didn't have a `zen-pin-id`
attribute, which would occur during migration. This change
ensures that pinned tabs are preserved during upgrades.
This commit is contained in:
Kristijan Ribarić
2024-11-07 11:40:44 +01:00
parent e086cf56fc
commit 696a2148f0

View File

@@ -96,10 +96,13 @@
_initializePinnedTabs() {
const pins = this._pinsCache;
if (!pins?.length) {
// If there are no pins, we should remove any existing pinned tabs
// If there are no pins in the database it's probably migration from an older version - save all pinned tabs to the database
for (let tab of gBrowser.tabs) {
if (tab.pinned && !tab.getAttribute("zen-pin-id")) {
gBrowser.removeTab(tab);
if (tab.pinned) {
if(tab.hasAttribute("zen-pin-id")) {
tab.removeAttribute("zen-pin-id");
}
this._setPinnedAttributes(tab);
}
}
return;