PRBool			hasMore = PR_TRUE; while (hasMore)
nsresult			rv; nsCOMPtr<nsISimpleEnumerator>	arcs; if (NS_SUCCEEDED(rv = mInner->GetTargets(kNC_LastSearchRoot, kNC_Child, PR_TRUE, getter_AddRefs(arcs))))
InternetSearchDataSource::ClearResults(PRBool flushLastSearchRef){	if (!mInner)	return(NS_ERROR_UNEXPECTED);	// forget any nodes under the last search root	nsresult			rv;	nsCOMPtr<nsISimpleEnumerator>	arcs;	if (NS_SUCCEEDED(rv = mInner->GetTargets(kNC_LastSearchRoot, kNC_Child, PR_TRUE, getter_AddRefs(arcs))))	{		PRBool			hasMore = PR_TRUE;    while (hasMore)		{      if (NS_FAILED(arcs->HasMoreElements(&hasMore)) || !hasMore)				break;			nsCOMPtr<nsISupports>	arc;			if (NS_FAILED(arcs->GetNext(getter_AddRefs(arc))))				break;			nsCOMPtr<nsIRDFResource> child (do_QueryInterface(arc));			if (child)			{				mInner->Unassert(kNC_LastSearchRoot, kNC_Child, child);			}			// *after* (so that we won't thrash the XUL template builder) unasserting			// child node, determine if there are any other references to the child			// node in the graph			PRBool hasInArcs = PR_FALSE;			nsCOMPtr<nsISimpleEnumerator>	inArcs;			if (NS_FAILED(mInner->ArcLabelsIn(child, getter_AddRefs(inArcs))) ||				(!inArcs))				continue;      if (NS_FAILED(inArcs->HasMoreElements(&hasInArcs)) || hasInArcs)				continue;			// no other references, so also unassert any outgoing arcs			nsCOMPtr<nsISimpleEnumerator>	outArcs;			if (NS_FAILED(mInner->ArcLabelsOut(child, getter_AddRefs(outArcs))) ||				(!outArcs))				continue;			PRBool	hasMoreOutArcs = PR_TRUE;      while (hasMoreOutArcs)			{        if (NS_FAILED(outArcs->HasMoreElements(&hasMoreOutArcs)) ||            !hasMoreOutArcs)					break;				nsCOMPtr<nsISupports>	outArc;				if (NS_FAILED(outArcs->GetNext(getter_AddRefs(outArc))))					break;				nsCOMPtr<nsIRDFResource> property (do_QueryInterface(outArc));				if (!property)					continue;				nsCOMPtr<nsIRDFNode> target;				if (NS_FAILED(mInner->GetTarget(child, property, PR_TRUE,					getter_AddRefs(target))) || (!target))					continue;				mInner->Unassert(child, property, target);			}		}	}  if (flushLastSearchRef)	{		// forget the last search query		nsCOMPtr<nsIRDFNode>	lastTarget;		if (NS_SUCCEEDED(rv = mInner->GetTarget(kNC_LastSearchRoot, kNC_Ref,			PR_TRUE, getter_AddRefs(lastTarget))) && (rv != NS_RDF_NO_VALUE))		{			nsCOMPtr<nsIRDFLiteral>	lastLiteral (do_QueryInterface(lastTarget));			if (lastLiteral)			{				rv = mInner->Unassert(kNC_LastSearchRoot, kNC_Ref, lastLiteral);			}		}	}	return(NS_OK);}