nsCOMPtr<nsIXULContent> xulcontent = do_QueryInterface(aElement);  if (xulcontent) { PRBool containerContentsBuilt; rv = xulcontent->GetLazyState(nsIXULContent::eContainerContentsBuilt, containerContentsBuilt); if (NS_FAILED(rv)) return rv;  if (! containerContentsBuilt) return NS_OK; }
RDFGenericBuilderImpl::RebuildContainer(nsIContent* aElement){    NS_PRECONDITION(aElement != nsnull, "null ptr");    if (! aElement)        return NS_ERROR_NULL_POINTER;    // First, make sure that the element is in the right widget -- ours.    if (!IsElementInWidget(aElement))        return NS_OK;    nsresult rv;    // Remove any generated children from this node    rv = RemoveGeneratedContent(aElement);    if (NS_FAILED(rv)) return rv;    // Forces the XUL element to remember that it needs to    // re-generate its children next time around.    nsCOMPtr<nsIXULContent> xulcontent = do_QueryInterface(aElement);    if (xulcontent) {        rv = xulcontent->SetLazyState(nsIXULContent::eChildrenMustBeRebuilt);        if (NS_FAILED(rv)) return rv;        rv = xulcontent->ClearLazyState(nsIXULContent::eTemplateContentsBuilt);        if (NS_FAILED(rv)) return rv;        rv = xulcontent->ClearLazyState(nsIXULContent::eContainerContentsBuilt);        if (NS_FAILED(rv)) return rv;    }    // Now, regenerate both the template-generated contents for the    // current node...    nsCOMPtr<nsIContent> container;    PRInt32 newIndex;    rv = CreateTemplateAndContainerContents(aElement, getter_AddRefs(container), &newIndex);    if (NS_FAILED(rv)) return rv;    if (container) {        nsCOMPtr<nsIDocument> doc = do_QueryInterface(mDocument);        if (! doc)            return NS_ERROR_UNEXPECTED;        rv = doc->ContentAppended(container, newIndex);        if (NS_FAILED(rv)) return rv;    }    return NS_OK;}