nsCAutoString spec; aLinkURI->GetSpec(spec);
if ((nsnull == mHistoryService) && !mFailedToLoadHistoryService) { rv = nsServiceManager::GetService(kGlobalHistoryCID, NS_GET_IID(nsIGlobalHistory), (nsISupports**) &mHistoryService);
nsWebShell::GetLinkState(nsIURI* aLinkURI, nsLinkState& aState){  if (!aLinkURI) {    // No uri means not a link    aState = eLinkState_NotLink;    return NS_OK;  }      aState = eLinkState_Unvisited;  // no history, leave state unchanged  if (!mGlobalHistory)    return NS_OK;  nsCAutoString spec;  aLinkURI->GetSpec(spec);  PRBool isVisited;  NS_ENSURE_SUCCESS(mGlobalHistory->IsVisited(spec.get(), &isVisited),                    NS_ERROR_FAILURE);  if (isVisited)    aState = eLinkState_Visited;    return NS_OK;}