mirror of
https://github.com/zen-browser/desktop.git
synced 2026-02-05 11:27:16 +00:00
(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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user