Remove unused zen-avatars directory and associated files

This commit is contained in:
mr. M
2025-02-18 11:53:48 +01:00
parent a64adb6b16
commit 638c7c7420
222 changed files with 14 additions and 2081 deletions

View File

@@ -1,31 +0,0 @@
diff --git a/toolkit/content/aboutProfiles.js b/toolkit/content/aboutProfiles.js
index 15c0419a11fee377f17dd766938943024723aab0..cce2f157642e4b1a0bb7aaddb0105d0f4e67897b 100644
--- a/toolkit/content/aboutProfiles.js
+++ b/toolkit/content/aboutProfiles.js
@@ -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, false, true);
+
if (profileData.profile.localDir.path != profileData.profile.rootDir.path) {
createItem("profiles-localdir", profileData.profile.localDir, true);
}

View File

@@ -1,12 +0,0 @@
diff --git a/toolkit/locales/en-US/toolkit/about/aboutProfiles.ftl b/toolkit/locales/en-US/toolkit/about/aboutProfiles.ftl
index c11b89b3214cc17826a0be745f5d14d8c5c5cae3..417295cc42f1c61a02d9f26d1df442237b8e720c 100644
--- a/toolkit/locales/en-US/toolkit/about/aboutProfiles.ftl
+++ b/toolkit/locales/en-US/toolkit/about/aboutProfiles.ftl
@@ -20,6 +20,7 @@ profiles-flush-restart-button = Restart { -brand-short-name }
profiles-name = Profile: { $name }
profiles-is-default = Default Profile
profiles-rootdir = Root Directory
+profiles-avatar = Profile Avatar
# localDir is used to show the directory corresponding to
# the main profile directory that exists for the purpose of storing data on the

View File

@@ -1,14 +0,0 @@
diff --git a/toolkit/profile/nsIToolkitProfile.idl b/toolkit/profile/nsIToolkitProfile.idl
index b194cd956382039f24844ded1f2b0edb2fbca2ee..e8a4bce343c7b7a402de3d7d387481a981640fa8 100644
--- a/toolkit/profile/nsIToolkitProfile.idl
+++ b/toolkit/profile/nsIToolkitProfile.idl
@@ -96,4 +96,9 @@ interface nsIToolkitProfile : nsISupports
* @throws NS_ERROR_FILE_ACCESS_DENIED if the profile was already locked.
*/
nsIProfileLock lock(out nsIProfileUnlocker aUnlocker);
+
+ /**
+ * Zen Avatar Path
+ */
+ attribute AUTF8String zenAvatarPath;
};

View File

@@ -1,86 +0,0 @@
diff --git a/toolkit/profile/nsToolkitProfileService.cpp b/toolkit/profile/nsToolkitProfileService.cpp
index 0587b214ddcf4b12877ca3698ca7d4308b2f0af3..3846515a4fa7b849233de6026f55152478c04f03 100644
--- a/toolkit/profile/nsToolkitProfileService.cpp
+++ b/toolkit/profile/nsToolkitProfileService.cpp
@@ -229,7 +229,7 @@ void RemoveProfileFiles(nsIToolkitProfile* aProfile, bool aInBackground) {
}
nsToolkitProfile::nsToolkitProfile(const nsACString& aName, nsIFile* aRootDir,
- nsIFile* aLocalDir, bool aFromDB,
+ nsIFile* aLocalDir, bool aFromDB, const nsACString& aZenAvatarPath,
const nsACString& aStoreID = VoidCString(),
bool aShowProfileSelector = false)
: mName(aName),
@@ -239,7 +239,8 @@ nsToolkitProfile::nsToolkitProfile(const nsACString& aName, nsIFile* aRootDir,
mShowProfileSelector(aShowProfileSelector),
mLock(nullptr),
mIndex(0),
- mSection("Profile") {
+ mSection("Profile"),
+ mZenAvatarPath(aZenAvatarPath) {
NS_ASSERTION(aRootDir, "No file!");
RefPtr<nsToolkitProfile> prev =
@@ -254,6 +255,10 @@ nsToolkitProfile::nsToolkitProfile(const nsACString& aName, nsIFile* aRootDir,
// If this profile isn't in the database already add it.
if (!aFromDB) {
nsINIParser* db = &nsToolkitProfileService::gService->mProfileDB;
+ if (mZenAvatarPath == ""_ns) {
+ auto randomId = std::rand() % 100;
+ mZenAvatarPath = ("chrome://browser/content/zen-avatars/avatar-" + std::to_string(randomId) + ".svg").c_str();
+ }
db->SetString(mSection.get(), "Name", mName.get());
bool isRelative = false;
@@ -263,6 +268,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());
if (!mStoreID.IsVoid()) {
db->SetString(mSection.get(), "StoreID",
PromiseFlatCString(mStoreID).get());
@@ -462,6 +468,8 @@ nsToolkitProfile::SetShowProfileSelector(bool aShowProfileSelector) {
#endif
}
+#include "zenProfileMethodsOverride.inc.cpp"
+
nsresult nsToolkitProfile::RemoveInternal(bool aRemoveFiles,
bool aInBackground) {
NS_ASSERTION(nsToolkitProfileService::gService, "Whoa, my service is gone.");
@@ -1145,8 +1153,14 @@ nsresult nsToolkitProfileService::Init() {
}
}
- currentProfile = new nsToolkitProfile(name, rootDir, localDir, true,
- storeID, showProfileSelector);
+ nsAutoCString zenProfileAvatar;
+ rv = mProfileDB.GetString(profileID.get(), "ZenAvatarPath", zenProfileAvatar);
+ if (NS_FAILED(rv)) {
+ NS_ERROR("Malformed profiles.ini: ZenAvatarPath= not found");
+ continue;
+ }
+
+ currentProfile = new nsToolkitProfile(name, rootDir, localDir, true, zenProfileAvatar, storeID, showProfileSelector);
// 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
@@ -1375,7 +1389,7 @@ nsresult nsToolkitProfileService::CreateDefaultProfile(
if (mUseDevEditionProfile) {
name.AssignLiteral(DEV_EDITION_NAME);
} else if (mUseDedicatedProfile) {
- name.AppendPrintf("default-%s", mUpdateChannel.get());
+ name.AppendPrintf("Default (%s)", mUpdateChannel.get());
} else {
name.AssignLiteral(DEFAULT_NAME);
}
@@ -2185,7 +2199,7 @@ nsresult nsToolkitProfileService::CreateProfile(nsIFile* aRootDir,
rv = CreateTimesInternal(rootDir);
NS_ENSURE_SUCCESS(rv, rv);
- profile = new nsToolkitProfile(aName, rootDir, localDir, false);
+ profile = new nsToolkitProfile(aName, rootDir, localDir, false, ""_ns);
if (aName.Equals(DEV_EDITION_NAME)) {
mDevEditionDefault = profile;

View File

@@ -1,21 +0,0 @@
diff --git a/toolkit/profile/nsToolkitProfileService.h b/toolkit/profile/nsToolkitProfileService.h
index d48fd954a14a8dcb4654e10cd3c792c95d38647d..be4dcf3962b77572c8cfe04d6043551f55650f9a 100644
--- a/toolkit/profile/nsToolkitProfileService.h
+++ b/toolkit/profile/nsToolkitProfileService.h
@@ -30,7 +30,7 @@ class nsToolkitProfile final
~nsToolkitProfile() = default;
nsToolkitProfile(const nsACString& aName, nsIFile* aRootDir,
- nsIFile* aLocalDir, bool aFromDB, const nsACString& aStoreID,
+ nsIFile* aLocalDir, bool aFromDB, const nsACString& aZenAvatarPath, const nsACString& aStoreID,
bool aShowProfileSelector);
nsresult RemoveInternal(bool aRemoveFiles, bool aInBackground);
@@ -45,6 +45,7 @@ class nsToolkitProfile final
nsIProfileLock* mLock;
uint32_t mIndex;
nsCString mSection;
+ nsCString mZenAvatarPath;
};
class nsToolkitProfileLock final : public nsIProfileLock {

View File

@@ -1,21 +0,0 @@
NS_IMETHODIMP
nsToolkitProfile::GetZenAvatarPath(nsACString& aResult) {
aResult = mZenAvatarPath;
return NS_OK;
}
NS_IMETHODIMP
nsToolkitProfile::SetZenAvatarPath(const nsACString& aZenAvatar) {
NS_ASSERTION(nsToolkitProfileService::gService, "Where did my service go?");
if (mZenAvatarPath.Equals(aZenAvatar)) {
return NS_OK;
}
mZenAvatarPath = aZenAvatar;
nsresult rv = nsToolkitProfileService::gService->mProfileDB.SetString(
mSection.get(), "ZenAvatarPath", mZenAvatarPath.get());
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}