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 = ToNewUnicode(NS_ConvertASCIItoUCS2(spec));  return NS_OK;
nsWebShell::GetURL(PRInt32 aIndex, 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 = ToNewUnicode(NS_ConvertASCIItoUCS2(spec));   return NS_OK;}