gXULUtils->GetElementRefResource(aElement, getter_AddRefs(resource)); if (resource) {
nsresult rv = nsXULContentUtils::GetElementRefResource(aElement, getter_AddRefs(resource)); if (NS_SUCCEEDED(rv)) {
nsXULTemplateBuilder::CreateTemplateAndContainerContents(nsIContent* aElement,                                                         nsIContent** aContainer,                                                         PRInt32* aNewIndexInContainer){    // Generate both 1) the template content for the current element,    // and 2) recursive subcontent (if the current element refers to a    // container resource in the RDF graph).    // If we're asked to return the first generated child, then    // initialize to "none".    if (aContainer) {        *aContainer = nsnull;        *aNewIndexInContainer = -1;    }    // Create the current resource's contents from the template, if    // appropriate    nsCOMPtr<nsIContent> tmpl;    mTemplateMap.GetTemplateFor(aElement, getter_AddRefs(tmpl));    if (tmpl)        CreateTemplateContents(aElement, tmpl, aContainer, aNewIndexInContainer);    nsCOMPtr<nsIRDFResource> resource;    gXULUtils->GetElementRefResource(aElement, getter_AddRefs(resource));    if (resource) {        // 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.        CreateContainerContents(aElement, resource, PR_FALSE, aContainer, aNewIndexInContainer);    }    return NS_OK;}