mirror of
https://github.com/zen-browser/desktop.git
synced 2025-07-10 21:35:29 +02:00
Add debug logging for pinned tab manager and ensure session store initialization
This commit is contained in:
parent
1e3b1a6605
commit
c44c63d5ce
4 changed files with 18 additions and 6 deletions
|
@ -170,6 +170,7 @@ pref('zen.tab-unloader.enabled', true);
|
|||
pref('zen.tab-unloader.timeout-minutes', 20);
|
||||
pref('zen.tab-unloader.excluded-urls', "example.com,example.org");
|
||||
|
||||
pref('zen.pinned-tab-manager.debug', false);
|
||||
pref('zen.pinned-tab-manager.restore-pinned-tabs-to-pinned-url', false);
|
||||
pref('zen.pinned-tab-manager.close-shortcut-behavior', 'switch');
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
var ZenPinnedTabsStorage = {
|
||||
async init() {
|
||||
await SessionStore.promiseInitialized;
|
||||
await this._ensureTable();
|
||||
},
|
||||
|
||||
|
@ -47,6 +46,7 @@ var ZenPinnedTabsStorage = {
|
|||
CREATE INDEX IF NOT EXISTS idx_zen_pins_changes_uuid ON zen_pins_changes(uuid)
|
||||
`);
|
||||
|
||||
await SessionStore.promiseInitialized;
|
||||
this._resolveInitialized();
|
||||
});
|
||||
},
|
||||
|
|
|
@ -30,9 +30,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||
});
|
||||
|
||||
async waitForPromises() {
|
||||
await SessionStore.promiseInitialized;
|
||||
await this.promiseDBInitialized;
|
||||
await this.promisePinnedInitialized;
|
||||
await Promise.all([this.promiseDBInitialized, this.promisePinnedInitialized, SessionStore.promiseInitialized]);
|
||||
}
|
||||
|
||||
async init() {
|
||||
|
@ -384,13 +382,13 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||
}
|
||||
|
||||
async initializeWorkspaces() {
|
||||
await this.waitForPromises();
|
||||
await this.initializeWorkspacesButton();
|
||||
if (this.workspaceEnabled) {
|
||||
this._initializeWorkspaceCreationIcons();
|
||||
this._initializeWorkspaceTabContextMenus();
|
||||
await this.workspaceBookmarks();
|
||||
window.addEventListener('TabBrowserInserted', this.onTabBrowserInserted.bind(this));
|
||||
await this.waitForPromises();
|
||||
let workspaces = await this._workspaces();
|
||||
let activeWorkspace = null;
|
||||
if (workspaces.workspaces.length === 0) {
|
||||
|
@ -1358,7 +1356,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||
this.tabContainer.removeAttribute('dont-animate-tabs');
|
||||
// Also animate the workspace indicator label
|
||||
this._animateElement(document.getElementById('zen-current-workspace-indicator'), direction, out, () => onAnimationEnd());
|
||||
this._animateElement(document.getElementById('tabbrowser-arrowscrollbox-periphery'), direction, out, () => onAnimationEnd());
|
||||
this._animateElement(document.getElementById('tabbrowser-arrowscrollbox-periphery'), direction, out, () =>
|
||||
onAnimationEnd()
|
||||
);
|
||||
for (const tab of tabs) {
|
||||
this._animateElement(tab, direction, out, () => onAnimationEnd());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue