rv = gXULUtils->FindChildByTag(aElement, kNameSpaceID_XUL, nsXULAtoms::treechildren, getter_AddRefs(insertionpoint));
rv = nsXULContentUtils::FindChildByTag(aElement, kNameSpaceID_XUL, nsXULAtoms::treechildren, getter_AddRefs(insertionpoint));
nsXULTemplateBuilder::CloseContainer(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;    nsCOMPtr<nsIAtom> tag;    rv = aElement->GetTag(*getter_AddRefs(tag));    if (NS_FAILED(rv)) return rv;    if (tag.get() == nsXULAtoms::treeitem) {        // Find the tag that contains the children so that we can        // remove all of the children. This is a -total- hack, that is        // necessary for the tree control because...I'm not sure. But        // it's necessary. Maybe we should fix the tree control to        // reflow itself when the 'open' attribute changes on a        // treeitem.        //        // OTOH, we could treat this as a (premature?) optimization so        // that nodes which are not being displayed don't hang around        // taking up space. Unfortunately, the tree widget currently        // _relies_ on this behavior and will break if we don't do it        // :-(.        // Find the <treechildren> beneath the <treeitem>...        nsCOMPtr<nsIContent> insertionpoint;        rv = gXULUtils->FindChildByTag(aElement, kNameSpaceID_XUL, nsXULAtoms::treechildren, getter_AddRefs(insertionpoint));        if (NS_FAILED(rv)) return rv;        if (insertionpoint) {            // ...and blow away all the generated content.            PRInt32 count;            rv = insertionpoint->ChildCount(count);            if (NS_FAILED(rv)) return rv;            rv = RemoveGeneratedContent(insertionpoint);            if (NS_FAILED(rv)) return rv;        }        // Force the XUL element to remember that it needs to re-generate        // its kids next time around.        nsCOMPtr<nsIXULContent> xulcontent = do_QueryInterface(aElement);        NS_ASSERTION(xulcontent != nsnull, "not an nsIXULContent");        if (! xulcontent)            return NS_ERROR_UNEXPECTED;        rv = xulcontent->SetLazyState(nsIXULContent::eChildrenMustBeRebuilt);        if (NS_FAILED(rv)) return rv;        // Clear the contents-generated attribute so that the next time we        // come back, we'll regenerate the kids we just killed.        rv = xulcontent->ClearLazyState(nsIXULContent::eContainerContentsBuilt);        if (NS_FAILED(rv)) return rv;        // Remove any instantiations involving this element from the        // conflict set.        MatchSet firings, retractions;        mConflictSet.Remove(ContentTestNode::Element(aElement), firings, retractions);    }    return NS_OK;}