mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-16 14:56:14 +00:00
fix: enhance tab unloading logic with permitUnload check and update candidate version and update to firefox 136.0.2
This commit is contained in:
@@ -360,7 +360,11 @@ menuitem {
|
||||
& .zen-toast {
|
||||
padding: 0.9rem 0.8rem;
|
||||
border-radius: 12px;
|
||||
background: linear-gradient(170deg, var(--zen-primary-color) -40%, color-mix(in srgb, var(--zen-primary-color) 85%, #0f0f0f 15%));
|
||||
background: linear-gradient(
|
||||
170deg,
|
||||
var(--zen-primary-color) -40%,
|
||||
color-mix(in srgb, var(--zen-primary-color) 85%, #0f0f0f 15%)
|
||||
);
|
||||
color: var(--button-primary-color);
|
||||
box-shadow: 0 0 14px 3px rgba(0, 0, 0, 0.05);
|
||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||
|
@@ -269,7 +269,7 @@
|
||||
}
|
||||
|
||||
#tabbrowser-tabs:not([movingtab]) & .tab-content > image:active {
|
||||
scale: var(--zen-active-tab-scale);
|
||||
scale: 0.92;
|
||||
}
|
||||
|
||||
& .tab-icon-image {
|
||||
|
@@ -510,6 +510,10 @@
|
||||
case 'unload-switch':
|
||||
case 'reset-switch':
|
||||
case 'switch':
|
||||
let { permitUnload } = selectedTab.linkedBrowser?.permitUnload();
|
||||
if (!permitUnload) {
|
||||
return;
|
||||
}
|
||||
this._handleTabSwitch(selectedTab);
|
||||
if (behavior.includes('reset')) {
|
||||
this._resetTabToStoredState(selectedTab);
|
||||
@@ -520,8 +524,7 @@
|
||||
}
|
||||
// Do not unload about:* pages
|
||||
if (!selectedTab.linkedBrowser?.currentURI.spec.startsWith('about:')) {
|
||||
gBrowser.explicitUnloadTabs([selectedTab]);
|
||||
selectedTab.removeAttribute('linkedpanel');
|
||||
gZenTabUnloader.explicitUnloadTabs([selectedTab], { permitUnload });
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@@ -235,9 +235,9 @@
|
||||
this.explicitUnloadTabs(tabs);
|
||||
}
|
||||
|
||||
explicitUnloadTabs(tabs) {
|
||||
explicitUnloadTabs(tabs, extraArgs = {}) {
|
||||
for (let i = 0; i < tabs.length; i++) {
|
||||
if (this.canUnloadTab(tabs[i], Date.now(), this.intervalUnloader.excludedUrls, true)) {
|
||||
if (this.canUnloadTab(tabs[i], Date.now(), this.intervalUnloader.excludedUrls, true, extraArgs)) {
|
||||
this.unload(tabs[i]);
|
||||
}
|
||||
}
|
||||
@@ -259,7 +259,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
canUnloadTab(tab, currentTimestamp, excludedUrls, ignoreTimestamp = false) {
|
||||
canUnloadTab(tab, currentTimestamp, excludedUrls, ignoreTimestamp = false, extraArgs = {}) {
|
||||
if (
|
||||
(tab.pinned && !ignoreTimestamp) ||
|
||||
tab.selected ||
|
||||
@@ -271,6 +271,9 @@
|
||||
tab.attention ||
|
||||
tab.hasAttribute('glance-id') ||
|
||||
tab.linkedBrowser?.zenModeActive ||
|
||||
(typeof extraArgs.permitUnload === 'undefined'
|
||||
? !tab.linkedBrowser?.permitUnload()?.permitUnload
|
||||
: !extraArgs.permitUnload) ||
|
||||
(tab.pictureinpicture && !ignoreTimestamp) ||
|
||||
(tab.soundPlaying && !ignoreTimestamp) ||
|
||||
(tab.zenIgnoreUnload && !ignoreTimestamp) ||
|
||||
|
Reference in New Issue
Block a user