Merge pull request #3033 from kristijanribaric/fix/restore-pinned-tabs-to-base-url-on-startup-when-setting-is-checked

Fix: Restore pinned tabs to their pinned URLs on startup if the option is checked
This commit is contained in:
mr. m 🤙
2024-11-16 11:40:54 +01:00
committed by GitHub
2 changed files with 8 additions and 4 deletions

View File

@@ -68,9 +68,9 @@
return this._enabled;
}
async _refreshPinnedTabs() {
async _refreshPinnedTabs({ init = false } = {}) {
await this._initializePinsCache();
this._initializePinnedTabs();
this._initializePinnedTabs(init);
}
async _initializePinsCache() {
@@ -109,7 +109,7 @@
return this._pinsCache;
}
_initializePinnedTabs() {
_initializePinnedTabs(init = false) {
const pins = this._pinsCache;
if (!pins?.length) {
return;
@@ -130,6 +130,10 @@
// This is a valid pinned tab that matches a pin
pinnedTabsByUUID.set(pinId, tab);
pinsToCreate.delete(pinId);
if(lazy.zenPinnedTabRestorePinnedTabsToPinnedUrl && init) {
this._resetTabToStoredState(tab);
}
} else {
// This is a pinned tab that no longer has a corresponding pin
gBrowser.removeTab(tab);

View File

@@ -48,7 +48,7 @@ var ZenPinnedTabsStorage = {
CREATE INDEX IF NOT EXISTS idx_zen_pins_changes_uuid ON zen_pins_changes(uuid)
`);
await gZenPinnedTabManager._refreshPinnedTabs();
await gZenPinnedTabManager._refreshPinnedTabs({init: true});
});
},