fix: skip permitUnload when fully opening glance

This commit is contained in:
Slowlife01
2025-04-04 16:54:20 +07:00
parent 513f04d41b
commit a3a82b9fe7

View File

@@ -234,15 +234,17 @@
}); });
} }
closeGlance({ noAnimation = false, onTabClose = false, setNewID = null, isDifferent = false, hasFocused = false } = {}) { closeGlance({ noAnimation = false, onTabClose = false, setNewID = null, isDifferent = false, hasFocused = false, skipPermitUnload = false } = {}) {
if (this._animating || !this.#currentBrowser || this.animatingOpen || this._duringOpening) { if (this._animating || !this.#currentBrowser || this.animatingOpen || this._duringOpening) {
return; return;
} }
if (!skipPermitUnload) {
let { permitUnload } = this.#currentBrowser.permitUnload(); let { permitUnload } = this.#currentBrowser.permitUnload();
if (!permitUnload) { if (!permitUnload) {
return; return;
} }
}
if (onTabClose && hasFocused && !this.#confirmationTimeout) { if (onTabClose && hasFocused && !this.#confirmationTimeout) {
const cancelButton = document.getElementById('zen-glance-sidebar-close'); const cancelButton = document.getElementById('zen-glance-sidebar-close');
@@ -545,7 +547,7 @@
this.overlay.classList.remove('zen-glance-overlay'); this.overlay.classList.remove('zen-glance-overlay');
this._clearContainerStyles(this.browserWrapper); this._clearContainerStyles(this.browserWrapper);
this.animatingFullOpen = false; this.animatingFullOpen = false;
this.closeGlance({ noAnimation: true }); this.closeGlance({ noAnimation: true, skipPermitUnload: true });
this.#glances.delete(this.#currentGlanceID); this.#glances.delete(this.#currentGlanceID);
} }