From f1309924dd179bae1aa3bd7ef814701f4f1172a0 Mon Sep 17 00:00:00 2001 From: Fedor Date: Mon, 8 Jul 2019 13:07:01 +0300 Subject: [PATCH] Remove unused code from ToolkitProfileService --- toolkit/profile/nsIToolkitProfileService.idl | 23 ------- toolkit/profile/nsToolkitProfileService.cpp | 65 -------------------- 2 files changed, 88 deletions(-) diff --git a/toolkit/profile/nsIToolkitProfileService.idl b/toolkit/profile/nsIToolkitProfileService.idl index a1455c130..cbe059643 100644 --- a/toolkit/profile/nsIToolkitProfileService.idl +++ b/toolkit/profile/nsIToolkitProfileService.idl @@ -68,29 +68,6 @@ interface nsIToolkitProfileService : nsISupports nsIToolkitProfile createProfile(in nsIFile aRootDir, in AUTF8String aName); - /** - * Create the default profile for an application. - * - * The profile will be typically in - * {Application Data}/.profilename/{salt}.default or - * {Application Data}/.appname/{salt}.default - * or if aVendorName is provided - * {Application Data}/.vendor/appname/{salt}.default - * - * @note Either aProfileName or aAppName must be non-empty - * - * @param aProfileName - * The name of the profile - * @param aAppName - * The name of the application - * @param aVendorName - * The name of the vendor - * @return The created profile. - */ - nsIToolkitProfile createDefaultProfileForApp(in AUTF8String aProfileName, - in AUTF8String aAppName, - in AUTF8String aVendorName); - /** * Returns the number of profiles. * @return 0, 1, or 2. More than 2 profiles will always return 2. diff --git a/toolkit/profile/nsToolkitProfileService.cpp b/toolkit/profile/nsToolkitProfileService.cpp index de2177385..3cad05ca2 100644 --- a/toolkit/profile/nsToolkitProfileService.cpp +++ b/toolkit/profile/nsToolkitProfileService.cpp @@ -714,71 +714,6 @@ static void SaltProfileName(nsACString& aName) aName.Insert(salt, 0, 9); } -NS_IMETHODIMP -nsToolkitProfileService::CreateDefaultProfileForApp(const nsACString& aProfileName, - const nsACString& aAppName, - const nsACString& aVendorName, - nsIToolkitProfile** aResult) -{ - NS_ENSURE_STATE(!aProfileName.IsEmpty() || !aAppName.IsEmpty()); - nsCOMPtr appData; - nsresult rv = - gDirServiceProvider->GetUserDataDirectory(getter_AddRefs(appData), - false, - &aProfileName, - &aAppName, - &aVendorName); - NS_ENSURE_SUCCESS(rv, rv); - - nsCOMPtr profilesini; - appData->Clone(getter_AddRefs(profilesini)); - rv = profilesini->AppendNative(NS_LITERAL_CSTRING("profiles.ini")); - NS_ENSURE_SUCCESS(rv, rv); - - bool exists = false; - profilesini->Exists(&exists); - NS_ENSURE_FALSE(exists, NS_ERROR_ALREADY_INITIALIZED); - - rv = CreateProfileInternal(nullptr, - NS_LITERAL_CSTRING("default"), - &aProfileName, &aAppName, &aVendorName, - true, aResult); - NS_ENSURE_SUCCESS(rv, rv); - NS_ENSURE_STATE(*aResult); - - nsCOMPtr rootDir; - (*aResult)->GetRootDir(getter_AddRefs(rootDir)); - NS_ENSURE_SUCCESS(rv, rv); - - nsAutoCString profileDir; - rv = rootDir->GetRelativeDescriptor(appData, profileDir); - NS_ENSURE_SUCCESS(rv, rv); - - nsCString ini; - ini.SetCapacity(512); - ini.AppendLiteral("[General]\n"); - ini.AppendLiteral("StartWithLastProfile=1\n\n"); - - ini.AppendLiteral("[Profile0]\n"); - ini.AppendLiteral("Name=default\n"); - ini.AppendLiteral("IsRelative=1\n"); - ini.AppendLiteral("Path="); - ini.Append(profileDir); - ini.Append('\n'); - ini.AppendLiteral("Default=1\n\n"); - - FILE* writeFile; - rv = profilesini->OpenANSIFileDesc("w", &writeFile); - NS_ENSURE_SUCCESS(rv, rv); - - if (fwrite(ini.get(), sizeof(char), ini.Length(), writeFile) != - ini.Length()) { - rv = NS_ERROR_UNEXPECTED; - } - fclose(writeFile); - return rv; -} - NS_IMETHODIMP nsToolkitProfileService::CreateProfile(nsIFile* aRootDir, const nsACString& aName,