Merge pull request #7218 from Slowlife01/unload

fix: skip permit unload if already checked
This commit is contained in:
mr. m
2025-04-02 21:25:14 +02:00
committed by GitHub
3 changed files with 20 additions and 5 deletions

View File

@@ -148,7 +148,9 @@ class ZenMediaController {
}
showMediaControls() {
if (this._currentMediaController?.isBeingUsedInPIPModeOrFullscreen) return this.hideMediaControls();
if (!this._currentMediaController) return;
if (this._currentMediaController.isBeingUsedInPIPModeOrFullscreen) return this.hideMediaControls();
if (!this.mediaControlBar.hasAttribute('hidden')) return;
this.updatePipButton();
@@ -485,6 +487,8 @@ class ZenMediaController {
}
updatePipButton() {
if (!this._currentBrowser) return;
const isPipEligible = this.pipEligibilityMap.get(this._currentBrowser.browserId);
if (isPipEligible) this.mediaControlBar.setAttribute('can-pip', '');
else this.mediaControlBar.removeAttribute('can-pip');

View File

@@ -217,8 +217,8 @@
document.getElementById('context_closeDuplicateTabs').parentNode.appendChild(element);
}
unload(tab) {
gBrowser.explicitUnloadTabs([tab]);
unload(tab, skipPermitUnload = false) {
gBrowser.explicitUnloadTabs([tab], skipPermitUnload);
tab.removeAttribute('linkedpanel');
}
@@ -230,7 +230,7 @@
explicitUnloadTabs(tabs, extraArgs = {}) {
for (let i = 0; i < tabs.length; i++) {
if (this.canUnloadTab(tabs[i], Date.now(), this.intervalUnloader.excludedUrls, true, extraArgs)) {
this.unload(tabs[i]);
this.unload(tabs[i], true);
}
}
}

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
index 5f406ea5d09273c9b70b84eee24c6267f88692f8..65c22c405fd1b9497df9ade0ff0b343c459be4eb 100644
index 5f406ea5d09273c9b70b84eee24c6267f88692f8..70cde185cb560a325f894c0ce79f1344b86e2a7c 100644
--- a/browser/components/tabbrowser/content/tabbrowser.js
+++ b/browser/components/tabbrowser/content/tabbrowser.js
@@ -424,11 +424,67 @@
@@ -553,6 +553,17 @@ index 5f406ea5d09273c9b70b84eee24c6267f88692f8..65c22c405fd1b9497df9ade0ff0b343c
if (!this._windowIsClosing) {
if (wasPinned) {
this.tabContainer._positionPinnedTabs();
@@ -5064,8 +5228,8 @@
return closedCount;
}
- async explicitUnloadTabs(tabs) {
- let unloadBlocked = await this.runBeforeUnloadForTabs(tabs);
+ async explicitUnloadTabs(tabs, skipPermitUnload = false) {
+ let unloadBlocked = skipPermitUnload ? false : await this.runBeforeUnloadForTabs(tabs);
if (unloadBlocked) {
return;
}
@@ -5159,7 +5323,7 @@
!excludeTabs.has(aTab.owner) &&
Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose")