Bug 1234012 - Remove the NS_APP_PROFILE_DEFAULTS_{NLOC_,}50_DIR directory keys. r=bsmedberg

Nothing apart the code that was just removed uses those keys, so remove them.
Actually, there is a use in Seamonkey, but considering they're shipping with
omnijar, the code expecting the directory has not been working as designed for
a while, so they can fixup and remove that use as well.
This commit is contained in:
Mike Hommey 2015-12-25 07:40:49 +09:00
parent 6c9d3ffe68
commit 63439e34f6
4 changed files with 1 additions and 70 deletions

View File

@ -298,11 +298,7 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent,
rv = NS_ERROR_FAILURE; rv = NS_ERROR_FAILURE;
nsCOMPtr<nsIFile> file; nsCOMPtr<nsIFile> file;
if (!strcmp(aProperty, NS_APP_PROFILE_DEFAULTS_50_DIR) || if (!strcmp(aProperty, NS_APP_PREF_DEFAULTS_50_DIR))
!strcmp(aProperty, NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR)) {
return GetProfileDefaultsDir(aFile);
}
else if (!strcmp(aProperty, NS_APP_PREF_DEFAULTS_50_DIR))
{ {
// return the GRE default prefs directory here, and the app default prefs // return the GRE default prefs directory here, and the app default prefs
// directory (if applicable) in NS_APP_PREFS_DEFAULTS_DIR_LIST. // directory (if applicable) in NS_APP_PREFS_DEFAULTS_DIR_LIST.
@ -433,13 +429,11 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent,
} }
else { else {
rv = file->AppendNative(NS_LITERAL_CSTRING("localstore.rdf")); rv = file->AppendNative(NS_LITERAL_CSTRING("localstore.rdf"));
EnsureProfileFileExists(file);
ensureFilePermissions = true; ensureFilePermissions = true;
} }
} }
else if (!strcmp(aProperty, NS_APP_USER_MIMETYPES_50_FILE)) { else if (!strcmp(aProperty, NS_APP_USER_MIMETYPES_50_FILE)) {
rv = file->AppendNative(NS_LITERAL_CSTRING("mimeTypes.rdf")); rv = file->AppendNative(NS_LITERAL_CSTRING("mimeTypes.rdf"));
EnsureProfileFileExists(file);
ensureFilePermissions = true; ensureFilePermissions = true;
} }
else if (!strcmp(aProperty, NS_APP_DOWNLOADS_50_FILE)) { else if (!strcmp(aProperty, NS_APP_DOWNLOADS_50_FILE)) {
@ -1446,51 +1440,6 @@ nsXREDirProvider::EnsureDirectoryExists(nsIFile* aDirectory)
return rv; return rv;
} }
void
nsXREDirProvider::EnsureProfileFileExists(nsIFile *aFile)
{
nsresult rv;
bool exists;
rv = aFile->Exists(&exists);
if (NS_FAILED(rv) || exists) return;
nsAutoCString leafName;
rv = aFile->GetNativeLeafName(leafName);
if (NS_FAILED(rv)) return;
nsCOMPtr<nsIFile> defaultsFile;
rv = GetProfileDefaultsDir(getter_AddRefs(defaultsFile));
if (NS_FAILED(rv)) return;
rv = defaultsFile->AppendNative(leafName);
if (NS_FAILED(rv)) return;
defaultsFile->CopyToNative(mProfileDir, EmptyCString());
}
nsresult
nsXREDirProvider::GetProfileDefaultsDir(nsIFile* *aResult)
{
NS_ASSERTION(mGREDir, "nsXREDirProvider not initialized.");
NS_PRECONDITION(aResult, "Null out-param");
nsresult rv;
nsCOMPtr<nsIFile> defaultsDir;
rv = GetAppDir()->Clone(getter_AddRefs(defaultsDir));
NS_ENSURE_SUCCESS(rv, rv);
rv = defaultsDir->AppendNative(NS_LITERAL_CSTRING("defaults"));
NS_ENSURE_SUCCESS(rv, rv);
rv = defaultsDir->AppendNative(NS_LITERAL_CSTRING("profile"));
NS_ENSURE_SUCCESS(rv, rv);
defaultsDir.forget(aResult);
return NS_OK;
}
nsresult nsresult
nsXREDirProvider::AppendSysUserExtensionPath(nsIFile* aFile) nsXREDirProvider::AppendSysUserExtensionPath(nsIFile* aFile)
{ {

View File

@ -54,8 +54,6 @@ public:
void DoShutdown(); void DoShutdown();
nsresult GetProfileDefaultsDir(nsIFile* *aResult);
static nsresult GetUserAppDataDirectory(nsIFile* *aFile) { static nsresult GetUserAppDataDirectory(nsIFile* *aFile) {
return GetUserDataDirectory(aFile, false, nullptr, nullptr, nullptr); return GetUserDataDirectory(aFile, false, nullptr, nullptr, nullptr);
} }
@ -108,7 +106,6 @@ protected:
static nsresult GetSystemExtensionsDirectory(nsIFile** aFile); static nsresult GetSystemExtensionsDirectory(nsIFile** aFile);
#endif #endif
static nsresult EnsureDirectoryExists(nsIFile* aDirectory); static nsresult EnsureDirectoryExists(nsIFile* aDirectory);
void EnsureProfileFileExists(nsIFile* aFile);
// Determine the profile path within the UAppData directory. This is different // Determine the profile path within the UAppData directory. This is different
// on every major platform. // on every major platform.

View File

@ -31,11 +31,6 @@
#define NS_APP_DEFAULTS_50_DIR "DefRt" // The root dir of all defaults dirs #define NS_APP_DEFAULTS_50_DIR "DefRt" // The root dir of all defaults dirs
#define NS_APP_PREF_DEFAULTS_50_DIR "PrfDef" #define NS_APP_PREF_DEFAULTS_50_DIR "PrfDef"
#define NS_APP_PROFILE_DEFAULTS_50_DIR "profDef" // The profile defaults of the "current"
// locale. Should be first choice.
#define NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR "ProfDefNoLoc" // The profile defaults of the "default"
// installed locale. Second choice
// when above is not available.
#define NS_APP_USER_PROFILES_ROOT_DIR "DefProfRt" // The dir where user profile dirs live. #define NS_APP_USER_PROFILES_ROOT_DIR "DefProfRt" // The dir where user profile dirs live.
#define NS_APP_USER_PROFILES_LOCAL_ROOT_DIR "DefProfLRt" // The dir where user profile temp dirs live. #define NS_APP_USER_PROFILES_LOCAL_ROOT_DIR "DefProfLRt" // The dir where user profile temp dirs live.

View File

@ -58,7 +58,6 @@
#define DEFAULTS_DIR_NAME NS_LITERAL_CSTRING("defaults") #define DEFAULTS_DIR_NAME NS_LITERAL_CSTRING("defaults")
#define DEFAULTS_PREF_DIR_NAME NS_LITERAL_CSTRING("pref") #define DEFAULTS_PREF_DIR_NAME NS_LITERAL_CSTRING("pref")
#define DEFAULTS_PROFILE_DIR_NAME NS_LITERAL_CSTRING("profile")
#define RES_DIR_NAME NS_LITERAL_CSTRING("res") #define RES_DIR_NAME NS_LITERAL_CSTRING("res")
#define CHROME_DIR_NAME NS_LITERAL_CSTRING("chrome") #define CHROME_DIR_NAME NS_LITERAL_CSTRING("chrome")
#define PLUGINS_DIR_NAME NS_LITERAL_CSTRING("plugins") #define PLUGINS_DIR_NAME NS_LITERAL_CSTRING("plugins")
@ -123,15 +122,6 @@ nsAppFileLocationProvider::GetFile(const char* aProp, bool* aPersistent,
rv = localFile->AppendRelativeNativePath(DEFAULTS_PREF_DIR_NAME); rv = localFile->AppendRelativeNativePath(DEFAULTS_PREF_DIR_NAME);
} }
} }
} else if (nsCRT::strcmp(aProp, NS_APP_PROFILE_DEFAULTS_50_DIR) == 0 ||
nsCRT::strcmp(aProp, NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR) == 0) {
rv = CloneMozBinDirectory(getter_AddRefs(localFile));
if (NS_SUCCEEDED(rv)) {
rv = localFile->AppendRelativeNativePath(DEFAULTS_DIR_NAME);
if (NS_SUCCEEDED(rv)) {
rv = localFile->AppendRelativeNativePath(DEFAULTS_PROFILE_DIR_NAME);
}
}
} else if (nsCRT::strcmp(aProp, NS_APP_USER_PROFILES_ROOT_DIR) == 0) { } else if (nsCRT::strcmp(aProp, NS_APP_USER_PROFILES_ROOT_DIR) == 0) {
rv = GetDefaultUserProfileRoot(getter_AddRefs(localFile)); rv = GetDefaultUserProfileRoot(getter_AddRefs(localFile));
} else if (nsCRT::strcmp(aProp, NS_APP_USER_PROFILES_LOCAL_ROOT_DIR) == 0) { } else if (nsCRT::strcmp(aProp, NS_APP_USER_PROFILES_LOCAL_ROOT_DIR) == 0) {