}
nsGlobalHistory::GetSource(nsIRDFResource* aProperty,                           nsIRDFNode* aTarget,                           PRBool aTruthValue,                           nsIRDFResource** aSource){  NS_PRECONDITION(aProperty != nsnull, "null ptr");  if (! aProperty)    return NS_ERROR_NULL_POINTER;  NS_PRECONDITION(aTarget != nsnull, "null ptr");  if (! aTarget)    return NS_ERROR_NULL_POINTER;  nsresult rv;  *aSource = nsnull;  if (aProperty == kNC_URL) {    // See if we have the row...    // XXX We could be more forgiving here, and check for literal    // values as well.    nsCOMPtr<nsIRDFResource> target = do_QueryInterface(aTarget);    if (IsURLInHistory(target))      return CallQueryInterface(aTarget, aSource);      }  else if ((aProperty == kNC_Date) ||           (aProperty == kNC_FirstVisitDate) ||           (aProperty == kNC_VisitCount) ||           (aProperty == kNC_Name) ||           (aProperty == kNC_Hostname) ||           (aProperty == kNC_Referrer)) {    // Call GetSources() and return the first one we find.    nsCOMPtr<nsISimpleEnumerator> sources;    rv = GetSources(aProperty, aTarget, aTruthValue, getter_AddRefs(sources));    if (NS_FAILED(rv)) return rv;    PRBool hasMore;    rv = sources->HasMoreElements(&hasMore);    if (NS_FAILED(rv)) return rv;    if (hasMore) {      nsCOMPtr<nsISupports> isupports;      rv = sources->GetNext(getter_AddRefs(isupports));      if (NS_FAILED(rv)) return rv;      return CallQueryInterface(isupports, aSource);    }  }  return NS_RDF_NO_VALUE;  }