Add experimental support to the native component loader so that native components can declare what libraries it depends on. (193442) Storing the GRE location in a relative way so that we can change GRE versions between launches assuming that they are compatible (191415). Fixed a bug where we didn't check return from GetLastModification in nsDll::HasChanged. Thank you ajschult@eos.ncsu.edu for pointing out the problem and suggesting a fix. Converted a linear search of compreg entries to be a hash lookup. Also cleaned up the xcdll class. Reviewers= Alec, Darin.
This commit is contained in:
@@ -535,6 +535,14 @@ endif
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Dependent libs
|
||||||
|
ifdef IS_COMPONENT
|
||||||
|
DEPENDENT_LIBS = $(patsubst -l%,$(LIB_PREFIX)%$(DLL_SUFFIX),$(filter -l%, $(EXTRA_DSO_LDOPTS)))
|
||||||
|
ifneq (,$(strip $(DEPENDENT_LIBS)))
|
||||||
|
DEFINES += -DDEPENDENT_LIBS="$(foreach f,$(DEPENDENT_LIBS),\"${f}\",)"
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
all::
|
all::
|
||||||
@@ -1680,6 +1688,7 @@ ifneq (,$(filter $(PROGRAM) $(HOST_PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $
|
|||||||
@echo "SHARED_LIBS = $(SHARED_LIBS)"
|
@echo "SHARED_LIBS = $(SHARED_LIBS)"
|
||||||
@echo "EXTRA_DSO_LIBS = $(EXTRA_DSO_LIBS)"
|
@echo "EXTRA_DSO_LIBS = $(EXTRA_DSO_LIBS)"
|
||||||
@echo "EXTRA_DSO_LDOPTS = $(EXTRA_DSO_LDOPTS)"
|
@echo "EXTRA_DSO_LDOPTS = $(EXTRA_DSO_LDOPTS)"
|
||||||
|
@echo "DEPENDENT_LIBS = $(DEPENDENT_LIBS)"
|
||||||
@echo --------------------------------------------------------------------------------
|
@echo --------------------------------------------------------------------------------
|
||||||
endif
|
endif
|
||||||
+$(LOOP_OVER_MOZ_DIRS)
|
+$(LOOP_OVER_MOZ_DIRS)
|
||||||
|
|||||||
@@ -148,7 +148,6 @@ void XXXNeverCalled()
|
|||||||
xptc_dummy2();
|
xptc_dummy2();
|
||||||
XPTI_GetInterfaceInfoManager();
|
XPTI_GetInterfaceInfoManager();
|
||||||
NS_NewGenericFactory(NULL, NULL);
|
NS_NewGenericFactory(NULL, NULL);
|
||||||
NS_NewGenericModule(NULL, 0, NULL, NULL, NULL);
|
|
||||||
NS_NewGenericModule2(NULL, NULL);
|
NS_NewGenericModule2(NULL, NULL);
|
||||||
NS_NewHashtableEnumerator(NULL, NULL, NULL, NULL);
|
NS_NewHashtableEnumerator(NULL, NULL, NULL, NULL);
|
||||||
nsCWeakProxy(0, 0);
|
nsCWeakProxy(0, 0);
|
||||||
|
|||||||
@@ -70,16 +70,17 @@ XPIDLSRCS = \
|
|||||||
nsIComponentLoaderManager.idl \
|
nsIComponentLoaderManager.idl \
|
||||||
nsIComponentManagerObsolete.idl \
|
nsIComponentManagerObsolete.idl \
|
||||||
nsIRegistry.idl \
|
nsIRegistry.idl \
|
||||||
|
nsINativeComponentLoader.idl \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
SDK_XPIDLSRCS = \
|
SDK_XPIDLSRCS = \
|
||||||
nsIClassInfo.idl \
|
nsIClassInfo.idl \
|
||||||
nsIComponentRegistrar.idl \
|
nsIComponentRegistrar.idl \
|
||||||
nsIFactory.idl \
|
nsIFactory.idl \
|
||||||
nsIModule.idl \
|
nsIModule.idl \
|
||||||
nsIServiceManager.idl \
|
nsIServiceManager.idl \
|
||||||
nsIComponentManager.idl \
|
nsIComponentManager.idl \
|
||||||
nsICategoryManager.idl \
|
nsICategoryManager.idl \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||||
|
|||||||
@@ -61,6 +61,8 @@
|
|||||||
#include "nsLocalFile.h"
|
#include "nsLocalFile.h"
|
||||||
#include "nsNativeComponentLoader.h"
|
#include "nsNativeComponentLoader.h"
|
||||||
#include "nsRegistry.h"
|
#include "nsRegistry.h"
|
||||||
|
#include "nsReadableUtils.h"
|
||||||
|
#include "nsString.h"
|
||||||
#include "nsXPIDLString.h"
|
#include "nsXPIDLString.h"
|
||||||
#include "prcmon.h"
|
#include "prcmon.h"
|
||||||
#include "xptinfo.h" // this after nsISupports, to pick up IID so that xpt stuff doesn't try to define it itself...
|
#include "xptinfo.h" // this after nsISupports, to pick up IID so that xpt stuff doesn't try to define it itself...
|
||||||
@@ -119,7 +121,7 @@ const char versionValueName[]="VersionString";
|
|||||||
|
|
||||||
const static char XPCOM_ABSCOMPONENT_PREFIX[] = "abs:";
|
const static char XPCOM_ABSCOMPONENT_PREFIX[] = "abs:";
|
||||||
const static char XPCOM_RELCOMPONENT_PREFIX[] = "rel:";
|
const static char XPCOM_RELCOMPONENT_PREFIX[] = "rel:";
|
||||||
const char XPCOM_LIB_PREFIX[] = "lib:";
|
const static char XPCOM_GRECOMPONENT_PREFIX[] = "gre:";
|
||||||
|
|
||||||
const static char persistentRegistryFilename[] = "compreg.dat";
|
const static char persistentRegistryFilename[] = "compreg.dat";
|
||||||
const static char persistentRegistryTempFilename[] = "compreg.tmp";
|
const static char persistentRegistryTempFilename[] = "compreg.tmp";
|
||||||
@@ -670,7 +672,8 @@ ConvertContractIDKeyToString(PLDHashTable *table,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// this is safe to call during InitXPCOM
|
// this is safe to call during InitXPCOM
|
||||||
static nsresult GetDefaultComponentsDirectory(nsIFile** aDirectory)
|
static nsresult GetLocationFromDirectoryService(const char* prop,
|
||||||
|
nsIFile** aDirectory)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIProperties> directoryService;
|
nsCOMPtr<nsIProperties> directoryService;
|
||||||
nsDirectoryService::Create(nsnull,
|
nsDirectoryService::Create(nsnull,
|
||||||
@@ -680,11 +683,12 @@ static nsresult GetDefaultComponentsDirectory(nsIFile** aDirectory)
|
|||||||
if (!directoryService)
|
if (!directoryService)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
return directoryService->Get(NS_XPCOM_COMPONENT_DIR,
|
return directoryService->Get(prop,
|
||||||
NS_GET_IID(nsIFile),
|
NS_GET_IID(nsIFile),
|
||||||
(void**)aDirectory);
|
(void**)aDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// nsComponentManagerImpl
|
// nsComponentManagerImpl
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -694,7 +698,9 @@ nsComponentManagerImpl::nsComponentManagerImpl()
|
|||||||
:
|
:
|
||||||
mMon(NULL),
|
mMon(NULL),
|
||||||
mNativeComponentLoader(0),
|
mNativeComponentLoader(0),
|
||||||
|
#ifdef ENABLE_STATIC_COMPONENT_LOADER
|
||||||
mStaticComponentLoader(0),
|
mStaticComponentLoader(0),
|
||||||
|
#endif
|
||||||
mShuttingDown(NS_SHUTDOWN_NEVERHAPPENED),
|
mShuttingDown(NS_SHUTDOWN_NEVERHAPPENED),
|
||||||
mLoaderData(nsnull),
|
mLoaderData(nsnull),
|
||||||
mRegistryDirty(PR_FALSE)
|
mRegistryDirty(PR_FALSE)
|
||||||
@@ -714,8 +720,6 @@ nsresult nsComponentManagerImpl::Init(void)
|
|||||||
if (nsComponentManagerLog == nsnull)
|
if (nsComponentManagerLog == nsnull)
|
||||||
{
|
{
|
||||||
nsComponentManagerLog = PR_NewLogModule("nsComponentManager");
|
nsComponentManagerLog = PR_NewLogModule("nsComponentManager");
|
||||||
PR_LOG(nsComponentManagerLog, PR_LOG_ALWAYS,
|
|
||||||
("xpcom-log-version : " NS_XPCOM_COMPONENT_MANAGER_VERSION_STRING));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize our arena
|
// Initialize our arena
|
||||||
@@ -798,8 +802,9 @@ nsresult nsComponentManagerImpl::Init(void)
|
|||||||
mStaticComponentLoader->Init(this, nsnull);
|
mStaticComponentLoader->Init(this, nsnull);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
NR_StartupRegistry();
|
||||||
|
|
||||||
GetDefaultComponentsDirectory(getter_AddRefs(mComponentsDir));
|
GetLocationFromDirectoryService(NS_XPCOM_COMPONENT_DIR, getter_AddRefs(mComponentsDir));
|
||||||
if (!mComponentsDir)
|
if (!mComponentsDir)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
@@ -810,13 +815,28 @@ nsresult nsComponentManagerImpl::Init(void)
|
|||||||
|
|
||||||
mComponentsOffset = componentDescriptor.Length();
|
mComponentsOffset = componentDescriptor.Length();
|
||||||
|
|
||||||
NR_StartupRegistry();
|
GetLocationFromDirectoryService(NS_GRE_COMPONENT_DIR, getter_AddRefs(mGREComponentsDir));
|
||||||
|
if (mGREComponentsDir) {
|
||||||
|
nsresult rv = mGREComponentsDir->GetNativePath(componentDescriptor);
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
NS_WARNING("No GRE component manager");
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
mGREComponentsOffset = componentDescriptor.Length();
|
||||||
|
}
|
||||||
|
|
||||||
PR_LOG(nsComponentManagerLog, PR_LOG_ALWAYS,
|
PR_LOG(nsComponentManagerLog, PR_LOG_ALWAYS,
|
||||||
("nsComponentManager: Initialized."));
|
("nsComponentManager: Initialized."));
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PRIntn PR_CALLBACK AutoRegEntryDestroy(nsHashKey *aKey, void *aData, void* aClosure)
|
||||||
|
{
|
||||||
|
delete (AutoRegEntry*)aData;
|
||||||
|
return kHashEnumerateNext;
|
||||||
|
}
|
||||||
|
|
||||||
nsresult nsComponentManagerImpl::Shutdown(void)
|
nsresult nsComponentManagerImpl::Shutdown(void)
|
||||||
{
|
{
|
||||||
PR_ASSERT(mShuttingDown == NS_SHUTDOWN_NEVERHAPPENED);
|
PR_ASSERT(mShuttingDown == NS_SHUTDOWN_NEVERHAPPENED);
|
||||||
@@ -840,11 +860,8 @@ nsresult nsComponentManagerImpl::Shutdown(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = mAutoRegEntries.Count() - 1; i >= 0; i--) {
|
|
||||||
AutoRegEntry* entry = NS_STATIC_CAST(AutoRegEntry*, mAutoRegEntries[i]);
|
mAutoRegEntries.Reset(AutoRegEntryDestroy);
|
||||||
delete entry;
|
|
||||||
mAutoRegEntries.RemoveElementAt(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Release all cached factories
|
// Release all cached factories
|
||||||
if (mContractIDs.ops) {
|
if (mContractIDs.ops) {
|
||||||
@@ -917,14 +934,16 @@ NS_IMPL_THREADSAFE_ISUPPORTS8(nsComponentManagerImpl,
|
|||||||
nsresult
|
nsresult
|
||||||
nsComponentManagerImpl::GetInterface(const nsIID & uuid, void **result)
|
nsComponentManagerImpl::GetInterface(const nsIID & uuid, void **result)
|
||||||
{
|
{
|
||||||
if (uuid.Equals(NS_GET_IID(nsIServiceManager)))
|
if (uuid.Equals(NS_GET_IID(nsINativeComponentLoader)))
|
||||||
{
|
{
|
||||||
*result = NS_STATIC_CAST(nsIServiceManager*, this);
|
if (!mNativeComponentLoader)
|
||||||
NS_ADDREF_THIS();
|
return NS_ERROR_NOT_INITIALIZED;
|
||||||
return NS_OK;
|
|
||||||
|
return mNativeComponentLoader->QueryInterface(uuid, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// fall through to QI as anything QIable is a superset of what canbe
|
NS_WARNING("This isn't supported");
|
||||||
|
// fall through to QI as anything QIable is a superset of what can be
|
||||||
// got via the GetInterface()
|
// got via the GetInterface()
|
||||||
return QueryInterface(uuid, result);
|
return QueryInterface(uuid, result);
|
||||||
}
|
}
|
||||||
@@ -941,10 +960,12 @@ AutoRegEntry::AutoRegEntry(const char* name, PRInt64* modDate)
|
|||||||
{
|
{
|
||||||
mName = PL_strdup(name);
|
mName = PL_strdup(name);
|
||||||
mModDate = *modDate;
|
mModDate = *modDate;
|
||||||
|
mData = nsnull;
|
||||||
}
|
}
|
||||||
AutoRegEntry::~AutoRegEntry()
|
AutoRegEntry::~AutoRegEntry()
|
||||||
{
|
{
|
||||||
if (mName) PL_strfree(mName);
|
if (mName) PL_strfree(mName);
|
||||||
|
if (mData) PL_strfree(mData);
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
@@ -953,6 +974,19 @@ AutoRegEntry::Modified(PRInt64 *date)
|
|||||||
return !LL_EQ(*date, mModDate);
|
return !LL_EQ(*date, mModDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
AutoRegEntry::SetOptionalData(const char* data)
|
||||||
|
{
|
||||||
|
if (mData)
|
||||||
|
PL_strfree(mData);
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
mData = nsnull;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mData = PL_strdup(data);
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
PRBool ReadSectionHeader(nsManifestLineReader& reader, const char *token)
|
PRBool ReadSectionHeader(nsManifestLineReader& reader, const char *token)
|
||||||
@@ -1084,8 +1118,9 @@ nsComponentManagerImpl::ReadPersistentRegistry()
|
|||||||
if (!reader.NextLine())
|
if (!reader.NextLine())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//name,last_modification_date
|
//name,last_modification_date[,optionaldata]
|
||||||
if (2 != reader.ParseLine(values, lengths, 2))
|
int parts = reader.ParseLine(values, lengths, 3);
|
||||||
|
if (2 > parts)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
PRInt64 a = nsCRT::atoll(values[1]);
|
PRInt64 a = nsCRT::atoll(values[1]);
|
||||||
@@ -1094,7 +1129,11 @@ nsComponentManagerImpl::ReadPersistentRegistry()
|
|||||||
if (!entry)
|
if (!entry)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
mAutoRegEntries.AppendElement(entry);
|
if (parts == 3)
|
||||||
|
entry->SetOptionalData(values[2]);
|
||||||
|
|
||||||
|
nsCStringKey key((const char*)values[0]);
|
||||||
|
mAutoRegEntries.Put(&key, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ReadSectionHeader(reader, "CLASSIDS"))
|
if (ReadSectionHeader(reader, "CLASSIDS"))
|
||||||
@@ -1282,18 +1321,20 @@ ClassIDWriter(PLDHashTable *table,
|
|||||||
return PL_DHASH_NEXT;
|
return PL_DHASH_NEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
PR_STATIC_CALLBACK(PRBool)
|
PRIntn PR_CALLBACK
|
||||||
AutoRegEntryWriter(void* aElement, void *aData)
|
AutoRegEntryWriter(nsHashKey *aKey, void *aData, void* aClosure)
|
||||||
{
|
{
|
||||||
PRFileDesc* fd = (PRFileDesc*) aData;
|
PRFileDesc* fd = (PRFileDesc*) aClosure;
|
||||||
AutoRegEntry* entry = (AutoRegEntry*) aElement;
|
AutoRegEntry* entry = (AutoRegEntry*) aData;
|
||||||
|
|
||||||
//name,last_modification_date
|
|
||||||
PR_fprintf(fd,
|
|
||||||
"%s,%lld\n",
|
|
||||||
entry->GetName(),
|
|
||||||
entry->GetDate());
|
|
||||||
|
|
||||||
|
const char* extraData = entry->GetOptionalData();
|
||||||
|
const char *fmt;
|
||||||
|
if (extraData)
|
||||||
|
fmt = "%s,%lld,%s\n";
|
||||||
|
else
|
||||||
|
fmt = "%s,%lld\n";
|
||||||
|
PR_fprintf(fd, fmt, entry->GetName(), entry->GetDate(), extraData);
|
||||||
|
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1400,7 +1441,7 @@ nsComponentManagerImpl::WritePersistentRegistry()
|
|||||||
if (!PR_fprintf(fd, "\n[COMPONENTS]\n"))
|
if (!PR_fprintf(fd, "\n[COMPONENTS]\n"))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
mAutoRegEntries.EnumerateForwards(AutoRegEntryWriter, (void*)fd);
|
mAutoRegEntries.Enumerate(AutoRegEntryWriter, (void*)fd);
|
||||||
|
|
||||||
PersistentWriterArgs args;
|
PersistentWriterArgs args;
|
||||||
args.mFD = fd;
|
args.mFD = fd;
|
||||||
@@ -1826,6 +1867,7 @@ nsComponentManagerImpl::CreateInstance(const nsCID &aClass,
|
|||||||
rv = NS_ERROR_FACTORY_NOT_REGISTERED;
|
rv = NS_ERROR_FACTORY_NOT_REGISTERED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (PR_LOG_TEST(nsComponentManagerLog, PR_LOG_ALWAYS))
|
if (PR_LOG_TEST(nsComponentManagerLog, PR_LOG_ALWAYS))
|
||||||
{
|
{
|
||||||
char *buf = aClass.ToString();
|
char *buf = aClass.ToString();
|
||||||
@@ -1850,9 +1892,9 @@ nsComponentManagerImpl::CreateInstance(const nsCID &aClass,
|
|||||||
*/
|
*/
|
||||||
nsresult
|
nsresult
|
||||||
nsComponentManagerImpl::CreateInstanceByContractID(const char *aContractID,
|
nsComponentManagerImpl::CreateInstanceByContractID(const char *aContractID,
|
||||||
nsISupports *aDelegate,
|
nsISupports *aDelegate,
|
||||||
const nsIID &aIID,
|
const nsIID &aIID,
|
||||||
void **aResult)
|
void **aResult)
|
||||||
{
|
{
|
||||||
// test this first, since there's no point in creating a component during
|
// test this first, since there's no point in creating a component during
|
||||||
// shutdown -- whether it's available or not would depend on the order it
|
// shutdown -- whether it's available or not would depend on the order it
|
||||||
@@ -2373,13 +2415,6 @@ MakeRegistryName(const char *aDllName, const char *prefix, char **regName)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsComponentManagerImpl::RegistryNameForLib(const char *aLibName,
|
|
||||||
char **aRegistryName)
|
|
||||||
{
|
|
||||||
return MakeRegistryName(aLibName, XPCOM_LIB_PREFIX, aRegistryName);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsComponentManagerImpl::RegistryLocationForSpec(nsIFile *aSpec,
|
nsComponentManagerImpl::RegistryLocationForSpec(nsIFile *aSpec,
|
||||||
char **aRegistryName)
|
char **aRegistryName)
|
||||||
@@ -2394,30 +2429,42 @@ nsComponentManagerImpl::RegistryLocationForSpec(nsIFile *aSpec,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// First check to see if this component is in the application
|
||||||
|
// components directory
|
||||||
PRBool containedIn;
|
PRBool containedIn;
|
||||||
mComponentsDir->Contains(aSpec, PR_TRUE, &containedIn);
|
mComponentsDir->Contains(aSpec, PR_TRUE, &containedIn);
|
||||||
|
|
||||||
nsCAutoString persistentDescriptor;
|
nsCAutoString nativePathString;
|
||||||
|
|
||||||
if (containedIn){
|
if (containedIn){
|
||||||
rv = aSpec->GetNativePath(persistentDescriptor);
|
rv = aSpec->GetNativePath(nativePathString);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
const char* relativeLocation = persistentDescriptor.get() + mComponentsOffset + 1;
|
const char* relativeLocation = nativePathString.get() + mComponentsOffset + 1;
|
||||||
|
return MakeRegistryName(relativeLocation, XPCOM_RELCOMPONENT_PREFIX, aRegistryName);
|
||||||
|
}
|
||||||
|
|
||||||
rv = MakeRegistryName(relativeLocation, XPCOM_RELCOMPONENT_PREFIX,
|
// Next check to see if this component is in the GRE
|
||||||
aRegistryName);
|
// components directory
|
||||||
} else {
|
|
||||||
/* absolute names include volume info on Mac, so persistent descriptor */
|
mGREComponentsDir->Contains(aSpec, PR_TRUE, &containedIn);
|
||||||
rv = aSpec->GetNativePath(persistentDescriptor);
|
|
||||||
|
if (containedIn){
|
||||||
|
rv = aSpec->GetNativePath(nativePathString);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
rv = MakeRegistryName(persistentDescriptor.get(), XPCOM_ABSCOMPONENT_PREFIX,
|
|
||||||
aRegistryName);
|
const char* relativeLocation = nativePathString.get() + mGREComponentsOffset + 1;
|
||||||
}
|
return MakeRegistryName(relativeLocation, XPCOM_GRECOMPONENT_PREFIX, aRegistryName);
|
||||||
|
}
|
||||||
|
|
||||||
return rv;
|
/* absolute names include volume info on Mac, so persistent descriptor */
|
||||||
|
rv = aSpec->GetNativePath(nativePathString);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
return MakeRegistryName(nativePathString.get(), XPCOM_ABSCOMPONENT_PREFIX, aRegistryName);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
@@ -2455,6 +2502,22 @@ nsComponentManagerImpl::SpecForRegistryLocation(const char *aLocation,
|
|||||||
*aSpec = file;
|
*aSpec = file;
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!strncmp(aLocation, XPCOM_GRECOMPONENT_PREFIX, 4)) {
|
||||||
|
|
||||||
|
if (!mGREComponentsDir)
|
||||||
|
return NS_ERROR_NOT_INITIALIZED;
|
||||||
|
|
||||||
|
nsILocalFile* file = nsnull;
|
||||||
|
rv = mGREComponentsDir->Clone((nsIFile**)&file);
|
||||||
|
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
rv = file->AppendRelativeNativePath(nsDependentCString(aLocation + 4));
|
||||||
|
*aSpec = file;
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
*aSpec = nsnull;
|
*aSpec = nsnull;
|
||||||
return NS_ERROR_INVALID_ARG;
|
return NS_ERROR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
@@ -2598,13 +2661,6 @@ nsComponentManagerImpl::RegisterComponentSpec(const nsCID &aClass,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Register a ``library'', which is a DLL location named by a simple filename
|
|
||||||
* such as ``libnsappshell.so'', rather than a relative or absolute path.
|
|
||||||
*
|
|
||||||
* It implies application/x-moz-dll as the component type, and skips the
|
|
||||||
* FindLoaderForType phase.
|
|
||||||
*/
|
|
||||||
nsresult
|
nsresult
|
||||||
nsComponentManagerImpl::RegisterComponentLib(const nsCID &aClass,
|
nsComponentManagerImpl::RegisterComponentLib(const nsCID &aClass,
|
||||||
const char *aClassName,
|
const char *aClassName,
|
||||||
@@ -2613,12 +2669,8 @@ nsComponentManagerImpl::RegisterComponentLib(const nsCID &aClass,
|
|||||||
PRBool aReplace,
|
PRBool aReplace,
|
||||||
PRBool aPersist)
|
PRBool aPersist)
|
||||||
{
|
{
|
||||||
nsXPIDLCString registryName;
|
// deprecated and obsolete.
|
||||||
nsresult rv = RegistryNameForLib(aDllName, getter_Copies(registryName));
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
return RegisterComponentCommon(aClass, aClassName, aContractID, registryName,
|
|
||||||
aReplace, aPersist, nativeComponentType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -3010,7 +3062,7 @@ nsComponentManagerImpl::AutoRegisterImpl(PRInt32 when,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GetDefaultComponentsDirectory(getter_AddRefs(dir));
|
GetLocationFromDirectoryService(NS_XPCOM_COMPONENT_DIR, getter_AddRefs(dir));
|
||||||
if (!dir)
|
if (!dir)
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
}
|
}
|
||||||
@@ -3088,7 +3140,7 @@ nsComponentManagerImpl::AutoRegisterNonNativeComponents(nsIFile* spec)
|
|||||||
nsCOMPtr<nsIFile> directory = spec;
|
nsCOMPtr<nsIFile> directory = spec;
|
||||||
|
|
||||||
if (!directory) {
|
if (!directory) {
|
||||||
GetDefaultComponentsDirectory(getter_AddRefs(directory));
|
GetLocationFromDirectoryService(NS_XPCOM_COMPONENT_DIR, getter_AddRefs(directory));
|
||||||
if (!directory)
|
if (!directory)
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
}
|
}
|
||||||
@@ -3416,19 +3468,13 @@ nsComponentManagerImpl::HasFileChanged(nsIFile *file, const char *loaderString,
|
|||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
PRInt32 count = mAutoRegEntries.Count();
|
nsCStringKey key(registryName);
|
||||||
for (PRInt32 i = 0; i<count; i++)
|
AutoRegEntry* entry = (AutoRegEntry*)mAutoRegEntries.Get(&key);
|
||||||
{
|
if (entry)
|
||||||
AutoRegEntry* entry = (AutoRegEntry*) mAutoRegEntries.ElementAt(i);
|
*_retval = entry->Modified(&modDate);
|
||||||
NS_ASSERTION(entry, "bad entry in array");
|
else
|
||||||
|
*_retval = PR_TRUE;
|
||||||
|
|
||||||
if (!strcmp(registryName.get(), entry->GetName()))
|
|
||||||
{
|
|
||||||
// Found in our array.
|
|
||||||
*_retval = entry->Modified(&modDate);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3442,25 +3488,20 @@ nsComponentManagerImpl::SaveFileInfo(nsIFile *file, const char *loaderString, PR
|
|||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
// check to see if exists in the array before adding it so that we don't have dups.
|
// check to see if exists in the array before adding it so that we don't have dups.
|
||||||
PRInt32 count = mAutoRegEntries.Count();
|
nsCStringKey key(registryName);
|
||||||
for (PRInt32 i = 0; i<count; i++)
|
AutoRegEntry* entry = (AutoRegEntry*)mAutoRegEntries.Get(&key);
|
||||||
{
|
|
||||||
AutoRegEntry* entry = (AutoRegEntry*) mAutoRegEntries.ElementAt(i);
|
|
||||||
NS_ASSERTION(entry, "bad entry in array");
|
|
||||||
|
|
||||||
if (!strcmp(registryName.get(), entry->GetName()))
|
if (entry)
|
||||||
{
|
{
|
||||||
entry->SetDate(&modDate);
|
entry->SetDate(&modDate);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoRegEntry *entry = new AutoRegEntry(registryName, &modDate);
|
entry = new AutoRegEntry(registryName, &modDate);
|
||||||
|
|
||||||
if (!entry)
|
if (!entry)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
mAutoRegEntries.AppendElement(entry);
|
mAutoRegEntries.Put(&key, entry);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3473,22 +3514,66 @@ nsComponentManagerImpl::RemoveFileInfo(nsIFile *file, const char *loaderString)
|
|||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
PRInt32 count = mAutoRegEntries.Count();
|
nsCStringKey key(registryName);
|
||||||
for (PRInt32 i = 0; i<count; i++)
|
AutoRegEntry* entry = (AutoRegEntry*)mAutoRegEntries.Remove(&key);
|
||||||
{
|
if (entry)
|
||||||
AutoRegEntry* entry = (AutoRegEntry*) mAutoRegEntries.ElementAt(i);
|
delete entry;
|
||||||
NS_ASSERTION(entry, "bad entry in array");
|
|
||||||
|
|
||||||
if (!strcmp(registryName.get(), entry->GetName()))
|
|
||||||
{
|
|
||||||
mAutoRegEntries.RemoveElementAt(i);
|
|
||||||
delete entry;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsComponentManagerImpl::GetOptionalData(nsIFile *file,
|
||||||
|
const char *loaderString,
|
||||||
|
char **_retval)
|
||||||
|
{
|
||||||
|
nsXPIDLCString registryName;
|
||||||
|
nsresult rv = RegistryLocationForSpec(file, getter_Copies(registryName));
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
|
||||||
|
nsCStringKey key(registryName);
|
||||||
|
AutoRegEntry* entry = (AutoRegEntry*)mAutoRegEntries.Get(&key);
|
||||||
|
if (!entry) {
|
||||||
|
return NS_ERROR_NOT_INITIALIZED;
|
||||||
|
}
|
||||||
|
const char* opData = entry->GetOptionalData();
|
||||||
|
|
||||||
|
if (opData)
|
||||||
|
*_retval = ToNewCString(nsDependentCString(opData));
|
||||||
|
else
|
||||||
|
*_retval = nsnull;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsComponentManagerImpl::SetOptionalData(nsIFile *file,
|
||||||
|
const char *loaderString,
|
||||||
|
const char *data)
|
||||||
|
{
|
||||||
|
nsXPIDLCString registryName;
|
||||||
|
nsresult rv = RegistryLocationForSpec(file, getter_Copies(registryName));
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
|
||||||
|
nsCStringKey key(registryName);
|
||||||
|
AutoRegEntry* entry = (AutoRegEntry*)mAutoRegEntries.Get(&key);
|
||||||
|
|
||||||
|
if (!entry) {
|
||||||
|
PRInt64 zero = LL_Zero();
|
||||||
|
entry = new AutoRegEntry(registryName, &zero);
|
||||||
|
if (!entry)
|
||||||
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
mAutoRegEntries.Put(&key, entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
entry->SetOptionalData(data);
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsComponentManagerImpl::FlushPersistentStore(PRBool now)
|
nsComponentManagerImpl::FlushPersistentStore(PRBool now)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -73,8 +73,6 @@ class nsIServiceManager;
|
|||||||
// to service mapping and has no cid mapping.
|
// to service mapping and has no cid mapping.
|
||||||
#define NS_COMPONENT_TYPE_SERVICE_ONLY -2
|
#define NS_COMPONENT_TYPE_SERVICE_ONLY -2
|
||||||
|
|
||||||
extern const char XPCOM_LIB_PREFIX[];
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Array of Loaders and their type strings
|
// Array of Loaders and their type strings
|
||||||
@@ -96,7 +94,6 @@ class nsComponentManagerImpl
|
|||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
NS_DECL_NSIINTERFACEREQUESTOR
|
NS_DECL_NSIINTERFACEREQUESTOR
|
||||||
|
|
||||||
// Since the nsIComponentManagerObsolete and nsIComponentManager share some of the
|
// Since the nsIComponentManagerObsolete and nsIComponentManager share some of the
|
||||||
// same interface function names, we have to manually define the functions here.
|
// same interface function names, we have to manually define the functions here.
|
||||||
// The only function that is in nsIComponentManagerObsolete and is in nsIComponentManager
|
// The only function that is in nsIComponentManagerObsolete and is in nsIComponentManager
|
||||||
@@ -154,7 +151,6 @@ public:
|
|||||||
NS_GetService(const char *aContractID, const nsIID& aIID, PRBool aDontCreate, nsISupports** result);
|
NS_GetService(const char *aContractID, const nsIID& aIID, PRBool aDontCreate, nsISupports** result);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsresult RegistryNameForLib(const char *aLibName, char **aRegistryName);
|
|
||||||
nsresult RegisterComponentCommon(const nsCID &aClass,
|
nsresult RegisterComponentCommon(const nsCID &aClass,
|
||||||
const char *aClassName,
|
const char *aClassName,
|
||||||
const char *aContractID,
|
const char *aContractID,
|
||||||
@@ -209,10 +205,15 @@ protected:
|
|||||||
PRMonitor* mMon;
|
PRMonitor* mMon;
|
||||||
|
|
||||||
nsNativeComponentLoader *mNativeComponentLoader;
|
nsNativeComponentLoader *mNativeComponentLoader;
|
||||||
|
#ifdef ENABLE_STATIC_COMPONENT_LOADER
|
||||||
nsIComponentLoader *mStaticComponentLoader;
|
nsIComponentLoader *mStaticComponentLoader;
|
||||||
|
#endif
|
||||||
nsCOMPtr<nsIFile> mComponentsDir;
|
nsCOMPtr<nsIFile> mComponentsDir;
|
||||||
PRInt32 mComponentsOffset;
|
PRInt32 mComponentsOffset;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIFile> mGREComponentsDir;
|
||||||
|
PRInt32 mGREComponentsOffset;
|
||||||
|
|
||||||
// Shutdown
|
// Shutdown
|
||||||
#define NS_SHUTDOWN_NEVERHAPPENED 0
|
#define NS_SHUTDOWN_NEVERHAPPENED 0
|
||||||
#define NS_SHUTDOWN_INPROGRESS 1
|
#define NS_SHUTDOWN_INPROGRESS 1
|
||||||
@@ -224,7 +225,7 @@ protected:
|
|||||||
int mMaxNLoaderData;
|
int mMaxNLoaderData;
|
||||||
|
|
||||||
PRBool mRegistryDirty;
|
PRBool mRegistryDirty;
|
||||||
nsVoidArray mAutoRegEntries;
|
nsHashtable mAutoRegEntries;
|
||||||
nsCOMPtr<nsICategoryManager> mCategoryManager;
|
nsCOMPtr<nsICategoryManager> mCategoryManager;
|
||||||
|
|
||||||
PLArenaPool mArena;
|
PLArenaPool mArena;
|
||||||
@@ -261,24 +262,6 @@ protected:
|
|||||||
#define NS_MOZILLA_DIR_PERMISSION 00700
|
#define NS_MOZILLA_DIR_PERMISSION 00700
|
||||||
#endif /* XP_BEOS */
|
#endif /* XP_BEOS */
|
||||||
|
|
||||||
/**
|
|
||||||
* When using the registry we put a version number in it.
|
|
||||||
* If the version number that is in the registry doesn't match
|
|
||||||
* the following, we ignore the registry. This lets news versions
|
|
||||||
* of the software deal with old formats of registry and not
|
|
||||||
*
|
|
||||||
* alpha0.20 : First time we did versioning
|
|
||||||
* alpha0.30 : Changing autoreg to begin registration from ./components on unix
|
|
||||||
* alpha0.40 : repository -> component manager
|
|
||||||
* alpha0.50 : using nsIRegistry
|
|
||||||
* alpha0.60 : xpcom 2.0 landing
|
|
||||||
* alpha0.70 : using nsIFileSpec. PRTime -> PRUint32
|
|
||||||
* alpha0.90 : using nsIComponentLoader, abs:/rel:/lib:, shaver-cleanup
|
|
||||||
* alpha0.92 : restructured registry keys
|
|
||||||
* alpha0.93 : changed component names to native strings instead of UTF8
|
|
||||||
*/
|
|
||||||
#define NS_XPCOM_COMPONENT_MANAGER_VERSION_STRING "alpha0.93"
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/**
|
/**
|
||||||
* Class: nsFactoryEntry()
|
* Class: nsFactoryEntry()
|
||||||
@@ -347,7 +330,6 @@ struct nsContractIDTableEntry : public PLDHashEntryHdr {
|
|||||||
class AutoRegEntry
|
class AutoRegEntry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AutoRegEntry(){};
|
|
||||||
AutoRegEntry(const char* name, PRInt64* modDate);
|
AutoRegEntry(const char* name, PRInt64* modDate);
|
||||||
virtual ~AutoRegEntry();
|
virtual ~AutoRegEntry();
|
||||||
|
|
||||||
@@ -356,8 +338,14 @@ public:
|
|||||||
void SetDate(PRInt64 *date) { mModDate = *date;}
|
void SetDate(PRInt64 *date) { mModDate = *date;}
|
||||||
PRBool Modified(PRInt64 *date);
|
PRBool Modified(PRInt64 *date);
|
||||||
|
|
||||||
|
// this is the optional field line in the compreg.dat.
|
||||||
|
// it must not contain any comma's and it must be null terminated.
|
||||||
|
char* GetOptionalData() {return mData;};
|
||||||
|
void SetOptionalData(const char* data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
char* mName;
|
char* mName;
|
||||||
|
char* mData;
|
||||||
PRInt64 mModDate;
|
PRInt64 mModDate;
|
||||||
};
|
};
|
||||||
#endif // nsComponentManager_h__
|
#endif // nsComponentManager_h__
|
||||||
|
|||||||
@@ -49,13 +49,16 @@
|
|||||||
|
|
||||||
interface nsIFile;
|
interface nsIFile;
|
||||||
|
|
||||||
[scriptable, uuid(fce83d37-a3c0-4e09-ad9f-6842a984dbdf)]
|
[uuid(fce83d37-a3c0-4e09-ad9f-6842a984dbdf)]
|
||||||
interface nsIComponentLoaderManager : nsISupports
|
interface nsIComponentLoaderManager : nsISupports
|
||||||
{
|
{
|
||||||
boolean hasFileChanged(in nsIFile file, in string loaderString, in PRInt64 modDate);
|
boolean hasFileChanged(in nsIFile file, in string loaderString, in PRInt64 modDate);
|
||||||
void saveFileInfo(in nsIFile file, in string loaderString, in PRInt64 modDate);
|
void saveFileInfo(in nsIFile file, in string loaderString, in PRInt64 modDate);
|
||||||
void removeFileInfo(in nsIFile file, in string loaderString);
|
void removeFileInfo(in nsIFile file, in string loaderString);
|
||||||
void flushPersistentStore(in boolean now);
|
void flushPersistentStore(in boolean now);
|
||||||
|
|
||||||
|
string getOptionalData(in nsIFile file, in string loaderString);
|
||||||
|
void setOptionalData(in nsIFile file, in string loaderString, in string value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
70
xpcom/components/nsINativeComponentLoader.idl
Normal file
70
xpcom/components/nsINativeComponentLoader.idl
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Netscape Public License
|
||||||
|
* Version 1.1 (the "License"); you may not use this file except in
|
||||||
|
* compliance with the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/NPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is mozilla.org code.
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* Netscape Communications Corporation.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2003
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the NPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
#include "nsISupports.idl"
|
||||||
|
|
||||||
|
interface nsIFile;
|
||||||
|
|
||||||
|
[uuid(aa610f20-a889-11d3-8c81-000064657374)]
|
||||||
|
interface nsINativeComponentLoader : nsISupports
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* addDependentLibrary
|
||||||
|
*
|
||||||
|
* This method informs the native component loader that the
|
||||||
|
* given component library referenced by |aFile| requires
|
||||||
|
* symbols that can be found in the library named |aLibName|.
|
||||||
|
*
|
||||||
|
* The native component loader is expected to resolve these
|
||||||
|
* external symobls prior to loading the component library.
|
||||||
|
*
|
||||||
|
* @param aFile
|
||||||
|
* The native component file location that is declaring a
|
||||||
|
* a dependency. This file is expected to be a DSO/DLL.
|
||||||
|
*
|
||||||
|
* @param aLibName
|
||||||
|
* This is a name of a library that the component requires.
|
||||||
|
* This file name is found in either the GRE bin directory
|
||||||
|
* or the application's bin directory. Full file path are
|
||||||
|
* also accepted. Passing nsnull for the |aLibName| will
|
||||||
|
* clear all dependencies. Note that non null aLibName
|
||||||
|
* values are expected to be in the native charset.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void addDependentLibrary(in nsIFile aFile, in string aLibName);
|
||||||
|
};
|
||||||
@@ -76,7 +76,9 @@ nsNativeComponentLoader::~nsNativeComponentLoader()
|
|||||||
delete mDllStore;
|
delete mDllStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsNativeComponentLoader, nsIComponentLoader);
|
NS_IMPL_THREADSAFE_ISUPPORTS2(nsNativeComponentLoader,
|
||||||
|
nsIComponentLoader,
|
||||||
|
nsINativeComponentLoader);
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsNativeComponentLoader::GetFactory(const nsIID & aCID,
|
nsNativeComponentLoader::GetFactory(const nsIID & aCID,
|
||||||
@@ -128,13 +130,7 @@ nsNativeComponentLoader::GetFactory(const nsIID & aCID,
|
|||||||
return rv; // XXX translate error code?
|
return rv; // XXX translate error code?
|
||||||
|
|
||||||
rv = GetFactoryFromModule(dll, aCID, _retval);
|
rv = GetFactoryFromModule(dll, aCID, _retval);
|
||||||
#ifdef OBSOLETE_MODULE_LOADING
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
if (rv == NS_ERROR_FACTORY_NOT_LOADED) {
|
|
||||||
rv = GetFactoryFromNSGetFactory(dll, aCID, serviceMgr, _retval);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
PR_LOG(nsComponentManagerLog, PR_LOG_ERROR,
|
PR_LOG(nsComponentManagerLog, PR_LOG_ERROR,
|
||||||
("nsNativeComponentLoader: Factory creation %s for %s",
|
("nsNativeComponentLoader: Factory creation %s for %s",
|
||||||
(NS_SUCCEEDED(rv) ? "succeeded" : "FAILED"),
|
(NS_SUCCEEDED(rv) ? "succeeded" : "FAILED"),
|
||||||
@@ -276,25 +272,6 @@ nsFreeLibrary(nsDll *dll, nsIServiceManager *serviceMgr, PRInt32 when)
|
|||||||
{
|
{
|
||||||
rv = mobj->CanUnload(nsComponentManagerImpl::gComponentManager, &canUnload);
|
rv = mobj->CanUnload(nsComponentManagerImpl::gComponentManager, &canUnload);
|
||||||
}
|
}
|
||||||
#ifdef OBSOLETE_MODULE_LOADING
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Try the old method of module unloading
|
|
||||||
nsCanUnloadProc proc = (nsCanUnloadProc)dll->FindSymbol("NSCanUnload");
|
|
||||||
if (proc)
|
|
||||||
{
|
|
||||||
canUnload = proc(serviceMgr);
|
|
||||||
rv = NS_OK; // No error status returned by call.
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PR_LOG(nsComponentManagerLog, PR_LOG_ERROR,
|
|
||||||
("nsNativeComponentLoader: Unload cant get nsIModule or NSCanUnload for %s",
|
|
||||||
dll->GetDisplayPath()));
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* OBSOLETE_MODULE_LOADING */
|
|
||||||
|
|
||||||
mobj = nsnull; // Release our reference to the module object
|
mobj = nsnull; // Release our reference to the module object
|
||||||
// When shutting down, whether we can unload the dll or not,
|
// When shutting down, whether we can unload the dll or not,
|
||||||
@@ -420,21 +397,6 @@ nsNativeComponentLoader::SelfRegisterDll(nsDll *dll,
|
|||||||
}
|
}
|
||||||
mobj = NULL; // Force a release of the Module object before unload()
|
mobj = NULL; // Force a release of the Module object before unload()
|
||||||
}
|
}
|
||||||
#ifdef OBSOLETE_MODULE_LOADING
|
|
||||||
else
|
|
||||||
{
|
|
||||||
res = NS_ERROR_NO_INTERFACE;
|
|
||||||
nsRegisterProc regproc = (nsRegisterProc)dll->FindSymbol("NSRegisterSelf");
|
|
||||||
if (regproc)
|
|
||||||
{
|
|
||||||
// Call the NSRegisterSelfProc to enable dll registration
|
|
||||||
res = regproc(serviceMgr, registryLocation);
|
|
||||||
PR_LOG(nsComponentManagerLog, PR_LOG_ERROR,
|
|
||||||
("nsNativeComponentLoader: %s using OBSOLETE NSRegisterSelf()",
|
|
||||||
dll->GetDisplayPath()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* OBSOLETE_MODULE_LOADING */
|
|
||||||
|
|
||||||
// Update the timestamp and size of the dll in registry
|
// Update the timestamp and size of the dll in registry
|
||||||
// Don't enter deferred modules in the registry, because it might only be
|
// Don't enter deferred modules in the registry, because it might only be
|
||||||
@@ -579,19 +541,6 @@ nsNativeComponentLoader::SelfUnregisterDll(nsDll *dll)
|
|||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
mobj->UnregisterSelf(mCompMgr, fs, registryName);
|
mobj->UnregisterSelf(mCompMgr, fs, registryName);
|
||||||
}
|
}
|
||||||
#ifdef OBSOLETE_MODULE_LOADING
|
|
||||||
else
|
|
||||||
{
|
|
||||||
res = NS_ERROR_NO_INTERFACE;
|
|
||||||
nsUnregisterProc unregproc =
|
|
||||||
(nsUnregisterProc) dll->FindSymbol("NSUnregisterSelf");
|
|
||||||
if (unregproc)
|
|
||||||
{
|
|
||||||
// Call the NSUnregisterSelfProc to enable dll de-registration
|
|
||||||
res = unregproc(serviceMgr, dll->GetPersistentDescriptorString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* OBSOLETE_MODULE_LOADING */
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -863,7 +812,7 @@ nsNativeComponentLoader::AutoRegisterComponent(PRInt32 when,
|
|||||||
// It is ok to do this even if the creation of nsDll
|
// It is ok to do this even if the creation of nsDll
|
||||||
// didnt succeed. That way we wont do this again
|
// didnt succeed. That way we wont do this again
|
||||||
// when we encounter the same dll.
|
// when we encounter the same dll.
|
||||||
dll = new nsDll(persistentDescriptor);
|
dll = new nsDll(component, persistentDescriptor);
|
||||||
if (dll == NULL)
|
if (dll == NULL)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
mDllStore->Put(&key, (void *) dll);
|
mDllStore->Put(&key, (void *) dll);
|
||||||
@@ -999,19 +948,14 @@ nsNativeComponentLoader::CreateDll(nsIFile *aSpec,
|
|||||||
|
|
||||||
if (!aSpec)
|
if (!aSpec)
|
||||||
{
|
{
|
||||||
if (!nsCRT::strncmp(aLocation, XPCOM_LIB_PREFIX, 4)) {
|
// what I want to do here is QI for a Component Registration Manager. Since this
|
||||||
dll = new nsDll(aLocation+4, 1 /* dumb magic flag */);
|
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
||||||
if (!dll) return NS_ERROR_OUT_OF_MEMORY;
|
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(mCompMgr, &rv);
|
||||||
} else {
|
if (obsoleteManager)
|
||||||
// what I want to do here is QI for a Component Registration Manager. Since this
|
rv = obsoleteManager->SpecForRegistryLocation(aLocation,
|
||||||
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
getter_AddRefs(spec));
|
||||||
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(mCompMgr, &rv);
|
if (NS_FAILED(rv))
|
||||||
if (obsoleteManager)
|
return rv;
|
||||||
rv = obsoleteManager->SpecForRegistryLocation(aLocation,
|
|
||||||
getter_AddRefs(spec));
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1046,11 +990,35 @@ nsNativeComponentLoader::GetFactoryFromModule(nsDll *aDll, const nsCID &aCID,
|
|||||||
(void **)aFactory);
|
(void **)aFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsNativeComponentLoader::GetFactoryFromNSGetFactory(nsDll *aDll,
|
NS_IMETHODIMP
|
||||||
const nsCID &aCID,
|
nsNativeComponentLoader::AddDependentLibrary(nsIFile* aFile, const char* libName)
|
||||||
nsIServiceManager *aServMgr,
|
|
||||||
nsIFactory **aFactory)
|
|
||||||
{
|
{
|
||||||
return NS_ERROR_FACTORY_NOT_LOADED;
|
nsCOMPtr<nsIComponentLoaderManager> manager = do_QueryInterface(mCompMgr);
|
||||||
|
if (!manager)
|
||||||
|
{
|
||||||
|
NS_WARNING("Something is terribly wrong");
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// the native component loader uses the optional data
|
||||||
|
// to store a space delimited list of dependent library
|
||||||
|
// names
|
||||||
|
|
||||||
|
if (!libName)
|
||||||
|
{
|
||||||
|
manager->SetOptionalData(aFile, nsnull, nsnull);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsXPIDLCString data;
|
||||||
|
manager->GetOptionalData(aFile, nsnull, getter_Copies(data));
|
||||||
|
|
||||||
|
if (!data.IsEmpty())
|
||||||
|
data.Append(NS_LITERAL_CSTRING(" "));
|
||||||
|
|
||||||
|
data.Append(nsDependentCString(libName));
|
||||||
|
|
||||||
|
manager->SetOptionalData(aFile, nsnull, data);
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,15 +25,17 @@
|
|||||||
#include "nsHashtable.h"
|
#include "nsHashtable.h"
|
||||||
#include "nsVoidArray.h"
|
#include "nsVoidArray.h"
|
||||||
#include "xcDll.h"
|
#include "xcDll.h"
|
||||||
|
#include "nsINativeComponentLoader.h"
|
||||||
|
|
||||||
#ifndef nsNativeComponentLoader_h__
|
#ifndef nsNativeComponentLoader_h__
|
||||||
#define nsNativeComponentLoader_h__
|
#define nsNativeComponentLoader_h__
|
||||||
|
|
||||||
class nsNativeComponentLoader : public nsIComponentLoader {
|
class nsNativeComponentLoader : public nsIComponentLoader, public nsINativeComponentLoader {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
NS_DECL_NSICOMPONENTLOADER
|
NS_DECL_NSICOMPONENTLOADER
|
||||||
|
NS_DECL_NSINATIVECOMPONENTLOADER
|
||||||
|
|
||||||
nsNativeComponentLoader();
|
nsNativeComponentLoader();
|
||||||
virtual ~nsNativeComponentLoader();
|
virtual ~nsNativeComponentLoader();
|
||||||
@@ -51,11 +53,6 @@ class nsNativeComponentLoader : public nsIComponentLoader {
|
|||||||
nsresult SelfUnregisterDll(nsDll *dll);
|
nsresult SelfUnregisterDll(nsDll *dll);
|
||||||
nsresult GetFactoryFromModule(nsDll *aDll, const nsCID &aCID,
|
nsresult GetFactoryFromModule(nsDll *aDll, const nsCID &aCID,
|
||||||
nsIFactory **aFactory);
|
nsIFactory **aFactory);
|
||||||
/* obsolete! already! */
|
|
||||||
nsresult GetFactoryFromNSGetFactory(nsDll *aDlll, const nsCID &aCID,
|
|
||||||
nsIServiceManager *aServMgr,
|
|
||||||
nsIFactory **aFactory);
|
|
||||||
|
|
||||||
|
|
||||||
nsresult DumpLoadError(nsDll *dll,
|
nsresult DumpLoadError(nsDll *dll,
|
||||||
const char *aCallerName,
|
const char *aCallerName,
|
||||||
|
|||||||
@@ -49,6 +49,8 @@
|
|||||||
#include "nsIComponentLoaderManager.h"
|
#include "nsIComponentLoaderManager.h"
|
||||||
#include "nsIModule.h"
|
#include "nsIModule.h"
|
||||||
#include "nsILocalFile.h"
|
#include "nsILocalFile.h"
|
||||||
|
#include "nsDirectoryServiceDefs.h"
|
||||||
|
#include "nsDirectoryServiceUtils.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
@@ -64,92 +66,22 @@
|
|||||||
|
|
||||||
#include "nsNativeComponentLoader.h"
|
#include "nsNativeComponentLoader.h"
|
||||||
|
|
||||||
nsDll::nsDll(const char *codeDllName, int type)
|
extern nsresult NS_GetComponentLoaderManager(nsIComponentLoaderManager* *result);
|
||||||
: m_dllName(NULL),
|
|
||||||
m_instance(NULL), m_status(DLL_OK), m_moduleObject(NULL),
|
|
||||||
m_persistentDescriptor(NULL), m_nativePath(NULL),
|
|
||||||
m_markForUnload(PR_FALSE), m_registryLocation(0)
|
|
||||||
|
|
||||||
|
nsDll::nsDll(nsIFile *dllSpec,
|
||||||
|
const char *registryLocation)
|
||||||
|
:
|
||||||
|
m_dllSpec(do_QueryInterface(dllSpec)),
|
||||||
|
m_instance(NULL),
|
||||||
|
m_status(DLL_OK),
|
||||||
|
m_moduleObject(NULL),
|
||||||
|
m_markForUnload(PR_FALSE)
|
||||||
{
|
{
|
||||||
if (!codeDllName || !*codeDllName)
|
NS_ASSERTION(registryLocation, "registryLocation is null");
|
||||||
{
|
|
||||||
m_status = DLL_INVALID_PARAM;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
m_dllName = nsCRT::strdup(codeDllName);
|
|
||||||
if (!m_dllName)
|
|
||||||
{
|
|
||||||
m_status = DLL_NO_MEM;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nsDll::nsDll(nsIFile *dllSpec, const char *registryLocation)
|
|
||||||
: m_dllName(NULL),
|
|
||||||
m_instance(NULL), m_status(DLL_OK), m_moduleObject(NULL),
|
|
||||||
m_persistentDescriptor(NULL), m_nativePath(NULL), m_markForUnload(PR_FALSE)
|
|
||||||
|
|
||||||
{
|
|
||||||
m_dllSpec = dllSpec;
|
|
||||||
|
|
||||||
m_registryLocation = nsCRT::strdup(registryLocation);
|
m_registryLocation = nsCRT::strdup(registryLocation);
|
||||||
Init(dllSpec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsDll::nsDll(const char *libPersistentDescriptor)
|
|
||||||
: m_dllName(NULL),
|
|
||||||
m_instance(NULL), m_status(DLL_OK), m_moduleObject(NULL),
|
|
||||||
m_persistentDescriptor(NULL), m_nativePath(NULL),
|
|
||||||
m_markForUnload(PR_FALSE), m_registryLocation(0)
|
|
||||||
|
|
||||||
{
|
|
||||||
Init(libPersistentDescriptor);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDll::Init(nsIFile *dllSpec)
|
|
||||||
{
|
|
||||||
// Load will fail anyway. So dont bother to stat the file
|
|
||||||
|
|
||||||
m_dllSpec = do_QueryInterface(dllSpec);
|
|
||||||
m_status = DLL_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDll::Init(const char *libPersistentDescriptor)
|
|
||||||
{
|
|
||||||
nsresult rv;
|
|
||||||
|
|
||||||
if (libPersistentDescriptor == NULL)
|
|
||||||
{
|
|
||||||
m_status = DLL_INVALID_PARAM;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a FileSpec from the persistentDescriptor
|
|
||||||
nsCOMPtr<nsILocalFile> dllSpec;
|
|
||||||
|
|
||||||
nsCID clsid;
|
|
||||||
nsComponentManager::ContractIDToClassID(NS_LOCAL_FILE_CONTRACTID, &clsid);
|
|
||||||
rv = nsComponentManager::CreateInstance(clsid, nsnull,
|
|
||||||
NS_GET_IID(nsILocalFile),
|
|
||||||
(void**)getter_AddRefs(dllSpec));
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
{
|
|
||||||
m_status = DLL_INVALID_PARAM;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
rv = dllSpec->InitWithNativePath(nsDependentCString(libPersistentDescriptor));
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
{
|
|
||||||
m_status = DLL_INVALID_PARAM;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
nsDll::~nsDll(void)
|
nsDll::~nsDll(void)
|
||||||
{
|
{
|
||||||
#if DEBUG_dougt
|
#if DEBUG_dougt
|
||||||
@@ -161,43 +93,21 @@ nsDll::~nsDll(void)
|
|||||||
// Hence turn it back on after all the above have been removed.
|
// Hence turn it back on after all the above have been removed.
|
||||||
Unload();
|
Unload();
|
||||||
#endif
|
#endif
|
||||||
if (m_dllName)
|
|
||||||
nsCRT::free(m_dllName);
|
|
||||||
if (m_registryLocation)
|
if (m_registryLocation)
|
||||||
nsCRT::free(m_registryLocation);
|
nsCRT::free(m_registryLocation);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
nsDll::GetDisplayPath()
|
nsDll::GetDisplayPath()
|
||||||
{
|
{
|
||||||
if (m_dllName)
|
if (m_registryLocation)
|
||||||
return m_dllName;
|
return m_registryLocation;
|
||||||
if (!m_nativePath.IsEmpty())
|
return "unknown!";
|
||||||
return m_nativePath.get();
|
|
||||||
m_dllSpec->GetNativePath(m_nativePath);
|
|
||||||
return m_nativePath.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *
|
|
||||||
nsDll::GetPersistentDescriptorString()
|
|
||||||
{
|
|
||||||
if (m_dllName)
|
|
||||||
return m_dllName;
|
|
||||||
if (!m_persistentDescriptor.IsEmpty())
|
|
||||||
return m_persistentDescriptor.get();
|
|
||||||
m_dllSpec->GetNativePath(m_persistentDescriptor);
|
|
||||||
return m_persistentDescriptor.get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
nsDll::HasChanged()
|
nsDll::HasChanged()
|
||||||
{
|
{
|
||||||
if (m_dllName)
|
|
||||||
return PR_FALSE;
|
|
||||||
|
|
||||||
extern nsresult NS_GetComponentLoaderManager(nsIComponentLoaderManager* *result);
|
|
||||||
nsCOMPtr<nsIComponentLoaderManager> manager;
|
nsCOMPtr<nsIComponentLoaderManager> manager;
|
||||||
NS_GetComponentLoaderManager(getter_AddRefs(manager));
|
NS_GetComponentLoaderManager(getter_AddRefs(manager));
|
||||||
if (!manager)
|
if (!manager)
|
||||||
@@ -206,6 +116,8 @@ nsDll::HasChanged()
|
|||||||
// If mod date has changed, then dll has changed
|
// If mod date has changed, then dll has changed
|
||||||
PRInt64 currentDate;
|
PRInt64 currentDate;
|
||||||
nsresult rv = m_dllSpec->GetLastModifiedTime(¤tDate);
|
nsresult rv = m_dllSpec->GetLastModifiedTime(¤tDate);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return PR_TRUE;
|
||||||
PRBool changed = PR_TRUE;
|
PRBool changed = PR_TRUE;
|
||||||
manager->HasFileChanged(m_dllSpec, nsnull, currentDate, &changed);
|
manager->HasFileChanged(m_dllSpec, nsnull, currentDate, &changed);
|
||||||
return changed;
|
return changed;
|
||||||
@@ -228,10 +140,107 @@ PRBool nsDll::Load(void)
|
|||||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||||
nsTraceRefcnt::SetActivityIsLegal(PR_FALSE);
|
nsTraceRefcnt::SetActivityIsLegal(PR_FALSE);
|
||||||
#endif
|
#endif
|
||||||
nsCOMPtr<nsILocalFile> lf(do_QueryInterface(m_dllSpec));
|
|
||||||
NS_ASSERTION(lf, "nsIFile here must implement a nsILocalFile");
|
|
||||||
lf->Load(&m_instance);
|
|
||||||
|
|
||||||
|
// Load any library dependencies
|
||||||
|
// The Component Loader Manager may hold onto some extra data
|
||||||
|
// set by either the native component loader or the native
|
||||||
|
// component. We assume that this data is a space delimited
|
||||||
|
// listing of dependent libraries which are required to be
|
||||||
|
// loaded prior to us loading the given component. Once, the
|
||||||
|
// component is loaded into memory, we can release our hold
|
||||||
|
// on the dependent libraries with the assumption that the
|
||||||
|
// component library holds a reference via the OS so loader.
|
||||||
|
|
||||||
|
nsCOMPtr<nsIComponentLoaderManager> manager;
|
||||||
|
NS_GetComponentLoaderManager(getter_AddRefs(manager));
|
||||||
|
if (!manager)
|
||||||
|
return PR_TRUE;
|
||||||
|
|
||||||
|
nsXPIDLCString extraData;
|
||||||
|
manager->GetOptionalData(m_dllSpec, m_registryLocation, getter_Copies(extraData));
|
||||||
|
|
||||||
|
nsVoidArray dependentLibArray;
|
||||||
|
|
||||||
|
// if there was any extra data, treat it as a listing of dependent libs
|
||||||
|
if (extraData != nsnull)
|
||||||
|
{
|
||||||
|
|
||||||
|
// all dependent libraries are suppose to be in the "gre" directory.
|
||||||
|
// note that the gre directory is the same as the "bin" directory,
|
||||||
|
// when there isn't a real "gre" found.
|
||||||
|
|
||||||
|
nsXPIDLCString path;
|
||||||
|
nsCOMPtr<nsIFile> file;
|
||||||
|
NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(file));
|
||||||
|
|
||||||
|
if (!file)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
// we are talking about a file in the GRE dir. Lets append something
|
||||||
|
// stupid right now, so that later we can just set the leaf name.
|
||||||
|
file->AppendNative(NS_LITERAL_CSTRING("dummy"));
|
||||||
|
|
||||||
|
char *buffer = strdup(extraData);
|
||||||
|
if (!buffer)
|
||||||
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
char* newStr;
|
||||||
|
char *token = nsCRT::strtok(buffer, " ", &newStr);
|
||||||
|
while (token!=nsnull)
|
||||||
|
{
|
||||||
|
nsXPIDLCString libpath;
|
||||||
|
file->SetNativeLeafName(nsDependentCString(token));
|
||||||
|
file->GetNativePath(path);
|
||||||
|
if (!path)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
// Load this dependent library with the global flag and stash
|
||||||
|
// the result for later so that we can unload it.
|
||||||
|
PRLibSpec libSpec;
|
||||||
|
libSpec.type = PR_LibSpec_Pathname;
|
||||||
|
|
||||||
|
// if the depend library path starts with a / we are
|
||||||
|
// going to assume that it is a full path and should
|
||||||
|
// be loaded without prepending the gre diretory
|
||||||
|
// location. We could have short circuited the
|
||||||
|
// SetNativeLeafName above, but this is clearer and
|
||||||
|
// the common case is a relative path.
|
||||||
|
|
||||||
|
if (token[0] == '/')
|
||||||
|
libSpec.value.pathname = token;
|
||||||
|
else
|
||||||
|
libSpec.value.pathname = path;
|
||||||
|
|
||||||
|
PRLibrary* lib = PR_LoadLibraryWithFlags(libSpec, PR_LD_LAZY|PR_LD_GLOBAL);
|
||||||
|
// if we couldn't load the dependent library. We did the best we
|
||||||
|
// can. Now just let us fail later if this really was a required
|
||||||
|
// dependency.
|
||||||
|
if (lib)
|
||||||
|
dependentLibArray.AppendElement((void*)lib);
|
||||||
|
|
||||||
|
token = nsCRT::strtok(newStr, " ", &newStr);
|
||||||
|
}
|
||||||
|
free(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
// load the component
|
||||||
|
|
||||||
|
nsCOMPtr<nsILocalFile> lf(do_QueryInterface(m_dllSpec));
|
||||||
|
NS_ASSERTION(lf, "nsIFile here must implement a nsILocalFile");
|
||||||
|
lf->Load(&m_instance);
|
||||||
|
|
||||||
|
|
||||||
|
// Unload any of library dependencies we loaded earlier. The assumption
|
||||||
|
// here is that the component will have a "internal" reference count to
|
||||||
|
// the dependency library we just loaded.
|
||||||
|
// XXX should we unload later - or even at all?
|
||||||
|
|
||||||
|
if (extraData != nsnull)
|
||||||
|
{
|
||||||
|
PRInt32 arrayCount = dependentLibArray.Count();
|
||||||
|
for (PRInt32 index = 0; index < arrayCount; index++)
|
||||||
|
PR_UnloadLibrary((PRLibrary*)dependentLibArray.ElementAt(index));
|
||||||
|
}
|
||||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||||
nsTraceRefcnt::SetActivityIsLegal(PR_TRUE);
|
nsTraceRefcnt::SetActivityIsLegal(PR_TRUE);
|
||||||
if (m_instance) {
|
if (m_instance) {
|
||||||
@@ -243,28 +252,8 @@ PRBool nsDll::Load(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (m_dllName)
|
|
||||||
{
|
|
||||||
// if there is not an nsIFile, but there is a dll name, just try to load that..
|
|
||||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
|
||||||
nsTraceRefcnt::SetActivityIsLegal(PR_FALSE);
|
|
||||||
#endif
|
|
||||||
NS_TIMELINE_START_TIMER("PR_LoadLibrary");
|
|
||||||
m_instance = PR_LoadLibrary(m_dllName);
|
|
||||||
NS_TIMELINE_STOP_TIMER("PR_LoadLibrary");
|
|
||||||
NS_TIMELINE_MARK_TIMER("PR_LoadLibrary");
|
|
||||||
|
|
||||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
#ifdef SHOULD_IMPLEMENT_BREAKAFTERLOAD
|
||||||
nsTraceRefcnt::SetActivityIsLegal(PR_TRUE);
|
|
||||||
if (m_instance) {
|
|
||||||
// Inform refcnt tracer of new library so that calls through the
|
|
||||||
// new library can be traced.
|
|
||||||
nsTraceRefcnt::LoadLibrarySymbols(m_dllName, m_instance);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(DEBUG) && defined(XP_UNIX)
|
|
||||||
// Debugging help for components. Component dlls need to have their
|
// Debugging help for components. Component dlls need to have their
|
||||||
// symbols loaded before we can put a breakpoint in the debugger.
|
// symbols loaded before we can put a breakpoint in the debugger.
|
||||||
// This will help figureing out the point when the dll was loaded.
|
// This will help figureing out the point when the dll was loaded.
|
||||||
@@ -342,11 +331,10 @@ nsresult nsDll::GetModule(nsISupports *servMgr, nsIModule **cobj)
|
|||||||
// If not already loaded, load it now.
|
// If not already loaded, load it now.
|
||||||
if (Load() != PR_TRUE) return NS_ERROR_FAILURE;
|
if (Load() != PR_TRUE) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
// We need a nsIFile for location. If we dont
|
// We need a nsIFile for location
|
||||||
// have one, create one.
|
if (!m_dllSpec)
|
||||||
if (!m_dllSpec && m_dllName)
|
|
||||||
{
|
{
|
||||||
// Create m_dllSpec from m_dllName
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsGetModuleProc proc =
|
nsGetModuleProc proc =
|
||||||
@@ -364,9 +352,6 @@ nsresult nsDll::GetModule(nsISupports *servMgr, nsIModule **cobj)
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(DEBUG) && !defined(XP_BEOS)
|
|
||||||
#define SHOULD_IMPLEMENT_BREAKAFTERLOAD
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// These are used by BreakAfterLoad, below.
|
// These are used by BreakAfterLoad, below.
|
||||||
#ifdef SHOULD_IMPLEMENT_BREAKAFTERLOAD
|
#ifdef SHOULD_IMPLEMENT_BREAKAFTERLOAD
|
||||||
@@ -394,10 +379,9 @@ nsresult nsDll::Shutdown(void)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#ifdef SHOULD_IMPLEMENT_BREAKAFTERLOAD
|
||||||
void nsDll::BreakAfterLoad(const char *nsprPath)
|
void nsDll::BreakAfterLoad(const char *nsprPath)
|
||||||
{
|
{
|
||||||
#ifdef SHOULD_IMPLEMENT_BREAKAFTERLOAD
|
|
||||||
static PRBool firstTime = PR_TRUE;
|
static PRBool firstTime = PR_TRUE;
|
||||||
|
|
||||||
// return if invalid input
|
// return if invalid input
|
||||||
@@ -444,6 +428,6 @@ void nsDll::BreakAfterLoad(const char *nsprPath)
|
|||||||
raise(SIGTRAP);
|
raise(SIGTRAP);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* SHOULD_IMPLEMENT_BREAKAFTERLOAD */
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif /* SHOULD_IMPLEMENT_BREAKAFTERLOAD */
|
||||||
|
|||||||
@@ -53,6 +53,10 @@
|
|||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
|
|
||||||
|
#if defined(DEBUG) && !defined(XP_BEOS)
|
||||||
|
#define SHOULD_IMPLEMENT_BREAKAFTERLOAD
|
||||||
|
#endif
|
||||||
|
|
||||||
class nsIModule;
|
class nsIModule;
|
||||||
class nsIServiceManager;
|
class nsIServiceManager;
|
||||||
|
|
||||||
@@ -68,32 +72,25 @@ typedef enum nsDllStatus
|
|||||||
class nsDll
|
class nsDll
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
char *m_dllName; // Stores the dllName to load.
|
nsCOMPtr<nsIFile> m_dllSpec;
|
||||||
|
|
||||||
nsCOMPtr<nsIFile> m_dllSpec; // Filespec representing the component
|
|
||||||
|
|
||||||
PRLibrary *m_instance; // Load instance
|
|
||||||
nsDllStatus m_status; // holds current status
|
|
||||||
nsIModule *m_moduleObject;
|
|
||||||
|
|
||||||
// Cache frequent queries
|
|
||||||
nsCString m_persistentDescriptor;
|
|
||||||
nsCString m_nativePath;
|
|
||||||
|
|
||||||
PRBool m_markForUnload;
|
|
||||||
char *m_registryLocation;
|
char *m_registryLocation;
|
||||||
|
|
||||||
|
PRLibrary *m_instance; // Load instance
|
||||||
|
nsDllStatus m_status; // holds current status
|
||||||
|
nsIModule *m_moduleObject;
|
||||||
|
|
||||||
|
PRBool m_markForUnload;
|
||||||
|
|
||||||
|
|
||||||
void Init(nsIFile *dllSpec);
|
void Init(nsIFile *dllSpec);
|
||||||
void Init(const char *persistentDescriptor);
|
|
||||||
|
|
||||||
|
#ifdef SHOULD_IMPLEMENT_BREAKAFTERLOAD
|
||||||
void BreakAfterLoad(const char *nsprPath);
|
void BreakAfterLoad(const char *nsprPath);
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
nsDll(nsIFile *dllSpec, const char *registryLocation);
|
nsDll(nsIFile *dllSpec, const char *registryLocation);
|
||||||
nsDll(const char *persistentDescriptor);
|
|
||||||
nsDll(const char *dll, int type /* dummy */);
|
|
||||||
|
|
||||||
~nsDll(void);
|
~nsDll(void);
|
||||||
|
|
||||||
// Status checking on operations completed
|
// Status checking on operations completed
|
||||||
@@ -119,10 +116,10 @@ public:
|
|||||||
|
|
||||||
// WARNING: DONT FREE string returned.
|
// WARNING: DONT FREE string returned.
|
||||||
const char *GetDisplayPath(void);
|
const char *GetDisplayPath(void);
|
||||||
// WARNING: DONT FREE string returned.
|
|
||||||
const char *GetPersistentDescriptorString(void);
|
|
||||||
// WARNING: DONT FREE string returned.
|
// WARNING: DONT FREE string returned.
|
||||||
const char *GetRegistryLocation(void) { return m_registryLocation; }
|
const char *GetRegistryLocation(void) { return m_registryLocation; }
|
||||||
|
|
||||||
PRLibrary *GetInstance(void) { return (m_instance); }
|
PRLibrary *GetInstance(void) { return (m_instance); }
|
||||||
|
|
||||||
// NS_RELEASE() is required to be done on objects returned
|
// NS_RELEASE() is required to be done on objects returned
|
||||||
|
|||||||
@@ -52,6 +52,9 @@
|
|||||||
#include "nsDirectoryServiceDefs.h"
|
#include "nsDirectoryServiceDefs.h"
|
||||||
#include "nsDirectoryService.h"
|
#include "nsDirectoryService.h"
|
||||||
#include "nsEmbedString.h"
|
#include "nsEmbedString.h"
|
||||||
|
#else
|
||||||
|
#include "nsIInterfaceRequestorUtils.h"
|
||||||
|
#include "nsINativeComponentLoader.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nsGenericFactory::nsGenericFactory(const nsModuleComponentInfo *info)
|
nsGenericFactory::nsGenericFactory(const nsModuleComponentInfo *info)
|
||||||
@@ -224,14 +227,16 @@ NS_NewGenericFactory(nsIGenericFactory* *result,
|
|||||||
nsGenericModule::nsGenericModule(const char* moduleName, PRUint32 componentCount,
|
nsGenericModule::nsGenericModule(const char* moduleName, PRUint32 componentCount,
|
||||||
const nsModuleComponentInfo* components,
|
const nsModuleComponentInfo* components,
|
||||||
nsModuleConstructorProc ctor,
|
nsModuleConstructorProc ctor,
|
||||||
nsModuleDestructorProc dtor)
|
nsModuleDestructorProc dtor,
|
||||||
|
const char** aLibDepends)
|
||||||
: mInitialized(PR_FALSE),
|
: mInitialized(PR_FALSE),
|
||||||
mModuleName(moduleName),
|
mModuleName(moduleName),
|
||||||
mComponentCount(componentCount),
|
mComponentCount(componentCount),
|
||||||
mComponents(components),
|
mComponents(components),
|
||||||
mFactoriesNotToBeRegistered(nsnull),
|
mFactoriesNotToBeRegistered(nsnull),
|
||||||
mCtor(ctor),
|
mCtor(ctor),
|
||||||
mDtor(dtor)
|
mDtor(dtor),
|
||||||
|
mLibraryDependencies(aLibDepends)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,6 +465,25 @@ nsGenericModule::RegisterSelf(nsIComponentManager *aCompMgr,
|
|||||||
cp++;
|
cp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef XPCOM_GLUE
|
||||||
|
// We want to tell the component loader of any dependencies
|
||||||
|
// we have so that the loader can resolve them for us.
|
||||||
|
|
||||||
|
nsCOMPtr<nsINativeComponentLoader> loader = do_GetInterface(aCompMgr);
|
||||||
|
if (loader && mLibraryDependencies)
|
||||||
|
{
|
||||||
|
for(int i=0; mLibraryDependencies[i] != nsnull &&
|
||||||
|
mLibraryDependencies[i][0] != '\0'; i++)
|
||||||
|
{
|
||||||
|
loader->AddDependentLibrary(aPath,
|
||||||
|
mLibraryDependencies[i]);
|
||||||
|
}
|
||||||
|
loader = nsnull;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -514,7 +538,7 @@ NS_NewGenericModule2(nsModuleInfo* info, nsIModule* *result)
|
|||||||
// Create and initialize the module instance
|
// Create and initialize the module instance
|
||||||
nsGenericModule *m =
|
nsGenericModule *m =
|
||||||
new nsGenericModule(info->mModuleName, info->mCount, info->mComponents,
|
new nsGenericModule(info->mModuleName, info->mCount, info->mComponents,
|
||||||
info->mCtor, info->mDtor);
|
info->mCtor, info->mDtor, info->mLibraryDependencies);
|
||||||
|
|
||||||
if (!m)
|
if (!m)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
@@ -543,6 +567,7 @@ NS_NewGenericModule(const char* moduleName,
|
|||||||
info.mComponents = components;
|
info.mComponents = components;
|
||||||
info.mCount = componentCount;
|
info.mCount = componentCount;
|
||||||
info.mDtor = dtor;
|
info.mDtor = dtor;
|
||||||
|
info.mLibraryDependencies = nsnull;
|
||||||
|
|
||||||
return NS_NewGenericModule2(&info, result);
|
return NS_NewGenericModule2(&info, result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,8 @@ public:
|
|||||||
PRUint32 componentCount,
|
PRUint32 componentCount,
|
||||||
const nsModuleComponentInfo* components,
|
const nsModuleComponentInfo* components,
|
||||||
nsModuleConstructorProc ctor,
|
nsModuleConstructorProc ctor,
|
||||||
nsModuleDestructorProc dtor);
|
nsModuleDestructorProc dtor,
|
||||||
|
const char** alibDepends);
|
||||||
|
|
||||||
virtual ~nsGenericModule();
|
virtual ~nsGenericModule();
|
||||||
|
|
||||||
@@ -118,6 +119,7 @@ protected:
|
|||||||
FactoryNode* mFactoriesNotToBeRegistered;
|
FactoryNode* mFactoriesNotToBeRegistered;
|
||||||
nsModuleConstructorProc mCtor;
|
nsModuleConstructorProc mCtor;
|
||||||
nsModuleDestructorProc mDtor;
|
nsModuleDestructorProc mDtor;
|
||||||
|
const char** mLibraryDependencies;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* nsGenericFactory_h___ */
|
#endif /* nsGenericFactory_h___ */
|
||||||
|
|||||||
@@ -277,6 +277,8 @@ typedef void (PR_CALLBACK *nsModuleDestructorProc) (nsIModule *self);
|
|||||||
* @param mCount : Count of mComponents
|
* @param mCount : Count of mComponents
|
||||||
* @param mCtor : Module user defined constructor
|
* @param mCtor : Module user defined constructor
|
||||||
* @param mDtor : Module user defined destructor
|
* @param mDtor : Module user defined destructor
|
||||||
|
* @param mLibraryDependencies : array of library which this module is
|
||||||
|
* dependent on.
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -287,6 +289,7 @@ struct nsModuleInfo {
|
|||||||
PRUint32 mCount;
|
PRUint32 mCount;
|
||||||
nsModuleConstructorProc mCtor;
|
nsModuleConstructorProc mCtor;
|
||||||
nsModuleDestructorProc mDtor;
|
nsModuleDestructorProc mDtor;
|
||||||
|
const char** mLibraryDependencies;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -294,7 +297,7 @@ struct nsModuleInfo {
|
|||||||
* binary compatibility. (Ostensibly fix NS_NewGenericModule2() to deal
|
* binary compatibility. (Ostensibly fix NS_NewGenericModule2() to deal
|
||||||
* with older rev's at the same time.)
|
* with older rev's at the same time.)
|
||||||
*/
|
*/
|
||||||
#define NS_MODULEINFO_VERSION 0x00010000UL // 1.0
|
#define NS_MODULEINFO_VERSION 0x00015000UL // 1.5
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new generic module. Use the NS_IMPL_NSGETMODULE macro, or
|
* Create a new generic module. Use the NS_IMPL_NSGETMODULE macro, or
|
||||||
@@ -350,7 +353,8 @@ nsModuleInfo NSMODULEINFO(_name) = { \
|
|||||||
(_components), \
|
(_components), \
|
||||||
(sizeof(_components) / sizeof(_components[0])), \
|
(sizeof(_components) / sizeof(_components[0])), \
|
||||||
(_ctor), \
|
(_ctor), \
|
||||||
(_dtor) \
|
(_dtor), \
|
||||||
|
(nsnull) \
|
||||||
}; \
|
}; \
|
||||||
NSGETMODULE_ENTRY_POINT(NSMODULEINFO(_name))
|
NSGETMODULE_ENTRY_POINT(NSMODULEINFO(_name))
|
||||||
|
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ PRBool xptiManifest::Write(xptiInterfaceInfoManager* aMgr,
|
|||||||
PRUint32 size32;
|
PRUint32 size32;
|
||||||
PRIntn interfaceCount = 0;
|
PRIntn interfaceCount = 0;
|
||||||
nsCAutoString appDirString;
|
nsCAutoString appDirString;
|
||||||
|
nsCOMPtr<nsIFile> greDirectory;
|
||||||
|
|
||||||
nsCOMPtr<nsILocalFile> tempFile;
|
nsCOMPtr<nsILocalFile> tempFile;
|
||||||
if(!aMgr->GetCloneOfManifestDir(getter_AddRefs(tempFile)) || !tempFile)
|
if(!aMgr->GetCloneOfManifestDir(getter_AddRefs(tempFile)) || !tempFile)
|
||||||
@@ -177,6 +178,8 @@ PRBool xptiManifest::Write(xptiInterfaceInfoManager* aMgr,
|
|||||||
(int) aWorkingSet->GetDirectoryCount()))
|
(int) aWorkingSet->GetDirectoryCount()))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
NS_GetSpecialDirectory(NS_GRE_COMPONENT_DIR, getter_AddRefs(greDirectory));
|
||||||
|
|
||||||
for(i = 0; i < aWorkingSet->GetDirectoryCount(); i++)
|
for(i = 0; i < aWorkingSet->GetDirectoryCount(); i++)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsILocalFile> dir;
|
nsCOMPtr<nsILocalFile> dir;
|
||||||
@@ -186,9 +189,19 @@ PRBool xptiManifest::Write(xptiInterfaceInfoManager* aMgr,
|
|||||||
if(!dir)
|
if(!dir)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
dir->GetPersistentDescriptor(str);
|
PRBool isGREDir = PR_FALSE;
|
||||||
if(str.IsEmpty())
|
if (greDirectory)
|
||||||
goto out;
|
dir->Equals(greDirectory, &isGREDir);
|
||||||
|
|
||||||
|
if (isGREDir) {
|
||||||
|
str = "gre";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dir->GetPersistentDescriptor(str);
|
||||||
|
if(str.IsEmpty())
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if(!PR_fprintf(fd, "%d,%s\n", (int) i, str.get()))
|
if(!PR_fprintf(fd, "%d,%s\n", (int) i, str.get()))
|
||||||
goto out;
|
goto out;
|
||||||
@@ -491,6 +504,8 @@ PRBool xptiManifest::Read(xptiInterfaceInfoManager* aMgr,
|
|||||||
|
|
||||||
for(i = 0; i < dirCount; ++i)
|
for(i = 0; i < dirCount; ++i)
|
||||||
{
|
{
|
||||||
|
nsCAutoString str;
|
||||||
|
|
||||||
if(!reader.NextLine())
|
if(!reader.NextLine())
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
@@ -502,8 +517,23 @@ PRBool xptiManifest::Read(xptiInterfaceInfoManager* aMgr,
|
|||||||
if(i != atoi(values[0]))
|
if(i != atoi(values[0]))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
if (strcmp(values[1], "gre"))
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsIFile> greDirectory;
|
||||||
|
NS_GetSpecialDirectory(NS_GRE_COMPONENT_DIR, getter_AddRefs(greDirectory));
|
||||||
|
nsCOMPtr<nsILocalFile> lFile = do_QueryInterface(greDirectory);
|
||||||
|
if (!lFile)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
lFile->GetPersistentDescriptor(str);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
str = values[1];
|
||||||
|
}
|
||||||
|
|
||||||
// directoryname
|
// directoryname
|
||||||
if(!aWorkingSet->DirectoryAtMatchesPersistentDescriptor(i, values[1]))
|
if(!aWorkingSet->DirectoryAtMatchesPersistentDescriptor(i, str.get()))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -116,9 +116,7 @@ STACKWALK_CPPSRCS := $(addprefix $(topsrcdir)/xpcom/base/, $(STACKWALK_SRC_LCSRC
|
|||||||
CPPSRCS += nsSigHandlers.cpp nsStackFrameUnix.cpp
|
CPPSRCS += nsSigHandlers.cpp nsStackFrameUnix.cpp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LIBS = $(EXTRA_DSO_LDOPTS) \
|
LIBS = $(NULL)
|
||||||
$(EXTRA_DSO_LIBS) \
|
|
||||||
$(NULL)
|
|
||||||
|
|
||||||
|
|
||||||
ifndef BUILD_STATIC_LIBS
|
ifndef BUILD_STATIC_LIBS
|
||||||
@@ -157,7 +155,6 @@ LIBS += $(XPCOM_LIBS)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
LIBS += \
|
LIBS += \
|
||||||
$(MOZ_JS_LIBS) \
|
|
||||||
$(NSPR_LIBS) \
|
$(NSPR_LIBS) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user