rv = compMgr->RegisterComponent(kCharsetMenuCID, NS_CHARSETMENU_PID, NS_RDF_DATASOURCE_CONTRACTID_PREFIX NS_CHARSETMENU_PID, path, PR_TRUE, PR_TRUE); if(NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;
extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* aServMgr, const char * path){  nsresult rv;  nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));  if (NS_FAILED(rv)) return rv;  nsIComponentManager* compMgr;  rv = servMgr->GetService(kComponentManagerCID,                            NS_GET_IID(nsIComponentManager),                            (nsISupports**)&compMgr);  if (NS_FAILED(rv)) return rv;  rv = compMgr->RegisterComponent(kCharsetMenuCID,       NS_CHARSETMENU_PID,      NS_RDF_DATASOURCE_CONTRACTID_PREFIX NS_CHARSETMENU_PID,       path, PR_TRUE, PR_TRUE);  if(NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;  rv = compMgr->RegisterComponent(kUnicodeDecodeHelperCID,       "Unicode Decode Helper",      NS_UNICODEDECODEHELPER_CONTRACTID,       path, PR_TRUE, PR_TRUE);  if(NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;  rv = compMgr->RegisterComponent(kUnicodeEncodeHelperCID,       "Unicode Encode Helper",      NS_UNICODEENCODEHELPER_CONTRACTID,       path,       PR_TRUE, PR_TRUE);  if(NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;  rv = compMgr->RegisterComponent(kCharsetAliasCID,       "Charset Alias Information",       NS_CHARSETALIAS_CONTRACTID,       path,       PR_TRUE, PR_TRUE);  if(NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;  rv = compMgr->RegisterComponent(kTextToSubURICID,       "Text To Sub URI Helper",       NS_ITEXTTOSUBURI_CONTRACTID,       path,       PR_TRUE, PR_TRUE);  if(NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;  rv = compMgr->RegisterComponent(kCharsetConverterManagerCID,       "Charset Conversion Manager",       NS_CHARSETCONVERTERMANAGER_CONTRACTID,      path, PR_TRUE, PR_TRUE);  if(NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;  rv = compMgr->RegisterComponent(kPlatformCharsetCID,       "Platform Charset Information",       NS_PLATFORMCHARSET_CONTRACTID,       path,       PR_TRUE, PR_TRUE);  done:  (void)servMgr->ReleaseService(kComponentManagerCID, compMgr);  return rv;}