nsCOMPtr<nsIDocument> doc; mRoot->GetDocument(getter_AddRefs(doc)); NS_ASSERTION(doc != nsnull, "root element has no document");
nsCOMPtr<nsIDocument> doc = mRoot->GetDocument(); NS_ASSERTION(doc, "root element has no document");
nsXULContentBuilder::OpenContainer(nsIContent* aElement){    // See if we're responsible for this element    if (! IsElementInBuilder(aElement, this))        return NS_OK;    nsCOMPtr<nsIRDFResource> resource;    nsXULContentUtils::GetElementRefResource(aElement, getter_AddRefs(resource));    // If it has no resource, there's nothing that we need to be    // concerned about here.    if (! resource)        return NS_OK;    // The element has a resource; that means that it corresponds    // to something in the graph, so we need to go to the graph to    // create its contents.    //    // Create the container's contents "quietly" (i.e., |aNotify ==    // PR_FALSE|), and then use the |container| and |newIndex| to    // notify layout where content got created.    nsCOMPtr<nsIContent> container;    PRInt32 newIndex;    CreateContainerContents(aElement, resource, PR_FALSE, getter_AddRefs(container), &newIndex);    if (container && IsLazyWidgetItem(aElement)) {        // The tree widget is special, and has to be spanked every        // time we add content to a container.        nsCOMPtr<nsIDocument> doc;        mRoot->GetDocument(getter_AddRefs(doc));        NS_ASSERTION(doc != nsnull, "root element has no document");        if (! doc)            return NS_ERROR_UNEXPECTED;        nsresult rv = doc->ContentAppended(container, newIndex);        if (NS_FAILED(rv)) return rv;    }    return NS_OK;}