Bug 1217047 - try harder in IsContractIDRegistered to return a reasonable answer; r=bsmedberg,f=yury
--- a/xpcom/components/nsComponentManager.cpp
+++ b/xpcom/components/nsComponentManager.cpp
@@ -1744,17 +1744,22 @@ nsComponentManagerImpl::IsContractIDRegi
{
if (NS_WARN_IF(!aClass)) {
return NS_ERROR_INVALID_ARG;
}
nsFactoryEntry* entry = GetFactoryEntry(aClass, strlen(aClass));
if (entry) {
- *aResult = true;
+ // UnregisterFactory might have left a stale nsFactoryEntry in
+ // mContractIDs, so we should check to see whether this entry has
+ // anything useful.
+ *aResult = (bool(entry->mModule) ||
+ bool(entry->mFactory) ||
+ bool(entry->mServiceObject));
} else {
*aResult = false;
}
return NS_OK;
}
NS_IMETHODIMP
nsComponentManagerImpl::EnumerateCIDs(nsISimpleEnumerator** aEnumerator)