Skip to content

Commit c9bb6b2

Browse files
Merge pull request #7292 from Slowlife01/glance-permitunload
fix: skip permitUnload when fully opening glance
2 parents 513f04d + 3bf4339 commit c9bb6b2

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/browser/base/zen-components/ZenGlanceManager.mjs

+14-5
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,23 @@
234234
});
235235
}
236236

237-
closeGlance({ noAnimation = false, onTabClose = false, setNewID = null, isDifferent = false, hasFocused = false } = {}) {
237+
closeGlance({
238+
noAnimation = false,
239+
onTabClose = false,
240+
setNewID = null,
241+
isDifferent = false,
242+
hasFocused = false,
243+
skipPermitUnload = false,
244+
} = {}) {
238245
if (this._animating || !this.#currentBrowser || this.animatingOpen || this._duringOpening) {
239246
return;
240247
}
241248

242-
let { permitUnload } = this.#currentBrowser.permitUnload();
243-
if (!permitUnload) {
244-
return;
249+
if (!skipPermitUnload) {
250+
let { permitUnload } = this.#currentBrowser.permitUnload();
251+
if (!permitUnload) {
252+
return;
253+
}
245254
}
246255

247256
if (onTabClose && hasFocused && !this.#confirmationTimeout) {
@@ -545,7 +554,7 @@
545554
this.overlay.classList.remove('zen-glance-overlay');
546555
this._clearContainerStyles(this.browserWrapper);
547556
this.animatingFullOpen = false;
548-
this.closeGlance({ noAnimation: true });
557+
this.closeGlance({ noAnimation: true, skipPermitUnload: true });
549558
this.#glances.delete(this.#currentGlanceID);
550559
}
551560

0 commit comments

Comments
 (0)