mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-09 19:36:53 +00:00
Enhance tab closing behavior with permitUnload check and update test for consistency
This commit is contained in:
@@ -211,6 +211,11 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let { permitUnload } = this.#currentBrowser.permitUnload();
|
||||||
|
if (!permitUnload) {
|
||||||
|
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');
|
||||||
cancelButton.setAttribute('waitconfirmation', true);
|
cancelButton.setAttribute('waitconfirmation', true);
|
||||||
@@ -300,7 +305,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// reset everything
|
// reset everything
|
||||||
const prevOverlay = this.overlay;
|
|
||||||
this.browserWrapper = null;
|
this.browserWrapper = null;
|
||||||
this.overlay = null;
|
this.overlay = null;
|
||||||
this.contentWrapper = null;
|
this.contentWrapper = null;
|
||||||
@@ -312,7 +316,7 @@
|
|||||||
gBrowser.selectedTab = this.#currentParentTab;
|
gBrowser.selectedTab = this.#currentParentTab;
|
||||||
}
|
}
|
||||||
this._ignoreClose = true;
|
this._ignoreClose = true;
|
||||||
gBrowser.removeTab(this.lastCurrentTab, { animate: true });
|
gBrowser.removeTab(this.lastCurrentTab, { animate: true, skipPermitUnload: true });
|
||||||
gBrowser.tabContainer._invalidateCachedTabs();
|
gBrowser.tabContainer._invalidateCachedTabs();
|
||||||
|
|
||||||
this.#currentParentTab.removeAttribute('glance-id');
|
this.#currentParentTab.removeAttribute('glance-id');
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
https://creativecommons.org/publicdomain/zero/1.0/ */
|
https://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
add_task(async function test_TODO() {
|
add_task(async function test_TODO() {
|
||||||
ok(true, "TODO: implement the test");
|
ok(true, 'TODO: implement the test');
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user