nsresult rv;
nsWebShell:: GetLinkState(const PRUnichar* aURLSpec, nsLinkState& aState){  nsString URLSpec(aURLSpec);  aState = eLinkState_Unvisited;    nsresult rv;  // XXX: GlobalHistory is going to be moved out of the webshell into a more appropriate place.  if (nsnull == mHistoryService) {    rv = nsServiceManager::GetService(kGlobalHistoryCID,                                      nsIGlobalHistory::GetIID(),                                      (nsISupports**) &mHistoryService);    if (NS_FAILED(rv))      return NS_OK; // XXX Okay, we couldn't color the link. Big deal.  }  // XXX aURLSpec should really be a char*, not a PRUnichar*.  nsAutoString urlStr(aURLSpec);  char buf[256];  char* url = buf;  if (urlStr.Length() >= 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;  }//XXX: Moved to destructor  nsServiceManager::ReleaseService(kGlobalHistoryCID, mHistoryService);  if (NS_FAILED(rv)) return rv;  // a last-visit-date of zero means we've never seen it before; so  // if it's not zero, we must've seen it.  if (! LL_IS_ZERO(lastVisitDate))    aState = eLinkState_Visited;  // XXX how to tell if eLinkState_OutOfDate?  return NS_OK;}