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,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;