(aProperty == kNC_Referrer)) {
(aProperty == kNC_Referrer) || (aProperty == kNC_URL)) {
nsGlobalHistory::GetTarget(nsIRDFResource* aSource,                           nsIRDFResource* aProperty,                           PRBool aTruthValue,                           nsIRDFNode** aTarget){  NS_PRECONDITION(aSource != nsnull, "null ptr");  if (! aSource)    return NS_ERROR_NULL_POINTER;  NS_PRECONDITION(aProperty != nsnull, "null ptr");  if (! aProperty)    return NS_ERROR_NULL_POINTER;  nsresult rv;  *aTarget = nsnull;  if ((aSource == kNC_HistoryRoot) && (aProperty == kNC_child)) {    nsCOMPtr<nsISimpleEnumerator> targets;    rv = GetTargets(aSource, aProperty, aTruthValue, getter_AddRefs(targets));    if (NS_FAILED(rv)) return rv;    PRBool hasMore;    rv = targets->HasMoreElements(&hasMore);    if (NS_FAILED(rv)) return rv;    if (! hasMore) return NS_RDF_NO_VALUE;    nsCOMPtr<nsISupports> isupports;    rv = targets->GetNext(getter_AddRefs(isupports));    if (NS_FAILED(rv)) return rv;    return isupports->QueryInterface(nsCOMTypeInfo<nsIRDFNode>::GetIID(), (void**) aTarget);  }  else if (aProperty == kNC_URL) {    rv = aSource->QueryInterface(nsCOMTypeInfo<nsIRDFNode>::GetIID(), (void**) aTarget);    if (NS_SUCCEEDED(rv))    {    	// Yes, a nasty hack so that any URL starting with "NC:" isn't returned.    	// In truth, the history datasource should only answer on the URL property    	// if the source is actually in the history store.	const char	*url = nsnull;	if (NS_SUCCEEDED(rv = aSource->GetValueConst(&url)) && (url))	{		nsAutoString	urlStr = url;		if (urlStr.Find("NC:", PR_TRUE) == 0)		{			rv = NS_RDF_NO_VALUE;		}	}    }    return(rv);  }  else if ((aProperty == kNC_Date) ||           (aProperty == kNC_VisitCount) ||           (aProperty == kNC_Name) ||           (aProperty == kNC_Referrer)) {    // It's a real property! Okay, first we'll get the row...    mdb_err err;    nsXPIDLCString uri;    rv = aSource->GetValueConst(getter_Shares(uri));    if (NS_FAILED(rv)) return rv;    PRInt32 len = PL_strlen(uri);    mdbYarn yarn = { (void*)NS_STATIC_CAST(const char*, uri), len, len, 0, 0, nsnull };    mdbOid rowId;    nsMdbPtr<nsIMdbRow> row(mEnv);    err = mStore->FindRow(mEnv, kToken_HistoryRowScope, kToken_URLColumn, &yarn, &rowId, getter_Acquires(row));    if (err != 0) return NS_ERROR_FAILURE;    if (!row) return NS_RDF_NO_VALUE;    // ...and then depending on the property they want, we'll pull the    // cell they want out of it.    if (aProperty == kNC_Date) {      // Last visit date      nsMdbPtr<nsIMdbCell> cell(mEnv);      err = row->GetCell(mEnv, kToken_LastVisitDateColumn, getter_Acquires(cell));      if (err != 0) return NS_ERROR_FAILURE;      if (!cell) return NS_RDF_NO_VALUE;      cell->AliasYarn(mEnv, &yarn);      PRInt64 i;      rv = CharsToPRInt64((const char*) yarn.mYarn_Buf, yarn.mYarn_Fill, &i);      if (NS_FAILED(rv)) return rv;      nsCOMPtr<nsIRDFDate> date;      rv = gRDFService->GetDateLiteral(i, getter_AddRefs(date));      if (NS_FAILED(rv)) return rv;      return date->QueryInterface(nsCOMTypeInfo<nsIRDFNode>::GetIID(), (void**) aTarget);    }    else if (aProperty == kNC_VisitCount) {      // Visit count      NS_NOTYETIMPLEMENTED("sorry");      rv = NS_ERROR_NOT_IMPLEMENTED;    }    else if (aProperty == kNC_Name) {      // Site name (i.e., page title)      nsMdbPtr<nsIMdbCell> cell(mEnv);      err = row->GetCell(mEnv, kToken_NameColumn, getter_Acquires(cell));      if (err != 0) return NS_ERROR_FAILURE;      if (!cell) return NS_RDF_NO_VALUE;      cell->AliasYarn(mEnv, &yarn);      nsAutoString str((const PRUnichar*) yarn.mYarn_Buf, PRInt32(yarn.mYarn_Fill / sizeof(PRUnichar)));      nsCOMPtr<nsIRDFLiteral> name;      rv = gRDFService->GetLiteral(str.GetUnicode(), getter_AddRefs(name));      if (NS_FAILED(rv)) return rv;      return name->QueryInterface(nsCOMTypeInfo<nsIRDFNode>::GetIID(), (void**) aTarget);    }    else if (aProperty == kNC_Referrer) {      // Referrer field      nsMdbPtr<nsIMdbCell> cell(mEnv);      err = row->GetCell(mEnv, kToken_ReferrerColumn, getter_Acquires(cell));      if (err != 0) return NS_ERROR_FAILURE;      if (!cell) return NS_RDF_NO_VALUE;      cell->AliasYarn(mEnv, &yarn);      nsCAutoString str((const char*) yarn.mYarn_Buf, yarn.mYarn_Fill);      nsCOMPtr<nsIRDFResource> referrer;      rv = gRDFService->GetResource((const char*) str, getter_AddRefs(referrer));      if (NS_FAILED(rv)) return rv;      return referrer->QueryInterface(nsCOMTypeInfo<nsIRDFNode>::GetIID(), (void**) aTarget);    }  }  *aTarget = nsnull;  return NS_RDF_NO_VALUE;}