landing portions of aviary patch for bug 258123 on the trunk to keep code in sync, r=bsmedberg

This commit is contained in:
darin%meer.net 2004-09-15 23:02:10 +00:00
Родитель 559b5ca2f4
Коммит e258fe4b7f
3 изменённых файлов: 24 добавлений и 46 удалений

Просмотреть файл

@ -1994,11 +1994,6 @@ int xre_main(int argc, char* argv[], const nsXREAppData* aAppData)
// in "components.ini" which we have just discovered changed since the // in "components.ini" which we have just discovered changed since the
// last time the application was run. // last time the application was run.
RemoveComponentRegistries(lf); RemoveComponentRegistries(lf);
// Tell the dir provider to supply the list of components locations
// specified in "components.ini" when it is asked for the "ComsDL"
// enumeration.
dirProvider.RegisterExtraComponents();
} }
// Nothing need be done for the normal startup case. // Nothing need be done for the normal startup case.
} }

Просмотреть файл

@ -89,8 +89,7 @@
nsXREDirProvider* gDirServiceProvider = nsnull; nsXREDirProvider* gDirServiceProvider = nsnull;
nsXREDirProvider::nsXREDirProvider() : nsXREDirProvider::nsXREDirProvider() :
mProfileNotified(PR_FALSE), mProfileNotified(PR_FALSE)
mRegisterExtraComponents(PR_TRUE)
{ {
gDirServiceProvider = this; gDirServiceProvider = this;
} }
@ -352,12 +351,6 @@ nsXREDirProvider::GetFile(const char* aProperty, PRBool* aPersistent,
return NS_OK; return NS_OK;
} }
void
nsXREDirProvider::RegisterExtraComponents()
{
mRegisterExtraComponents = PR_TRUE;
}
static void static void
LoadDirsIntoArray(nsIFile* aComponentsList, nsCOMArray<nsIFile>& aDirectories) LoadDirsIntoArray(nsIFile* aComponentsList, nsCOMArray<nsIFile>& aDirectories)
{ {
@ -394,32 +387,30 @@ nsXREDirProvider::GetFiles(const char* aProperty, nsISimpleEnumerator** aResult)
*aResult = nsnull; *aResult = nsnull;
if (!strcmp(aProperty, NS_XPCOM_COMPONENT_DIR_LIST)) { if (!strcmp(aProperty, NS_XPCOM_COMPONENT_DIR_LIST)) {
if (mRegisterExtraComponents) { nsCOMArray<nsIFile> directories;
nsCOMArray<nsIFile> directories;
if (mXULAppDir) {
if (mXULAppDir) { nsCOMPtr<nsIFile> file;
nsCOMPtr<nsIFile> file; mXULAppDir->Clone(getter_AddRefs(file));
mXULAppDir->Clone(getter_AddRefs(file)); file->AppendNative(NS_LITERAL_CSTRING("components"));
file->AppendNative(NS_LITERAL_CSTRING("components")); PRBool exists;
PRBool exists; if (NS_SUCCEEDED(file->Exists(&exists)) && exists)
if (NS_SUCCEEDED(file->Exists(&exists)) && exists) directories.AppendObject(file);
directories.AppendObject(file);
}
nsCOMPtr<nsIFile> appFile;
mAppDir->Clone(getter_AddRefs(appFile));
appFile->AppendNative(NS_LITERAL_CSTRING("components.ini"));
LoadDirsIntoArray(appFile, directories);
nsCOMPtr<nsIFile> profileFile;
if (mProfileDir) {
mProfileDir->Clone(getter_AddRefs(profileFile));
profileFile->AppendNative(NS_LITERAL_CSTRING("components.ini"));
LoadDirsIntoArray(profileFile, directories);
}
rv = NS_NewArrayEnumerator(aResult, directories);
} }
nsCOMPtr<nsIFile> appFile;
mAppDir->Clone(getter_AddRefs(appFile));
appFile->AppendNative(NS_LITERAL_CSTRING("components.ini"));
LoadDirsIntoArray(appFile, directories);
nsCOMPtr<nsIFile> profileFile;
if (mProfileDir) {
mProfileDir->Clone(getter_AddRefs(profileFile));
profileFile->AppendNative(NS_LITERAL_CSTRING("components.ini"));
LoadDirsIntoArray(profileFile, directories);
}
rv = NS_NewArrayEnumerator(aResult, directories);
} }
else if (!strcmp(aProperty, NS_APP_PREFS_DEFAULTS_DIR_LIST)) { else if (!strcmp(aProperty, NS_APP_PREFS_DEFAULTS_DIR_LIST)) {
nsCOMArray<nsIFile> directories; nsCOMArray<nsIFile> directories;

Просмотреть файл

@ -66,13 +66,6 @@ public:
// the responsibility of the apprunner. // the responsibility of the apprunner.
nsresult SetProfileDir(nsIFile* aProfileDir); nsresult SetProfileDir(nsIFile* aProfileDir);
// Causes any attempts to retrieve an enumeration of directories for the
// "ComsDL" property to return a list of directories specified in the
// "components.ini" manifest in the profile/application directories.
// This results in component registration at those locations during
// XPCOM startup.
void RegisterExtraComponents();
void DoShutdown(); void DoShutdown();
nsresult GetProfileDefaultsDir(nsIFile* *aResult); nsresult GetProfileDefaultsDir(nsIFile* *aResult);
@ -89,7 +82,6 @@ protected:
nsCOMPtr<nsIFile> mXULAppDir; nsCOMPtr<nsIFile> mXULAppDir;
nsCOMPtr<nsIFile> mProfileDir; nsCOMPtr<nsIFile> mProfileDir;
PRBool mProfileNotified; PRBool mProfileNotified;
PRBool mRegisterExtraComponents;
}; };
#endif #endif