Enhance tab closing behavior with permitUnload check and update test for consistency

This commit is contained in:
mr. M
2025-03-13 01:11:45 +01:00
parent f14f87b54e
commit 8ee527a3d0
2 changed files with 8 additions and 4 deletions

View File

@@ -211,6 +211,11 @@
return;
}
let { permitUnload } = this.#currentBrowser.permitUnload();
if (!permitUnload) {
return;
}
if (onTabClose && hasFocused && !this.#confirmationTimeout) {
const cancelButton = document.getElementById('zen-glance-sidebar-close');
cancelButton.setAttribute('waitconfirmation', true);
@@ -300,7 +305,6 @@
}
// reset everything
const prevOverlay = this.overlay;
this.browserWrapper = null;
this.overlay = null;
this.contentWrapper = null;
@@ -312,7 +316,7 @@
gBrowser.selectedTab = this.#currentParentTab;
}
this._ignoreClose = true;
gBrowser.removeTab(this.lastCurrentTab, { animate: true });
gBrowser.removeTab(this.lastCurrentTab, { animate: true, skipPermitUnload: true });
gBrowser.tabContainer._invalidateCachedTabs();
this.#currentParentTab.removeAttribute('glance-id');

View File

@@ -1,8 +1,8 @@
/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
'use strict';
add_task(async function test_TODO() {
ok(true, "TODO: implement the test");
ok(true, 'TODO: implement the test');
});