Fixed unloading a tab on startup

This commit is contained in:
mr. m
2025-02-23 08:41:41 +01:00
parent 951cdc2d51
commit 1a94159bc9
2 changed files with 13 additions and 2 deletions

View File

@@ -128,13 +128,20 @@
class ZenTabUnloader extends ZenDOMOperatedFeature {
static ACTIVITY_MODIFIERS = ['muted', 'soundplaying', 'label', 'attention'];
constructor() {
super();
if (!lazy.zenTabUnloaderEnabled) {
return;
}
this.intervalUnloader = new ZenTabsIntervalUnloader(this);
}
init() {
if (!lazy.zenTabUnloaderEnabled) {
return;
}
this.insertIntoContextMenu();
this.observer = new ZenTabsObserver();
this.intervalUnloader = new ZenTabsIntervalUnloader(this);
this.observer.addTabsListener(this.onTabEvent.bind(this));
}

View File

@@ -599,7 +599,11 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
let showed = false;
if (currentTab.pinned) {
this.selectEmptyTab();
gZenTabUnloader.explicitUnloadTabs([currentTab]);
try {
gZenTabUnloader.explicitUnloadTabs([currentTab]);
} catch (e) {
console.error('ZenWorkspaces: Error unloading tab', e);
}
showed = true;
} else {
const currentTabURL = currentTab.linkedBrowser?.currentURI?.spec;