if ((aHistoryIndex >= 0) && (aHistoryIndex <= mHistory.Count() - 1)) { nsString* s = (nsString*) mHistory.ElementAt(aHistoryIndex); if (nsnull != s) { *aURLResult = s->GetUnicode(); } rv = NS_OK; } return rv;
nsCOMPtr<nsIHistoryEntry> entry;  NS_ENSURE_SUCCESS(mSessionHistory->GetEntryAtIndex(aIndex, PR_TRUE, getter_AddRefs(entry)), NS_ERROR_FAILURE); NS_ENSURE_TRUE(entry, NS_ERROR_FAILURE);  nsCOMPtr<nsIURI> uri;  entry->GetURI(getter_AddRefs(uri));  NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);  nsXPIDLCString spec; uri->GetSpec(getter_Copies(spec));  *aURLResult = NS_ConvertASCIItoUCS2(spec).ToNewUnicode();  return NS_OK;
nsWebShell::GetURL(PRInt32 aHistoryIndex, const PRUnichar** aURLResult){  nsresult rv = NS_ERROR_ILLEGAL_VALUE;  // XXX Ownership rules for the string passed back from this  // method are not XPCOM compliant. If they were correct,   // the caller would deallocate the string.  if ((aHistoryIndex >= 0) &&      (aHistoryIndex <= mHistory.Count() - 1)) {    nsString* s = (nsString*) mHistory.ElementAt(aHistoryIndex);    if (nsnull != s) {      *aURLResult = s->GetUnicode();    }    rv = NS_OK;  }  return rv;}