si_RestoreOldSignonDataFromBrowser(host, (username == nsnull), &username, &password);
si_RestoreOldSignonDataFromBrowser(host, (username.Length() == 0), username, password);
SINGSIGN_PromptPassword    (const PRUnichar *text, PRUnichar **pwd, const char *urlname, nsIPrompt* dialog, PRBool *returnValue) {  nsresult res;  char *password=0, *username=0;  /* do only the dialog if signon preference is not enabled */  if (!si_GetSignonRememberingPref()){    return dialog->PromptPassword(text, nsnull /* window title */, pwd, returnValue);  }  /* convert to a uri so we can parse out the username and 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;  res = uri->GetHost(&host);  if (NS_FAILED(res)) {    return res;  }  /* extract username from uri -- note: prehost is <username>:<password> */  res = uri->GetPreHost(&username);  if (NS_FAILED(res)) {    PR_FREEIF(host);    return res;  }  char * colon = (char*) PL_strchr(username, ':');  if (colon) {    *colon = '\0';  }    /* get previous password used with this username, pick first user if no username found */  si_RestoreOldSignonDataFromBrowser(host, (username == nsnull), &username, &password);  /* return if a password was found */  if (password) {    *pwd = nsAutoString(password).ToNewUnicode();    *returnValue = PR_TRUE;    PR_FREEIF(password);    if (colon) {      *colon = ':';    }    PR_FREEIF(username);    PR_FREEIF(host);    return NS_OK;  }  /* if no password found, get new password from user */  res = dialog->PromptPassword(text, nsnull /* window title */, pwd, returnValue);  if (NS_FAILED(res) || !(*returnValue)) {    /* user pressed Cancel */    if (colon) {      *colon = ':';    }    PR_FREEIF(username);    PR_FREEIF(host);    return res;  }          /* remember these values for next time */  password = nsString(*pwd).ToNewCString();  if (password && PL_strlen(password) && si_OkToSave(host, username)) {    si_RememberSignonDataFromBrowser (host, username, password);  }  /* cleanup and return */  if (colon) {    *colon = ':';  }  PR_FREEIF(username);  PR_FREEIF(password);  PR_FREEIF(host);  return NS_OK;}