From e6fcb2eac4a304ea967fc08feb46c22900fad4ef Mon Sep 17 00:00:00 2001 From: mauro-balades Date: Tue, 2 Apr 2024 16:05:04 +0200 Subject: [PATCH] Tab preview show faster --- .gluon/patchCount | 2 +- gluon.json | 2 +- src/browser/app/profile/zen-browser.js | 2 +- src/browser/base/content/browser-js.patch | 27 +++++++++---------- .../themes/BuiltInThemes-sys-mjs.patch | 13 +++++++++ src/toolkit/content/aboutProfiles-js.patch | 24 ++++++++++++++--- .../profile/nsToolkitProfileService-cpp.patch | 13 ++++----- 7 files changed, 55 insertions(+), 28 deletions(-) create mode 100644 src/browser/themes/BuiltInThemes-sys-mjs.patch diff --git a/.gluon/patchCount b/.gluon/patchCount index d2e1cefe8..7d3738628 100644 --- a/.gluon/patchCount +++ b/.gluon/patchCount @@ -1 +1 @@ -44 \ No newline at end of file +45 \ No newline at end of file diff --git a/gluon.json b/gluon.json index fea03650a..566451b0d 100644 --- a/gluon.json +++ b/gluon.json @@ -5,7 +5,7 @@ "binaryName": "zen", "version": { "product": "firefox", - "version": "124.0.1", + "version": "124.0.2", "displayVersion": "1.0.0" }, "buildOptions": { diff --git a/src/browser/app/profile/zen-browser.js b/src/browser/app/profile/zen-browser.js index 7efeea76f..d9c8fc909 100644 --- a/src/browser/app/profile/zen-browser.js +++ b/src/browser/app/profile/zen-browser.js @@ -3,7 +3,7 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. pref("browser.tabs.cardPreview.enabled", true); -pref("browser.tabs.cardPreview.delayMs", 500); +pref("browser.tabs.cardPreview.delayMs", 100); pref("browser.urlbar.suggest.calculator", true); diff --git a/src/browser/base/content/browser-js.patch b/src/browser/base/content/browser-js.patch index 4e0f4850e..ec3e0dcf9 100644 --- a/src/browser/base/content/browser-js.patch +++ b/src/browser/base/content/browser-js.patch @@ -1,5 +1,5 @@ diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js -index 4f145c494973374e87f3a3ed5eb6b33a43c518c8..8518d8a337acab19fb3bc22e8d5b3e8b1ee7902a 100644 +index 4f145c494973374e87f3a3ed5eb6b33a43c518c8..040c455e3e06305b03f835d47fc7fb22f9448402 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -13,6 +13,13 @@ ChromeUtils.importESModule("resource://gre/modules/NotificationDB.sys.mjs"); @@ -16,18 +16,19 @@ index 4f145c494973374e87f3a3ed5eb6b33a43c518c8..8518d8a337acab19fb3bc22e8d5b3e8b ChromeUtils.defineESModuleGetters(this, { AMTelemetry: "resource://gre/modules/AddonManager.sys.mjs", AboutNewTab: "resource:///modules/AboutNewTab.sys.mjs", -@@ -2424,6 +2431,10 @@ var gBrowserInit = { - "browser-idle-startup-tasks-finished" - ); - }); +@@ -1735,6 +1742,11 @@ var gBrowserInit = { + } + + // Misc. inits. + + // ZEN: Propagate the current profile used to the browser UI, such as + // showing the avatar and profile info to the side bar -+ scheduleIdleTask(zenUpdateBrowserProfiles); - }, - - // Returns the URI(s) to load at startup if it is immediately known, or a -@@ -6660,7 +6671,7 @@ function setToolbarVisibility( ++ zenUpdateBrowserProfiles(); ++ + gUIDensity.init(); + TabletModeUpdater.init(); + CombinedStopReload.ensureInitialized(); +@@ -6660,7 +6672,7 @@ function setToolbarVisibility( ); } @@ -36,7 +37,7 @@ index 4f145c494973374e87f3a3ed5eb6b33a43c518c8..8518d8a337acab19fb3bc22e8d5b3e8b switch (isVisible) { case true: case "always": -@@ -10157,3 +10168,17 @@ var FirefoxViewHandler = { +@@ -10157,3 +10169,15 @@ var FirefoxViewHandler = { this.button?.toggleAttribute("attention", shouldShow); }, }; @@ -48,9 +49,7 @@ index 4f145c494973374e87f3a3ed5eb6b33a43c518c8..8518d8a337acab19fb3bc22e8d5b3e8b + return; + } + let profile = ProfileService.currentProfile; -+ console.log(profile) -+ console.log(profile.zenAvatarPath) -+ if (profile.zenAvatarPath == "") return; ++ if (!profile || profile.zenAvatarPath == "") return; + // TODO: actually use profile data to generate the avatar, instead of just using the name + mainWindowEl.style.setProperty("--avatar-image-url", `url(${profile.zenAvatarPath})`); +} diff --git a/src/browser/themes/BuiltInThemes-sys-mjs.patch b/src/browser/themes/BuiltInThemes-sys-mjs.patch new file mode 100644 index 000000000..cdf39b081 --- /dev/null +++ b/src/browser/themes/BuiltInThemes-sys-mjs.patch @@ -0,0 +1,13 @@ +diff --git a/browser/themes/BuiltInThemes.sys.mjs b/browser/themes/BuiltInThemes.sys.mjs +index c2d5dd7a18895ae8b4afbf386f122e7899c48cda..5d0f907acf0162735359747a1c6d529e52fa2590 100644 +--- a/browser/themes/BuiltInThemes.sys.mjs ++++ b/browser/themes/BuiltInThemes.sys.mjs +@@ -82,7 +82,7 @@ class _BuiltInThemes { + lazy.AddonManager.maybeInstallBuiltinAddon( + activeThemeID, + activeBuiltInTheme.version, +- `resource://builtin-themes/${activeBuiltInTheme.path}` ++ `${activeBuiltInTheme.path}` + ); + } + } diff --git a/src/toolkit/content/aboutProfiles-js.patch b/src/toolkit/content/aboutProfiles-js.patch index 2df066301..1234e4dda 100644 --- a/src/toolkit/content/aboutProfiles-js.patch +++ b/src/toolkit/content/aboutProfiles-js.patch @@ -1,12 +1,30 @@ diff --git a/toolkit/content/aboutProfiles.js b/toolkit/content/aboutProfiles.js -index 15c0419a11fee377f17dd766938943024723aab0..8bf3cb00a6f1fbbec421110c5d631d88d89cbb67 100644 +index 15c0419a11fee377f17dd766938943024723aab0..cce2f157642e4b1a0bb7aaddb0105d0f4e67897b 100644 --- a/toolkit/content/aboutProfiles.js +++ b/toolkit/content/aboutProfiles.js -@@ -155,6 +155,8 @@ function display(profileData) { +@@ -117,7 +117,7 @@ function display(profileData) { + let tbody = document.createElement("tbody"); + table.appendChild(tbody); + +- function createItem(title, value, dir = false) { ++ function createItem(title, value, dir = false, zenAsText = false) { + let tr = document.createElement("tr"); + tbody.appendChild(tr); + +@@ -143,6 +143,8 @@ function display(profileData) { + value.reveal(); + }); + } ++ } else if (zenAsText) { ++ td.appendChild(document.createTextNode(value)); + } else { + document.l10n.setAttributes(td, value); + } +@@ -155,6 +157,8 @@ function display(profileData) { createItem("profiles-rootdir", profileData.profile.rootDir, true); -+ createItem("profiles-avatar", profileData.profile.zenAvatarPath); ++ createItem("profiles-avatar", profileData.profile.zenAvatarPath, false, true); + if (profileData.profile.localDir.path != profileData.profile.rootDir.path) { createItem("profiles-localdir", profileData.profile.localDir, true); diff --git a/src/toolkit/profile/nsToolkitProfileService-cpp.patch b/src/toolkit/profile/nsToolkitProfileService-cpp.patch index def8f46c2..c0de55981 100644 --- a/src/toolkit/profile/nsToolkitProfileService-cpp.patch +++ b/src/toolkit/profile/nsToolkitProfileService-cpp.patch @@ -1,5 +1,5 @@ diff --git a/toolkit/profile/nsToolkitProfileService.cpp b/toolkit/profile/nsToolkitProfileService.cpp -index aeab25c61f3b04cfa19ec93e2abe0772d8656e61..cf867a3ddb7dfad986dd7064918d4fe383044172 100644 +index aeab25c61f3b04cfa19ec93e2abe0772d8656e61..aec22de2c7266970be19824d8bd2cae32e3b7af8 100644 --- a/toolkit/profile/nsToolkitProfileService.cpp +++ b/toolkit/profile/nsToolkitProfileService.cpp @@ -234,13 +234,14 @@ void RemoveProfileFiles(nsIToolkitProfile* aProfile, bool aInBackground) { @@ -29,18 +29,15 @@ index aeab25c61f3b04cfa19ec93e2abe0772d8656e61..cf867a3ddb7dfad986dd7064918d4fe3 db->SetString(mSection.get(), "Name", mName.get()); bool isRelative = false; -@@ -264,6 +265,10 @@ nsToolkitProfile::nsToolkitProfile(const nsACString& aName, nsIFile* aRootDir, +@@ -264,6 +265,7 @@ nsToolkitProfile::nsToolkitProfile(const nsACString& aName, nsIFile* aRootDir, db->SetString(mSection.get(), "IsRelative", isRelative ? "1" : "0"); db->SetString(mSection.get(), "Path", descriptor.get()); + db->SetString(mSection.get(), "ZenAvatarPath", mZenAvatarPath.get()); -+ } else if (mZenAvatarPath == ""_ns) { -+ // Load the profile's avatar from the database. -+ db->GetString(mSection.get(), "ZenAvatarPath", mZenAvatarPath); } } -@@ -318,6 +323,8 @@ nsToolkitProfile::SetName(const nsACString& aName) { +@@ -318,6 +320,8 @@ nsToolkitProfile::SetName(const nsACString& aName) { return NS_OK; } @@ -49,7 +46,7 @@ index aeab25c61f3b04cfa19ec93e2abe0772d8656e61..cf867a3ddb7dfad986dd7064918d4fe3 nsresult nsToolkitProfile::RemoveInternal(bool aRemoveFiles, bool aInBackground) { NS_ASSERTION(nsToolkitProfileService::gService, "Whoa, my service is gone."); -@@ -992,7 +999,15 @@ nsresult nsToolkitProfileService::Init() { +@@ -992,7 +996,15 @@ nsresult nsToolkitProfileService::Init() { localDir = rootDir; } @@ -66,7 +63,7 @@ index aeab25c61f3b04cfa19ec93e2abe0772d8656e61..cf867a3ddb7dfad986dd7064918d4fe3 // If a user has modified the ini file path it may make for a valid profile // path but not match what we would have serialised and so may not match -@@ -1995,7 +2010,7 @@ nsToolkitProfileService::CreateProfile(nsIFile* aRootDir, +@@ -1995,7 +2007,7 @@ nsToolkitProfileService::CreateProfile(nsIFile* aRootDir, NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr profile =