return mInner->GetTarget(aSource, aProperty, aTruthValue, aTarget);
else if ((aProperty == kNC_Date) || (aProperty == kNC_FirstVisitDate) || (aProperty == kNC_VisitCount) || (aProperty == kNC_AgeInDays) || (aProperty == kNC_Name) || (aProperty == kNC_NameSort) || (aProperty == kNC_Hostname) || (aProperty == kNC_Referrer) || (aProperty == kNC_URL)) {  const char* uri; rv = aSource->GetValueConst(&uri); if (NS_FAILED(rv)) return rv;    if (aProperty == kNC_URL && !IsFindResource(aSource)) {  nsCOMPtr<nsIRDFLiteral> uriLiteral; rv = gRDFService->GetLiteral(NS_ConvertUTF8toUCS2(uri).get(), getter_AddRefs(uriLiteral)); if (NS_FAILED(rv))    return(rv); *aTarget = uriLiteral; NS_ADDREF(*aTarget); return NS_OK; }   if (((aProperty == kNC_Name) || (aProperty == kNC_NameSort)) && IsFindResource(aSource)) {   if (aProperty == kNC_NameSort) { nsCOMPtr<nsIRDFLiteral> uriLiteral; rv = gRDFService->GetLiteral(NS_ConvertUTF8toUCS2(uri).get(), getter_AddRefs(uriLiteral)); if (NS_FAILED(rv))    return(rv);  *aTarget = uriLiteral; NS_ADDREF(*aTarget); return NS_OK; } else return GetFindUriName(uri, aTarget); }   nsMdbPtr<nsIMdbRow> row(mEnv); rv = FindRow(kToken_URLColumn, uri, getter_Acquires(row)); if (NS_FAILED(rv) || !row) return NS_RDF_NO_VALUE;  mdb_err err;   if (aProperty == kNC_Date  || aProperty == kNC_FirstVisitDate) {  PRInt64 i; if (aProperty == kNC_Date) rv = GetRowValue(row, kToken_LastVisitDateColumn, &i); else rv = GetRowValue(row, kToken_FirstVisitDateColumn, &i);  if (NS_FAILED(rv)) return rv;  nsCOMPtr<nsIRDFDate> date; rv = gRDFService->GetDateLiteral(i, getter_AddRefs(date)); if (NS_FAILED(rv)) return rv;  return CallQueryInterface(date, aTarget); } else if (aProperty == kNC_VisitCount) { mdbYarn yarn; err = row->AliasCellYarn(mEnv, kToken_VisitCountColumn, &yarn); if (err != 0) return NS_ERROR_FAILURE;  PRInt32 visitCount = 0; rv = GetRowValue(row, kToken_VisitCountColumn, &visitCount); if (NS_FAILED(rv) || visitCount <1) visitCount = 1;  nsCOMPtr<nsIRDFInt> visitCountLiteral; rv = gRDFService->GetIntLiteral(visitCount, getter_AddRefs(visitCountLiteral)); if (NS_FAILED(rv)) return rv;  return CallQueryInterface(visitCountLiteral, aTarget); } else if (aProperty == kNC_AgeInDays) { PRInt64 lastVisitDate; rv = GetRowValue(row, kToken_LastVisitDateColumn, &lastVisitDate); if (NS_FAILED(rv)) return rv;  PRInt32 days = GetAgeInDays(NormalizeTime(GetNow()), lastVisitDate);  nsCOMPtr<nsIRDFInt> ageLiteral; rv = gRDFService->GetIntLiteral(days, getter_AddRefs(ageLiteral)); if (NS_FAILED(rv)) return rv;  *aTarget = ageLiteral; NS_ADDREF(*aTarget); return NS_OK; } else if (aProperty == kNC_Name || aProperty == kNC_NameSort) {  nsAutoString title; rv = GetRowValue(row, kToken_NameColumn, title); if (NS_FAILED(rv) || title.IsEmpty()) {  nsCOMPtr<nsIURL> urlObj(do_CreateInstance(kStandardUrlCID, &rv)); if (NS_FAILED(rv)) return rv;  rv = urlObj->SetSpec(uri); if (NS_FAILED(rv)) return rv;  nsXPIDLCString filename; rv = urlObj->GetFileName(getter_Copies(filename)); if (NS_FAILED(rv) || !(const char*)filename) {  rv = urlObj->GetPath(getter_Copies(filename)); if (PL_strcmp(filename, "/") == 0) {   return GetTarget(aSource, kNC_Hostname, aTruthValue, aTarget);  } }  if (NS_FAILED(rv)) return rv;   title = NS_ConvertUTF8toUCS2(filename); } if (NS_FAILED(rv)) return rv;  nsCOMPtr<nsIRDFLiteral> name; rv = gRDFService->GetLiteral(title.GetUnicode(), getter_AddRefs(name)); if (NS_FAILED(rv)) return rv;  return CallQueryInterface(name, aTarget); } else if (aProperty == kNC_Hostname || aProperty == kNC_Referrer) {  nsCAutoString str; if (aProperty == kNC_Hostname) rv = GetRowValue(row, kToken_HostnameColumn, str); else if (aProperty == kNC_Referrer) rv = GetRowValue(row, kToken_ReferrerColumn, str);  if (NS_FAILED(rv)) return rv;  nsCOMPtr<nsIRDFResource> resource; rv = gRDFService->GetResource(str.get(), getter_AddRefs(resource)); if (NS_FAILED(rv)) return rv;  return CallQueryInterface(resource, aTarget); }  else { NS_NOTREACHED("huh, how'd I get here?"); } } return NS_RDF_NO_VALUE;
nsGlobalHistory::GetTarget(nsIRDFResource* aSource,                           nsIRDFResource* aProperty,                           PRBool aTruthValue,                           nsIRDFNode** aTarget){  if (aTruthValue && (aProperty == kNC_URL)) {    nsresult rv;    nsXPIDLCString uri;    rv = aSource->GetValue( getter_Copies(uri) );    NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get source's URI");    if (NS_FAILED(rv)) return(rv);    nsAutoString  url(uri);    if (url.Find("NC:") == 0)      return NS_RDF_NO_VALUE;    nsCOMPtr<nsIRDFLiteral>  literal;    rv = gRDFService->GetLiteral(url.GetUnicode(), getter_AddRefs(literal));    if (NS_FAILED(rv)) return rv;    *aTarget = literal;    NS_ADDREF(*aTarget);    return NS_OK;  }  return mInner->GetTarget(aSource, aProperty, aTruthValue, aTarget);}