host = (nsAutoString(":") + urlname).ToNewCString();
res = MangleUrl(urlname, &host); if (NS_FAILED(res)) return res;
SINGSIGN_PromptUsernameAndPassword    (const PRUnichar *text, PRUnichar **user, PRUnichar **pwd,     const char *urlname, nsIPrompt* dialog, PRBool *returnValue, PRBool strip) {  nsresult res;  /* do only the dialog if signon preference is not enabled */  if (!si_GetSignonRememberingPref()){    return dialog->PromptUsernameAndPassword(text, user, pwd, returnValue);  }  /* convert to a uri so we can parse out the hostname */  nsCOMPtr<nsIURL> uri;  nsComponentManager::CreateInstance(kStandardUrlCID, nsnull, NS_GET_IID(nsIURL), (void **) getter_AddRefs(uri));  uri->SetSpec((char *)urlname);  /* uri is of the form <scheme>://<username>:<password>@<host>:<portnumber>/<pathname>) */  /* get host part of the uri */  char* host = nsnull;  if (strip) {    res = uri->GetHost(&host);    if (NS_FAILED(res)) {      return res;    }  } else {    host = (nsAutoString(":") + urlname).ToNewCString();  }  /* prefill with previous username/password if any */  nsAutoString username, password;  si_RestoreOldSignonDataFromBrowser(host, PR_FALSE, username, password);  /* get new username/password from user */  *user = username.ToNewUnicode();  *pwd = password.ToNewUnicode();  PRBool checked = PR_TRUE;  res = si_CheckGetUsernamePassword(user, pwd, text, &checked);  if (NS_FAILED(res)) {    /* user pressed Cancel */    PR_FREEIF(*user);    PR_FREEIF(*pwd);    PR_FREEIF(host);    return res;  }  if (checked) {    si_RememberSignonDataFromBrowser (host, nsAutoString(*user), nsAutoString(*pwd));  }  /* cleanup and return */  PR_FREEIF(host);  return NS_OK;}