зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1389848: Make isServiceInstantiated*() return false rather than throw for uninstantiated services. r=ehsan
MozReview-Commit-ID: J8w7eQ6R3eS --HG-- extra : rebase_source : 5fabd584d645267b72bbcd15bbdfc01dd15f2386
This commit is contained in:
Родитель
7da155b917
Коммит
1e4b0c194f
|
@ -46,8 +46,7 @@ startupRecorder.prototype = {
|
|||
modules: this.loader.loadedModules(),
|
||||
services: Object.keys(Cc).filter(c => {
|
||||
try {
|
||||
Cm.isServiceInstantiatedByContractID(c, Ci.nsISupports);
|
||||
return true;
|
||||
return Cm.isServiceInstantiatedByContractID(c, Ci.nsISupports);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1316,7 +1316,7 @@ nsComponentManagerImpl::IsServiceInstantiated(const nsCID& aClass,
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsresult rv = NS_ERROR_SERVICE_NOT_AVAILABLE;
|
||||
nsresult rv = NS_OK;
|
||||
nsFactoryEntry* entry;
|
||||
|
||||
{
|
||||
|
@ -1328,6 +1328,8 @@ nsComponentManagerImpl::IsServiceInstantiated(const nsCID& aClass,
|
|||
nsCOMPtr<nsISupports> service;
|
||||
rv = entry->mServiceObject->QueryInterface(aIID, getter_AddRefs(service));
|
||||
*aResult = (service != nullptr);
|
||||
} else {
|
||||
*aResult = false;
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -1356,7 +1358,7 @@ nsComponentManagerImpl::IsServiceInstantiatedByContractID(
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsresult rv = NS_ERROR_SERVICE_NOT_AVAILABLE;
|
||||
nsresult rv = NS_OK;
|
||||
nsFactoryEntry* entry;
|
||||
{
|
||||
SafeMutexAutoLock lock(mLock);
|
||||
|
@ -1367,6 +1369,8 @@ nsComponentManagerImpl::IsServiceInstantiatedByContractID(
|
|||
nsCOMPtr<nsISupports> service;
|
||||
rv = entry->mServiceObject->QueryInterface(aIID, getter_AddRefs(service));
|
||||
*aResult = (service != nullptr);
|
||||
} else {
|
||||
*aResult = false;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -45,13 +45,12 @@ interface nsIServiceManager : nsISupports
|
|||
* isServiceInstantiated
|
||||
*
|
||||
* isServiceInstantiated will return a true if the service has already
|
||||
* been created, or throw otherwise
|
||||
* been created, or false otherwise. Throws if the service does not
|
||||
* implement the given IID.
|
||||
*
|
||||
* @param aClass or aContractID : aClass or aContractID of object
|
||||
* instance requested
|
||||
* @param aIID : IID of interface requested
|
||||
* @throws NS_ERROR_SERVICE_NOT_AVAILABLE if the service hasn't been
|
||||
* instantiated
|
||||
* @throws NS_NOINTERFACE if the IID given isn't supported by the object
|
||||
*/
|
||||
boolean isServiceInstantiated(in nsCIDRef aClass, in nsIIDRef aIID);
|
||||
|
|
Загрузка…
Ссылка в новой задаче