Fix for #168255 - Change references to MRE into GRE in XPCOM/Embedding

r=dougt, sr=alecf
This commit is contained in:
chak%netscape.com 2002-09-13 22:18:43 +00:00
Родитель 4e642e64bd
Коммит 196cbe728a
11 изменённых файлов: 118 добавлений и 115 удалений

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

@ -109,24 +109,24 @@ nsresult NS_InitEmbedding(nsILocalFile *mozBinDirectory,
return rv;
}
// If the application is using an MRE, then,
// auto register components in the MRE directory as well.
// If the application is using an GRE, then,
// auto register components in the GRE directory as well.
//
// The application indicates that it's using an MRE by
// The application indicates that it's using an GRE by
// returning a valid nsIFile when queried (via appFileLocProvider)
// for the NS_MRE_DIR atom as shown below
// for the NS_GRE_DIR atom as shown below
//
if (appFileLocProvider)
{
nsCOMPtr<nsIFile> mreDir;
nsCOMPtr<nsIFile> greDir;
PRBool persistent = PR_TRUE;
appFileLocProvider->GetFile(NS_MRE_DIR, &persistent, getter_AddRefs(mreDir));
appFileLocProvider->GetFile(NS_GRE_DIR, &persistent, getter_AddRefs(greDir));
if (mreDir)
if (greDir)
{
rv = registrar->AutoRegister(mreDir);
NS_ASSERTION(NS_SUCCEEDED(rv), "Could not AutoRegister MRE components");
rv = registrar->AutoRegister(greDir);
NS_ASSERTION(NS_SUCCEEDED(rv), "Could not AutoRegister GRE components");
}
}
#endif

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

@ -149,21 +149,21 @@ winEmbedFileLocProvider::GetFile(const char *prop, PRBool *persistant, nsIFile *
rv = localFile->AppendRelativeNativePath(SEARCH_DIR_NAME);
}
//---------------------------------------------------------------
// Note that by returning a valid localFile's for NS_MRE_DIR and
// NS_NRE_COMPONENT_DIR your app is indicating to XPCOM that
// it found an MRE version with which it's compatible with and
// it intends to be "run against" that MRE
// Note that by returning a valid localFile's for NS_GRE_DIR and
// NS_GRE_COMPONENT_DIR your app is indicating to XPCOM that
// it found an GRE version with which it's compatible with and
// it intends to be "run against" that GRE
//
// Please see http://www.mozilla.org/projects/embedding/MRE.html
// for more info. on MRE
// for more info. on GRE
//---------------------------------------------------------------
else if (nsCRT::strcmp(prop, NS_MRE_DIR) == 0)
else if (nsCRT::strcmp(prop, NS_GRE_DIR) == 0)
{
rv = GetMreDirectory(getter_AddRefs(localFile));
rv = GetGreDirectory(getter_AddRefs(localFile));
}
else if (nsCRT::strcmp(prop, NS_MRE_COMPONENT_DIR) == 0)
else if (nsCRT::strcmp(prop, NS_GRE_COMPONENT_DIR) == 0)
{
rv = GetMreDirectory(getter_AddRefs(localFile));
rv = GetGreDirectory(getter_AddRefs(localFile));
if (NS_SUCCEEDED(rv))
rv = localFile->AppendRelativeNativePath(COMPONENTS_DIR_NAME);
}
@ -174,73 +174,73 @@ winEmbedFileLocProvider::GetFile(const char *prop, PRBool *persistant, nsIFile *
return rv;
}
// Get the location of the MRE version we're compatible with from
// Get the location of the GRE version we're compatible with from
// the registry
//
static char * GetMreLocationFromRegistry()
static char * GetGreLocationFromRegistry()
{
char szKey[256];
HKEY hRegKey = NULL;
DWORD dwLength = _MAX_PATH * sizeof(char);
long rc;
char keyValue[_MAX_PATH + 1];
char *pMreLocation = NULL;
char *pGreLocation = NULL;
// A couple of key points here:
// 1. Note the usage of the "Software\\Mozilla\\MRE" subkey - this allows
// us to have multiple versions of MREs on the same machine by having
// 1. Note the usage of the "Software\\Mozilla\\GRE" subkey - this allows
// us to have multiple versions of GREs on the same machine by having
// subkeys such as 1.0, 1.1, 2.0 etc. under it.
// 2. In this sample below we're looking for the location of MRE version 1.0
// i.e. we're compatible with MRE 1.0 and we're trying to find it's install
// 2. In this sample below we're looking for the location of GRE version 1.2
// i.e. we're compatible with GRE 1.2 and we're trying to find it's install
// location.
//
// Please see http://www.mozilla.org/projects/embedding/MRE.html for
// more info.
//
strcpy(szKey, "Software\\Mozilla\\MRE\\1.0");
strcpy(szKey, "Software\\Mozilla\\GRE\\1.2b");
if (::RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, KEY_QUERY_VALUE, &hRegKey) == ERROR_SUCCESS)
{
if ((rc = ::RegQueryValueEx(hRegKey, "MreHome", NULL, NULL, (BYTE *)keyValue, &dwLength))==ERROR_SUCCESS)
if ((rc = ::RegQueryValueEx(hRegKey, "GreHome", NULL, NULL, (BYTE *)keyValue, &dwLength))==ERROR_SUCCESS)
{
pMreLocation = ::strdup(keyValue);
pGreLocation = ::strdup(keyValue);
::RegCloseKey(hRegKey);
}
}
return pMreLocation;
return pGreLocation;
}
// Create and return the location of the MRE the application is
// Create and return the location of the GRE the application is
// currently using, if any, via the |aLocalFile| param
//
// If an embedding application is written to use an MRE it determines
// the compatible MRE's location by looking in the Windows registry
// In this case GetMreDirectory() creates a new localFile based on the
// MRE path it just read from the registry
// If an embedding application is written to use an GRE it determines
// the compatible GRE's location by looking in the Windows registry
// In this case GetGreDirectory() creates a new localFile based on the
// GRE path it just read from the registry
//
// If the embedding appliction is not using an MRE and is running in
// a "regular" embedding scenario GetMreDirectory() simply returns a
// failure code indicating to the caller to fallback to a non-MRE
// If the embedding appliction is not using an GRE and is running in
// a "regular" embedding scenario GetGreDirectory() simply returns a
// failure code indicating to the caller to fallback to a non-GRE
// based operation - which is the default mode of operation.
//
// Please see http://www.mozilla.org/projects/embedding/MRE.html for
// more information on the Mozilla Runtime Environment(MRE) and for
// the actual registry key whichs contains the MRE path, if any.
// more information on the Mozilla Runtime Environment(GRE) and for
// the actual registry key whichs contains the GRE path, if any.
NS_METHOD winEmbedFileLocProvider::GetMreDirectory(nsILocalFile **aLocalFile)
NS_METHOD winEmbedFileLocProvider::GetGreDirectory(nsILocalFile **aLocalFile)
{
NS_ENSURE_ARG_POINTER(aLocalFile);
nsresult rv = NS_ERROR_FAILURE;
// Get the path of the MRE which is compatible with our embedding application
// Get the path of the GRE which is compatible with our embedding application
// from the registry
//
char *pMreDir = GetMreLocationFromRegistry();
if(pMreDir)
char *pGreDir = GetMreLocationFromRegistry();
if(pGreDir)
{
nsCOMPtr<nsILocalFile> tempLocal;
rv = NS_NewNativeLocalFile(nsDependentCString(pMreDir), TRUE, getter_AddRefs(tempLocal));
rv = NS_NewNativeLocalFile(nsDependentCString(pGreDir), TRUE, getter_AddRefs(tempLocal));
if (tempLocal)
{
@ -249,7 +249,7 @@ NS_METHOD winEmbedFileLocProvider::GetMreDirectory(nsILocalFile **aLocalFile)
rv = NS_OK;
}
::free(pMreDir);
::free(pGreDir);
}
return rv;

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

@ -47,7 +47,7 @@ protected:
NS_METHOD CloneMozBinDirectory(nsILocalFile **aLocalFile);
NS_METHOD GetProductDirectory(nsILocalFile **aLocalFile);
NS_METHOD GetDefaultUserProfileRoot(nsILocalFile **aLocalFile);
NS_METHOD GetMreDirectory(nsILocalFile **aLocalFile);
NS_METHOD GetGreDirectory(nsILocalFile **aLocalFile);
char mProductDirName[256];
nsCOMPtr<nsILocalFile> mMozBinDirectory;

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

@ -352,13 +352,13 @@ BOOL CMfcEmbedApp::InitInstance()
Enable3dControls();
//
// 1. Determine the name of the dir from which the MRE based app is being run
// from [It's OK to do this even if you're not running in an MRE env]
// 1. Determine the name of the dir from which the GRE based app is being run
// from [It's OK to do this even if you're not running in an GRE env]
//
// 2. Create an nsILocalFile out of it which will passed in to NS_InitEmbedding()
//
// Please see http://www.mozilla.org/projects/embedding/MRE.html
// for more info. on MRE
// for more info. on GRE
char curDir[_MAX_PATH+1];
::GetCurrentDirectory(_MAX_PATH, curDir);

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

@ -156,21 +156,21 @@ winEmbedFileLocProvider::GetFile(const char *prop, PRBool *persistant, nsIFile *
rv = localFile->AppendRelativeNativePath(SEARCH_DIR_NAME);
}
//---------------------------------------------------------------
// Note that by returning a valid localFile's for NS_MRE_DIR and
// NS_NRE_COMPONENT_DIR your app is indicating to XPCOM that
// it found an MRE version with which it's compatible with and
// it intends to be "run against" that MRE
// Note that by returning a valid localFile's for NS_GRE_DIR and
// NS_GRE_COMPONENT_DIR your app is indicating to XPCOM that
// it found an GRE version with which it's compatible with and
// it intends to be "run against" that GRE
//
// Please see http://www.mozilla.org/projects/embedding/MRE.html
// for more info. on MRE
// for more info. on GRE
//---------------------------------------------------------------
else if (nsCRT::strcmp(prop, NS_MRE_DIR) == 0)
else if (nsCRT::strcmp(prop, NS_GRE_DIR) == 0)
{
rv = GetMreDirectory(getter_AddRefs(localFile));
rv = GetGreDirectory(getter_AddRefs(localFile));
}
else if (nsCRT::strcmp(prop, NS_MRE_COMPONENT_DIR) == 0)
else if (nsCRT::strcmp(prop, NS_GRE_COMPONENT_DIR) == 0)
{
rv = GetMreDirectory(getter_AddRefs(localFile));
rv = GetGreDirectory(getter_AddRefs(localFile));
if (NS_SUCCEEDED(rv))
rv = localFile->AppendRelativeNativePath(COMPONENTS_DIR_NAME);
}
@ -181,73 +181,73 @@ winEmbedFileLocProvider::GetFile(const char *prop, PRBool *persistant, nsIFile *
return rv;
}
// Get the location of the MRE version we're compatible with from
// Get the location of the GRE version we're compatible with from
// the registry
//
static char * GetMreLocationFromRegistry()
char * winEmbedFileLocProvider::GetGreLocationFromRegistry()
{
char szKey[256];
HKEY hRegKey = NULL;
DWORD dwLength = _MAX_PATH * sizeof(char);
long rc;
char keyValue[_MAX_PATH + 1];
char *pMreLocation = NULL;
char *pGreLocation = NULL;
// A couple of key points here:
// 1. Note the usage of the "Software\\Mozilla\\MRE" subkey - this allows
// us to have multiple versions of MREs on the same machine by having
// 1. Note the usage of the "Software\\Mozilla\\GRE" subkey - this allows
// us to have multiple versions of GREs on the same machine by having
// subkeys such as 1.0, 1.1, 2.0 etc. under it.
// 2. In this sample below we're looking for the location of MRE version 1.0
// i.e. we're compatible with MRE 1.0 and we're trying to find it's install
// 2. In this sample below we're looking for the location of GRE version 1.2
// i.e. we're compatible with GRE 1.2 and we're trying to find it's install
// location.
//
// Please see http://www.mozilla.org/projects/embedding/MRE.html for
// more info.
//
strcpy(szKey, "Software\\Mozilla\\MRE\\1.0");
strcpy(szKey, "Software\\Mozilla\\GRE\\1.2b");
if (::RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, KEY_QUERY_VALUE, &hRegKey) == ERROR_SUCCESS)
{
if ((rc = ::RegQueryValueEx(hRegKey, "MreHome", NULL, NULL, (BYTE *)keyValue, &dwLength))==ERROR_SUCCESS)
if ((rc = ::RegQueryValueEx(hRegKey, "GreHome", NULL, NULL, (BYTE *)keyValue, &dwLength))==ERROR_SUCCESS)
{
pMreLocation = ::strdup(keyValue);
pGreLocation = ::strdup(keyValue);
::RegCloseKey(hRegKey);
}
}
return pMreLocation;
return pGreLocation;
}
// Create and return the location of the MRE the application is
// Create and return the location of the GRE the application is
// currently using, if any, via the |aLocalFile| param
//
// If an embedding application is written to use an MRE it determines
// the compatible MRE's location by looking in the Windows registry
// In this case GetMreDirectory() creates a new localFile based on the
// MRE path it just read from the registry
// If an embedding application is written to use an GRE it determines
// the compatible GRE's location by looking in the Windows registry
// In this case GetGreDirectory() creates a new localFile based on the
// GRE path it just read from the registry
//
// If the embedding appliction is not using an MRE and is running in
// a "regular" embedding scenario GetMreDirectory() simply returns a
// failure code indicating to the caller to fallback to a non-MRE
// If the embedding appliction is not using an GRE and is running in
// a "regular" embedding scenario GetGreDirectory() simply returns a
// failure code indicating to the caller to fallback to a non-GRE
// based operation - which is the default mode of operation.
//
// Please see http://www.mozilla.org/projects/embedding/MRE.html for
// more information on the Mozilla Runtime Environment(MRE) and for
// the actual registry key whichs contains the MRE path, if any.
// more information on the Gecko Runtime Environment(GRE) and for
// the actual registry key whichs contains the GRE path, if any.
NS_METHOD winEmbedFileLocProvider::GetMreDirectory(nsILocalFile **aLocalFile)
NS_METHOD winEmbedFileLocProvider::GetGreDirectory(nsILocalFile **aLocalFile)
{
NS_ENSURE_ARG_POINTER(aLocalFile);
nsresult rv = NS_ERROR_FAILURE;
// Get the path of the MRE which is compatible with our embedding application
// Get the path of the GRE which is compatible with our embedding application
// from the registry
//
char *pMreDir = GetMreLocationFromRegistry();
if(pMreDir)
char *pGreDir = GetGreLocationFromRegistry();
if(pGreDir)
{
nsCOMPtr<nsILocalFile> tempLocal;
rv = NS_NewNativeLocalFile(nsDependentCString(pMreDir), TRUE, getter_AddRefs(tempLocal));
rv = NS_NewNativeLocalFile(nsDependentCString(pGreDir), TRUE, getter_AddRefs(tempLocal));
if (tempLocal)
{
@ -256,7 +256,7 @@ NS_METHOD winEmbedFileLocProvider::GetMreDirectory(nsILocalFile **aLocalFile)
rv = NS_OK;
}
::free(pMreDir);
::free(pGreDir);
}
return rv;

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

@ -48,13 +48,16 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDIRECTORYSERVICEPROVIDER
static char * GetGreLocationFromRegistry();
protected:
virtual ~winEmbedFileLocProvider();
NS_METHOD CloneMozBinDirectory(nsILocalFile **aLocalFile);
NS_METHOD GetProductDirectory(nsILocalFile **aLocalFile);
NS_METHOD GetDefaultUserProfileRoot(nsILocalFile **aLocalFile);
NS_METHOD GetMreDirectory(nsILocalFile **aLocalFile);
NS_METHOD GetGreDirectory(nsILocalFile **aLocalFile);
char mProductDirName[256];
nsCOMPtr<nsILocalFile> mMozBinDirectory;

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

@ -545,26 +545,26 @@ nsresult NS_COM NS_InitXPCOM2(nsIServiceManager* *result,
// the default components directory.
nsComponentManagerImpl::gComponentManager->AutoRegister(nsnull);
// If the application is using an MRE, then,
// auto register components in the MRE directory as well.
// If the application is using a GRE, then,
// auto register components in the GRE directory as well.
//
// The application indicates that it's using an MRE by
// The application indicates that it's using an GRE by
// returning a valid nsIFile when queried (via appFileLocProvider)
// for the NS_MRE_DIR atom as shown below
// for the NS_GRE_DIR atom as shown below
//
if ( appFileLocationProvider ) {
nsCOMPtr<nsIFile> mreDir;
nsCOMPtr<nsIFile> greDir;
PRBool persistent = PR_TRUE;
appFileLocationProvider->GetFile(NS_MRE_DIR, &persistent, getter_AddRefs(mreDir));
appFileLocationProvider->GetFile(NS_GRE_DIR, &persistent, getter_AddRefs(greDir));
if (mreDir)
if (greDir)
{
rv = nsComponentManagerImpl::gComponentManager->AutoRegister(mreDir);
rv = nsComponentManagerImpl::gComponentManager->AutoRegister(greDir);
if (NS_FAILED(rv))
{
NS_ERROR("Could not AutoRegister MRE components");
NS_ERROR("Could not AutoRegister GRE components");
return rv;
}
}

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

@ -337,8 +337,8 @@ nsDirectoryService::GetCurrentProcessDirectory(nsILocalFile** aFile)
nsIAtom* nsDirectoryService::sCurrentProcess = nsnull;
nsIAtom* nsDirectoryService::sComponentRegistry = nsnull;
nsIAtom* nsDirectoryService::sComponentDirectory = nsnull;
nsIAtom* nsDirectoryService::sMRE_Directory = nsnull;
nsIAtom* nsDirectoryService::sMRE_ComponentDirectory = nsnull;
nsIAtom* nsDirectoryService::sGRE_Directory = nsnull;
nsIAtom* nsDirectoryService::sGRE_ComponentDirectory = nsnull;
nsIAtom* nsDirectoryService::sOS_DriveDirectory = nsnull;
nsIAtom* nsDirectoryService::sOS_TemporaryDirectory = nsnull;
nsIAtom* nsDirectoryService::sOS_CurrentProcessDirectory = nsnull;
@ -438,8 +438,8 @@ nsDirectoryService::Init()
nsDirectoryService::sCurrentProcess = NS_NewAtom(NS_XPCOM_CURRENT_PROCESS_DIR);
nsDirectoryService::sComponentRegistry = NS_NewAtom(NS_XPCOM_COMPONENT_REGISTRY_FILE);
nsDirectoryService::sComponentDirectory = NS_NewAtom(NS_XPCOM_COMPONENT_DIR);
nsDirectoryService::sMRE_Directory = NS_NewAtom(NS_MRE_DIR);
nsDirectoryService::sMRE_ComponentDirectory = NS_NewAtom(NS_MRE_COMPONENT_DIR);
nsDirectoryService::sGRE_Directory = NS_NewAtom(NS_GRE_DIR);
nsDirectoryService::sGRE_ComponentDirectory = NS_NewAtom(NS_GRE_COMPONENT_DIR);
nsDirectoryService::sOS_DriveDirectory = NS_NewAtom(NS_OS_DRIVE_DIR);
nsDirectoryService::sOS_TemporaryDirectory = NS_NewAtom(NS_OS_TEMP_DIR);
@ -530,8 +530,8 @@ nsDirectoryService::~nsDirectoryService()
NS_IF_RELEASE(nsDirectoryService::sCurrentProcess);
NS_IF_RELEASE(nsDirectoryService::sComponentRegistry);
NS_IF_RELEASE(nsDirectoryService::sComponentDirectory);
NS_IF_RELEASE(nsDirectoryService::sMRE_Directory);
NS_IF_RELEASE(nsDirectoryService::sMRE_ComponentDirectory);
NS_IF_RELEASE(nsDirectoryService::sGRE_Directory);
NS_IF_RELEASE(nsDirectoryService::sGRE_ComponentDirectory);
NS_IF_RELEASE(nsDirectoryService::sOS_DriveDirectory);
NS_IF_RELEASE(nsDirectoryService::sOS_TemporaryDirectory);
NS_IF_RELEASE(nsDirectoryService::sOS_CurrentProcessDirectory);
@ -812,11 +812,11 @@ nsDirectoryService::GetFile(const char *prop, PRBool *persistent, nsIFile **_ret
if (localFile)
localFile->AppendNative(COMPONENT_REGISTRY_NAME);
}
else if (inAtom == nsDirectoryService::sMRE_Directory)
else if (inAtom == nsDirectoryService::sGRE_Directory)
{
rv = GetCurrentProcessDirectory(getter_AddRefs(localFile));
}
else if (inAtom == nsDirectoryService::sMRE_ComponentDirectory)
else if (inAtom == nsDirectoryService::sGRE_ComponentDirectory)
{
rv = GetCurrentProcessDirectory(getter_AddRefs(localFile));
if (localFile)

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

@ -81,8 +81,8 @@ private:
static nsIAtom *sCurrentProcess;
static nsIAtom *sComponentRegistry;
static nsIAtom *sComponentDirectory;
static nsIAtom *sMRE_Directory;
static nsIAtom *sMRE_ComponentDirectory;
static nsIAtom *sGRE_Directory;
static nsIAtom *sGRE_ComponentDirectory;
static nsIAtom *sOS_DriveDirectory;
static nsIAtom *sOS_TemporaryDirectory;
static nsIAtom *sOS_CurrentProcessDirectory;

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

@ -59,8 +59,8 @@
#define NS_XPCOM_COMPONENT_REGISTRY_FILE "ComRegF"
#define NS_XPCOM_COMPONENT_DIR "ComsD"
#define NS_MRE_DIR "MreD"
#define NS_MRE_COMPONENT_DIR "MreComsD"
#define NS_GRE_DIR "GreD"
#define NS_GRE_COMPONENT_DIR "GreComsD"
#define NS_OS_HOME_DIR "Home"
#define NS_OS_DRIVE_DIR "DrvD"

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

@ -251,20 +251,20 @@ PRBool xptiInterfaceInfoManager::BuildFileSearchPath(nsISupportsArray** aPath)
// Add additional plugins dirs
// No error checking here since this is optional in some embeddings
// Add the MRE's component directory to searchPath if the
// application is using an MRE.
// An application indicates that it's using an MRE by returning
// Add the GRE's component directory to searchPath if the
// application is using an GRE.
// An application indicates that it's using an GRE by returning
// a valid nsIFile via it's directory service provider interface.
//
// Please see http://www.mozilla.org/projects/embedding/MRE.html
// for more info. on MREs
// for more info. on GREs
//
nsCOMPtr<nsILocalFile> mreComponentDirectory;
nsresult rv = GetDirectoryFromDirService(NS_MRE_COMPONENT_DIR,
getter_AddRefs(mreComponentDirectory));
nsCOMPtr<nsILocalFile> greComponentDirectory;
nsresult rv = GetDirectoryFromDirService(NS_GRE_COMPONENT_DIR,
getter_AddRefs(greComponentDirectory));
if (NS_SUCCEEDED(rv))
{
searchPath->AppendElement(mreComponentDirectory);
searchPath->AppendElement(greComponentDirectory);
}
(void) AppendFromDirServiceList(NS_APP_PLUGINS_DIR_LIST, searchPath);