nsCOMPtr<nsIURI> uri; nsresult result = ioService->NewURI(nsDependentCString(passwordRealm), nsnull, nsnull, getter_AddRefs(uri)); if (NS_FAILED(result)) { return; } nsCAutoString tempHost; result = uri->GetHost(tempHost); if (NS_FAILED(result)) { return; }
SINGSIGN_RestoreSignonData(nsIPrompt* dialog, const char* passwordRealm, const PRUnichar* name, PRUnichar** value, PRUint32 elementNumber) {  nsCAutoString strippedRealm;  nsCOMPtr<nsIIOService> ioService = do_GetService(NS_IOSERVICE_CONTRACTID);  if (!ioService) return;  ioService->ExtractUrlPart(nsDependentCString(passwordRealm), nsIIOService::url_Host, strippedRealm);  si_RestoreSignonData(dialog, (char*)strippedRealm.get(), name, value, elementNumber);}