Refactor ZenGlanceManager.mjs to destroy current browser when closing glance

This commit is contained in:
mr. M 2024-10-31 14:26:21 +01:00
parent 5e791df74c
commit b8d9d79ccc
No known key found for this signature in database
GPG key ID: CBD57A2AEDBDA1FB
2 changed files with 17 additions and 6 deletions

View file

@ -163,6 +163,7 @@
this.browserWrapper.removeAttribute("animate-end");
setTimeout(() => {
this.#currentBrowser?.destroy();
this.#currentBrowser?.remove();
this.#currentTab?.remove();
this.#currentBrowser = null;

View file

@ -115,9 +115,11 @@
}
const currentTimestamp = Date.now();
const excludedUrls = this.excludedUrls;
for (const tab of this.unloader.tabs) {
const tabs = gBrowser.tabs;
for (let i = 0; i < tabs.length; i++) {
const tab = tabs[i];
if (this.unloader.canUnloadTab(tab, currentTimestamp, excludedUrls)) {
tab.ownerGlobal.gBrowser.discardBrowser(tab);
this.unloader.unload(tab);
}
}
}
@ -216,23 +218,31 @@
document.getElementById('context_closeDuplicateTabs').parentNode.appendChild(element);
}
unload(tab) {
gBrowser.discardBrowser(tab);
tab.removeAttribute('linkedpanel');
}
unloadTab() {
const tabs = TabContextMenu.contextTab.multiselected ? gBrowser.selectedTabs : [TabContextMenu.contextTab];
for (const tab of tabs) {
gBrowser.discardBrowser(tab);
for (let i = 0; i < tabs.length; i++) {
const tab = tabs[i];
this.unload(tab);
}
}
preventUnloadTab() {
const tabs = TabContextMenu.contextTab.multiselected ? gBrowser.selectedTabs : [TabContextMenu.contextTab];
for (const tab of tabs) {
for (let i = 0; i < tabs.length; i++) {
const tab = tabs[i];
tab.zenIgnoreUnload = true;
}
}
ignoreUnloadTab() {
const tabs = TabContextMenu.contextTab.multiselected ? gBrowser.selectedTabs : [TabContextMenu.contextTab];
for (const tab of tabs) {
for (let i = 0; i < tabs.length; i++) {
const tab = tabs[i];
tab.zenIgnoreUnload = false;
}
}