From 025f994c62d6739b6bb2d427f35670f339725b51 Mon Sep 17 00:00:00 2001 From: "mr. m" Date: Tue, 18 Mar 2025 15:46:13 +0100 Subject: [PATCH] fix: enhance tab unloading logic with permitUnload check and update candidate version and update to firefox `136.0.2` --- README.md | 2 +- firefox-cache/l10n-last-commit-hash | 2 +- scripts/update_ff.py | 6 ++++++ src/browser/base/content/zen-styles/zen-popup.css | 6 +++++- .../base/content/zen-styles/zen-tabs/vertical-tabs.css | 2 +- src/browser/base/zen-components/ZenPinnedTabManager.mjs | 7 +++++-- src/browser/base/zen-components/ZenTabUnloader.mjs | 9 ++++++--- surfer.json | 6 +++--- 8 files changed, 28 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index e38fb038..d1ed17ff 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ ## 🖥️ Compatibility -Zen is currently built using Firefox version `136.0.1`! 🚀 +Zen is currently built using Firefox version `136.0.2`! 🚀 - [`Zen Twilight`](https://zen-browser.app/download?twilight) - Is currently built using Firefox version `RC 136.0`! - Check out the latest [release notes](https://zen-browser.app/release-notes)! diff --git a/firefox-cache/l10n-last-commit-hash b/firefox-cache/l10n-last-commit-hash index 2991f183..d1765242 100644 --- a/firefox-cache/l10n-last-commit-hash +++ b/firefox-cache/l10n-last-commit-hash @@ -1 +1 @@ -6ad0ab3c43a6208d8bcd997b40e802fccd48ba0a \ No newline at end of file +6013afe489c3d5e19c5f0d0f6c3f94b91f5bd7d1 \ No newline at end of file diff --git a/scripts/update_ff.py b/scripts/update_ff.py index 40f94f84..0784d2f9 100644 --- a/scripts/update_ff.py +++ b/scripts/update_ff.py @@ -64,6 +64,12 @@ def update_l10n_last_commit_hash(): if not os.path.exists("firefox-cache"): os.mkdir("firefox-cache") os.system("cat l10n-temp/.git/refs/heads/main > firefox-cache/l10n-last-commit-hash") + # Remove new line character + data = "" + with open("firefox-cache/l10n-last-commit-hash", "r") as f: + data = f.read() + with open("firefox-cache/l10n-last-commit-hash", "w") as f: + f.write(data.strip()) except KeyboardInterrupt: print("Exiting...") shutil.rmtree("l10n-temp") diff --git a/src/browser/base/content/zen-styles/zen-popup.css b/src/browser/base/content/zen-styles/zen-popup.css index 721664d9..63fc98be 100644 --- a/src/browser/base/content/zen-styles/zen-popup.css +++ b/src/browser/base/content/zen-styles/zen-popup.css @@ -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); diff --git a/src/browser/base/content/zen-styles/zen-tabs/vertical-tabs.css b/src/browser/base/content/zen-styles/zen-tabs/vertical-tabs.css index 0af7dae9..5b011025 100644 --- a/src/browser/base/content/zen-styles/zen-tabs/vertical-tabs.css +++ b/src/browser/base/content/zen-styles/zen-tabs/vertical-tabs.css @@ -269,7 +269,7 @@ } #tabbrowser-tabs:not([movingtab]) & .tab-content > image:active { - scale: var(--zen-active-tab-scale); + scale: 0.92; } & .tab-icon-image { diff --git a/src/browser/base/zen-components/ZenPinnedTabManager.mjs b/src/browser/base/zen-components/ZenPinnedTabManager.mjs index aae3f515..f7c3bda5 100644 --- a/src/browser/base/zen-components/ZenPinnedTabManager.mjs +++ b/src/browser/base/zen-components/ZenPinnedTabManager.mjs @@ -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; diff --git a/src/browser/base/zen-components/ZenTabUnloader.mjs b/src/browser/base/zen-components/ZenTabUnloader.mjs index 01219d57..5ea8f46f 100644 --- a/src/browser/base/zen-components/ZenTabUnloader.mjs +++ b/src/browser/base/zen-components/ZenTabUnloader.mjs @@ -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) || diff --git a/surfer.json b/surfer.json index 107a1a18..4c8a87cc 100644 --- a/surfer.json +++ b/surfer.json @@ -5,8 +5,8 @@ "binaryName": "zen", "version": { "product": "firefox", - "version": "136.0.1", - "candidate": "136.0.1" + "version": "136.0.2", + "candidate": "136.0.2" }, "buildOptions": { "generateBranding": true @@ -53,4 +53,4 @@ "licenseType": "MPL-2.0" }, "updateHostname": "updates.zen-browser.app" -} +} \ No newline at end of file