mirror of
https://github.com/zen-browser/components.git
synced 2025-07-07 11:15:29 +02:00
Refactor ZenGlanceManager.mjs to destroy current browser when closing glance
This commit is contained in:
parent
5e791df74c
commit
b8d9d79ccc
2 changed files with 17 additions and 6 deletions
|
@ -163,6 +163,7 @@
|
|||
this.browserWrapper.removeAttribute("animate-end");
|
||||
|
||||
setTimeout(() => {
|
||||
this.#currentBrowser?.destroy();
|
||||
this.#currentBrowser?.remove();
|
||||
this.#currentTab?.remove();
|
||||
this.#currentBrowser = null;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue