PRBool isVisited; NS_ENSURE_SUCCESS(mGlobalHistory->IsVisited(resolvedPath.get(), &isVisited), NS_ERROR_FAILURE); if (isVisited) aState = eLinkState_Visited;
if (NS_FAILED(rv)) { mFailedToLoadHistoryService = PR_TRUE; } }  if (mHistoryService) {  nsAutoString urlStr(aURLSpec);  char buf[256]; char* url = buf;  if (urlStr.Length() >= PRInt32(sizeof buf)) { url = new char[urlStr.Length() + 1]; }  PRInt64 lastVisitDate;  if (url) { urlStr.ToCString(url, urlStr.Length() + 1);  rv = mHistoryService->GetLastVisitDate(url, &lastVisitDate);  if (url != buf) delete[] url; } else { rv = NS_ERROR_OUT_OF_MEMORY; }    if (NS_FAILED(rv)) return rv;    if (! LL_IS_ZERO(lastVisitDate)) aState = eLinkState_Visited;   }
nsWebShell::GetLinkState(const nsACString& aLinkURI, nsLinkState& aState){  aState = eLinkState_Unvisited;  // no history, leave state unchanged  if (!mGlobalHistory)    return NS_OK;    // default to the given URI  nsCAutoString resolvedPath(aLinkURI);  nsresult rv;  // get the cached IO service  if (!mIOService)    mIOService = do_GetService(NS_IOSERVICE_CONTRACTID, &rv);          NormalizeURI(resolvedPath);  PRBool isVisited;  NS_ENSURE_SUCCESS(mGlobalHistory->IsVisited(resolvedPath.get(), &isVisited),                    NS_ERROR_FAILURE);  if (isVisited)    aState = eLinkState_Visited;    return NS_OK;}