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;
if ((aHistoryIndex >= 0) && (aHistoryIndex <= mHistory.Count() - 1)) { nsString* s = (nsString*) mHistory.ElementAt(aHistoryIndex); if (nsnull != s) { *aURLResult = s->GetUnicode(); } rv = NS_OK; } return rv;
nsWebShell::GetURL(PRInt32 aIndex, const PRUnichar** aURLResult){   NS_ENSURE_STATE(mSessionHistory);   NS_ENSURE_TRUE(!IsFrame(), NS_ERROR_FAILURE);   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;}