char *username= nsnull, *password=nsnull; si_RestoreOldSignonDataFromBrowser(host, PR_FALSE, &username, &password); *user = nsAutoString(username).ToNewUnicode(); *pwd = nsAutoString(password).ToNewUnicode();
nsAutoString username, password; si_RestoreOldSignonDataFromBrowser(host, PR_FALSE, username, password); *user = username.ToNewUnicode(); *pwd = password.ToNewUnicode();
SINGSIGN_PromptUsernameAndPassword    (const PRUnichar *text, PRUnichar **user, PRUnichar **pwd,     const char *urlname, nsIPrompt* dialog, PRBool *returnValue) {  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;  res = uri->GetHost(&host);  if (NS_FAILED(res)) {    return res;  }  /* prefill with previous username/password if any */  char *username= nsnull, *password=nsnull;  si_RestoreOldSignonDataFromBrowser(host, PR_FALSE, &username, &password);  *user = nsAutoString(username).ToNewUnicode();  *pwd = nsAutoString(password).ToNewUnicode();  /* get new username/password from user */  res = dialog->PromptUsernameAndPassword(text, user, pwd, returnValue);  if (NS_FAILED(res) || !(*returnValue)) {    /* user pressed Cancel */    PR_FREEIF(*user);    PR_FREEIF(*pwd);    PR_FREEIF(host);    return res;  }  /* remember these values for next time */  username = nsString(*user).ToNewCString();  password = nsString(*pwd).ToNewCString();  if (si_OkToSave(host, username)) {    si_RememberSignonDataFromBrowser (host, username, password);  }  /* cleanup and return */  PR_FREEIF(username);  PR_FREEIF(password);  PR_FREEIF(host);  return NS_OK;}