nsCAutoString url = NS_ConvertUCS2toUTF8(urlName);
nsAutoString url = nsAutoString(urlName);
WLLT_PrefillReturn(const nsString& results){  nsAutoString fillins;  nsAutoString urlName;  nsAutoString skip;  nsAutoString next;  /* get values that are in environment variables */  SI_FindValueInArgs(results, NS_LITERAL_STRING("|fillins|"), fillins);  SI_FindValueInArgs(results, NS_LITERAL_STRING("|skip|"), skip);  SI_FindValueInArgs(results, NS_LITERAL_STRING("|url|"), urlName);  wallet_DecodeVerticalBars(fillins);  wallet_DecodeVerticalBars(urlName);  /* add url to url list if user doesn't want to preview this page in the future */  if (skip.Equals(NS_LITERAL_STRING("true"))) {    nsCAutoString url = NS_ConvertUCS2toUTF8(urlName);    nsVoidArray* dummy;    nsCAutoString urlPermissions;    wallet_ReadFromList(url, urlPermissions, dummy, wallet_URL_list, PR_FALSE);    wallet_SetNoPreview(nsCAutoString(urlPermissions), 'y');    if (wallet_WriteToList(url.get(), urlPermissions.get(), dummy, wallet_URL_list, PR_FALSE, DUP_OVERWRITE)) {      wallet_WriteToFile(URLFileName, wallet_URL_list);    }  }  /* process the list, doing the fillins */  if (fillins.Length() == 0) { /* user pressed CANCEL */    wallet_ReleasePrefillElementList(wallet_list);    wallet_list = nsnull;    return;  }  /*   * note: there are two lists involved here and we are stepping through both of them.   * One is the pre-fill list that was generated when we walked through the html content.   * For each pre-fillable item, it contains n entries, one for each possible value that   * can be prefilled for that field.  The first entry for each field can be identified   * because it has a non-zero count field (in fact, the count is the number of entries   * for that field), all subsequent entries for the same field have a zero count field.   * The other is the fillin list which was generated by the html dialog that just   * finished.  It contains one entry for each pre-fillable item specificying that   * particular value that should be prefilled for that item.   */  wallet_PrefillElement * mapElementPtr;  /* step through pre-fill list */  PRInt32 count = LIST_COUNT(wallet_list);  for (PRInt32 i=0; i<count; i++) {    mapElementPtr = NS_STATIC_CAST(wallet_PrefillElement*, wallet_list->ElementAt(i));    /* advance in fillins list each time a new schema name in pre-fill list is encountered */    if (mapElementPtr->count != 0) {      /* count != 0 indicates a new schema name */      nsAutoString tail;      if (NS_FAILED(wallet_GetNextInString(fillins, next, tail))) {        break;      }      fillins = tail;      if (PL_strcmp(NS_ConvertUCS2toUTF8(next).get(), mapElementPtr->schema)) {        break; /* something's wrong so stop prefilling */      }      wallet_GetNextInString(fillins, next, tail);      fillins = tail;    }    if (next == mapElementPtr->value) {      /*       * Remove entry from wallet_SchemaToValue_list and then reinsert.  This will       * keep multiple values in that list for the same field ordered with       * most-recently-used first.  That's useful since the first such entry       * is the default value used for pre-filling.       */      /*       * Test for mapElementPtr->count being zero is an optimization that avoids us from doing a       * reordering if the current entry already was first       */      if (mapElementPtr->count == 0) {        nsCAutoString oldvalueUTF8;        PRInt32 index = 0;        PRInt32 lastIndex = index;        nsVoidArray* dummy;        while(wallet_ReadFromList(nsDependentCString(mapElementPtr->schema),                                  oldvalueUTF8,                                  dummy,                                  wallet_SchemaToValue_list,                                  PR_TRUE,                                  index)) {          if (oldvalueUTF8.Equals(NS_ConvertUCS2toUTF8(mapElementPtr->value).get())) {            wallet_MapElement * mapElement =              (wallet_MapElement *) (wallet_SchemaToValue_list->ElementAt(lastIndex));            wallet_SchemaToValue_list->RemoveElementAt(lastIndex);            wallet_WriteToList(              mapElement->item1,              mapElement->item2,              mapElement->itemList,              wallet_SchemaToValue_list,              PR_FALSE); /* note: obscure=false, otherwise we will obscure an obscured value */            delete mapElement;            break;          }          lastIndex = index;        }      }    }    /* Change the value */    if (!next.IsEmpty()) {      if (mapElementPtr->inputElement) {        mapElementPtr->inputElement->SetValue(next);      } else {        nsresult result;        result = wallet_GetSelectIndex(mapElementPtr->selectElement, next, mapElementPtr->selectIndex);        if (NS_SUCCEEDED(result)) {          mapElementPtr->selectElement->SetSelectedIndex(mapElementPtr->selectIndex);        } else {          mapElementPtr->selectElement->SetSelectedIndex(0);        }      }    }  }  /* Release the prefill list that was generated when we walked thru the html content */  wallet_ReleasePrefillElementList(wallet_list);  wallet_list = nsnull;}