Add debug logging for pinned tab manager and ensure session store initialization

This commit is contained in:
mr. M 2025-01-18 21:38:12 +01:00
parent 1e3b1a6605
commit c44c63d5ce
No known key found for this signature in database
GPG key ID: CBD57A2AEDBDA1FB
4 changed files with 18 additions and 6 deletions

View file

@ -51,6 +51,7 @@
if (!this.enabled) {
return;
}
this._canLog = Services.prefs.getBoolPref('zen.pinned-tab-manager.debug', false);
this.observer = new ZenPinnedTabsObserver();
this._initClosePinnedTabShortcut();
this._insertItemsIntoTabContextMenu();
@ -71,6 +72,12 @@
await this._refreshPinnedTabs(newWorkspace, { init: onInit });
}
log(message) {
if (this._canLog) {
console.log(`[ZenPinnedTabManager] ${message}`);
}
}
onTabIconChanged(tab, url = null) {
const iconUrl = url ?? tab.iconImage.src;
if (tab.hasAttribute('zen-essential')) {
@ -128,6 +135,7 @@
this._pinsCache = [];
}
this.log(`Initialized pins cache with ${this._pinsCache.length} pins`);
return this._pinsCache;
}
@ -224,6 +232,7 @@
SessionStore.setTabState(newTab, state);
}
this.log(`Created new pinned tab for pin ${pin.uuid} (isEssential: ${pin.isEssential})`);
gBrowser.pinTab(newTab);
newTab.initialize();
@ -372,6 +381,7 @@
return;
}
this.log(`Setting pinned attributes for tab ${tab.linkedBrowser.currentURI.spec}`);
const browser = tab.linkedBrowser;
const uuid = gZenUIManager.generateUuidv4();
@ -413,6 +423,7 @@
return;
}
this.log(`Removing pinned attributes for tab ${tab.getAttribute('zen-pin-id')}`);
await ZenPinnedTabsStorage.removePin(tab.getAttribute('zen-pin-id'));
if (!isClosing) {