NS_ERROR_FACTORY_NOT_REGISTERED is returned because no factory
linked/registered for NS_PROFILE_CONTRACTID.
Check mozilla/profile/build/nsProfileFactory.cpp, it's where the factory gets
defined and this cpp is compiled only when
MOZ_SINGLE_PROFILE is NOT defined.
See the lines below in the makefile.in in mozilla/profile
ifndef MOZ_SINGLE_PROFILE
DIRS += src build resources defaults pref-migrator
endif
So, as far as I see you would need to specify that you're using multiple
profiles, make sure that profile library is compiled and
link against it :)
-dmtry
> and I am statically linking to libprofdirserviceprrovidersa_s.a and
> appear to succeed when calling NS_NewProfileDirServiceProvider()
> followed by profDirServiceProvider->Register(). However, when I try to
> get the Profile service from the service manager, I get
> NS_ERROR_FACTORY_NOT_REGISTERED.
>
> To get the profile manager, I am doing the following:
>
> nsresult rv;
> nsCOMPtr<nsIProfile> profileService;
> rv = GetService(NS_PROFILE_CONTRACTID,
> NS_GET_IID(nsIProfile),getter_AddRefs(profileService));
>
> where GetService() is implemented as follows:
>
> nsresult GetService(const char *aContractID, const nsIID &aIID,
> void **aInstancePtr)
> {
> nsresult rv;
>
>
> nsCOMPtr<nsIServiceManager> servMgr;
> rv = NS_GetServiceManager(getter_AddRefs(servMgr));
> if (NS_FAILED(rv))
> return rv;
>
>
> return servMgr->GetServiceByContractID(aContractID, aIID,
> aInstancePtr);
> }
>
>
> I need to support multiple profiles, so what do I need to do to make
> this work? I remember seeing comments on a bug report or in
> documentation somewhere talking about why a stand-alone profile service
> was split off, but I can't seem to find it anymore. Am I using the
> right library?
>
>
> Thanks.
>
> J
>
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding