rv = child->SetDocument(nsnull, PR_TRUE);
rv = child->SetDocument(nsnull, PR_TRUE, PR_TRUE);
nsXULTemplateBuilder::RemoveGeneratedContent(nsIContent* aElement){    nsresult rv;    // Although we *could* iterate through all the retractions and    // pick them out one-by-one, it turns out that this is pretty    // inefficient. So do the dumb thing and nuke all the content from    // the back to the front.    PRInt32 count;    rv = aElement->ChildCount(count);    if (NS_FAILED(rv)) return rv;    while (--count >= 0) {        nsCOMPtr<nsIContent> child;        rv = aElement->ChildAt(count, *getter_AddRefs(child));        if (NS_FAILED(rv)) return rv;        nsAutoString tmplID;        rv = child->GetAttribute(kNameSpaceID_None, nsXULAtoms::Template, tmplID);        if (NS_FAILED(rv)) return rv;        if (rv != NS_CONTENT_ATTR_HAS_VALUE)            continue;        // It's a generated element. Remove it, and set its document        // to null so that it'll get knocked out of the XUL doc's        // resource-to-element map.        rv = aElement->RemoveChildAt(count, PR_TRUE);        NS_ASSERTION(NS_SUCCEEDED(rv), "error removing child");        rv = child->SetDocument(nsnull, PR_TRUE);        if (NS_FAILED(rv)) return rv;        // Remove this and any children from the content support map.        mContentSupportMap.Remove(child);    }    return NS_OK;}