зеркало из https://github.com/mozilla/pjs.git
teach component manager that there are non-native entries in the registry
This commit is contained in:
Родитель
960b56bd46
Коммит
df50cccf6f
|
@ -777,10 +777,18 @@ nsresult nsComponentManagerImpl::PlatformPrePopulateRegistry()
|
||||||
nsCID aClass;
|
nsCID aClass;
|
||||||
if (!(aClass.Parse(cidString))) continue;
|
if (!(aClass.Parse(cidString))) continue;
|
||||||
|
|
||||||
|
char *componentType;
|
||||||
|
if (NS_FAILED(mRegistry->GetString(cidKey, componentTypeValueName,
|
||||||
|
&componentType)))
|
||||||
|
continue;
|
||||||
|
|
||||||
nsFactoryEntry* entry =
|
nsFactoryEntry* entry =
|
||||||
new nsFactoryEntry(aClass, PL_strdup(library),
|
new nsFactoryEntry(aClass, PL_strdup(library),
|
||||||
PL_strdup(nativeComponentType),
|
/* hand off */
|
||||||
mNativeComponentLoader);
|
componentType,
|
||||||
|
nsCRT::strcmp(componentType,
|
||||||
|
nativeComponentType) ?
|
||||||
|
0 : mNativeComponentLoader);
|
||||||
if (!entry)
|
if (!entry)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -962,7 +970,8 @@ nsComponentManagerImpl::LoadFactory(nsFactoryEntry *aEntry,
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
*aFactory = NULL;
|
*aFactory = NULL;
|
||||||
|
|
||||||
nsresult rv = aEntry->GetFactory(aFactory);
|
nsresult rv;
|
||||||
|
rv = aEntry->GetFactory(aFactory, this);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
PR_LOG(nsComponentManagerLog, PR_LOG_ERROR,
|
PR_LOG(nsComponentManagerLog, PR_LOG_ERROR,
|
||||||
("nsComponentManager: failed to load factory from %s (%s)\n",
|
("nsComponentManager: failed to load factory from %s (%s)\n",
|
||||||
|
@ -1034,7 +1043,7 @@ nsComponentManagerImpl::FindFactory(const nsCID &aClass,
|
||||||
if (!entry)
|
if (!entry)
|
||||||
return NS_ERROR_FACTORY_NOT_REGISTERED;
|
return NS_ERROR_FACTORY_NOT_REGISTERED;
|
||||||
|
|
||||||
return entry->GetFactory(aFactory);
|
return entry->GetFactory(aFactory, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,10 +40,6 @@ class nsIServiceManager;
|
||||||
// here rather than in nsIRegistry.h
|
// here rather than in nsIRegistry.h
|
||||||
extern "C" NS_EXPORT nsresult NS_RegistryGetFactory(nsIFactory** aFactory);
|
extern "C" NS_EXPORT nsresult NS_RegistryGetFactory(nsIFactory** aFactory);
|
||||||
|
|
||||||
extern const char xpcomBaseName[];
|
|
||||||
extern const char xpcomKeyName[];
|
|
||||||
extern const char lastModValueName[];
|
|
||||||
extern const char fileSizeValueName[];
|
|
||||||
extern const char XPCOM_LIB_PREFIX[];
|
extern const char XPCOM_LIB_PREFIX[];
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -61,6 +57,7 @@ public:
|
||||||
nsresult Init(void);
|
nsresult Init(void);
|
||||||
nsresult PlatformPrePopulateRegistry();
|
nsresult PlatformPrePopulateRegistry();
|
||||||
|
|
||||||
|
friend class nsFactoryEntry;
|
||||||
protected:
|
protected:
|
||||||
nsresult RegistryNameForLib(const char *aLibName, char **aRegistryName);
|
nsresult RegistryNameForLib(const char *aLibName, char **aRegistryName);
|
||||||
nsresult RegisterComponentCommon(const nsCID &aClass,
|
nsresult RegisterComponentCommon(const nsCID &aClass,
|
||||||
|
@ -178,13 +175,21 @@ public:
|
||||||
nsFactoryEntry(const nsCID &aClass, nsIFactory *aFactory);
|
nsFactoryEntry(const nsCID &aClass, nsIFactory *aFactory);
|
||||||
~nsFactoryEntry();
|
~nsFactoryEntry();
|
||||||
|
|
||||||
nsresult GetFactory(nsIFactory **aFactory) {
|
nsresult GetFactory(nsIFactory **aFactory,
|
||||||
|
nsComponentManagerImpl * mgr) {
|
||||||
if (factory) {
|
if (factory) {
|
||||||
*aFactory = factory.get();
|
*aFactory = factory.get();
|
||||||
NS_ADDREF(*aFactory);
|
NS_ADDREF(*aFactory);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
nsresult rv = loader->GetFactory(cid, location, type, aFactory);
|
|
||||||
|
nsresult rv;
|
||||||
|
if (!loader.get()) {
|
||||||
|
rv = mgr->GetLoaderForType(type, getter_AddRefs(loader));
|
||||||
|
if(NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
rv = loader->GetFactory(cid, location, type, aFactory);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
factory = do_QueryInterface(*aFactory);
|
factory = do_QueryInterface(*aFactory);
|
||||||
return rv;
|
return rv;
|
||||||
|
|
|
@ -171,4 +171,10 @@ public:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* keys for registry use */
|
||||||
|
extern const char xpcomBaseName[];
|
||||||
|
extern const char xpcomKeyName[];
|
||||||
|
extern const char lastModValueName[];
|
||||||
|
extern const char fileSizeValueName[];
|
||||||
|
|
||||||
#endif /* nsComponentManagerUtils_h__ */
|
#endif /* nsComponentManagerUtils_h__ */
|
||||||
|
|
|
@ -171,4 +171,10 @@ public:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* keys for registry use */
|
||||||
|
extern const char xpcomBaseName[];
|
||||||
|
extern const char xpcomKeyName[];
|
||||||
|
extern const char lastModValueName[];
|
||||||
|
extern const char fileSizeValueName[];
|
||||||
|
|
||||||
#endif /* nsComponentManagerUtils_h__ */
|
#endif /* nsComponentManagerUtils_h__ */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче