nsresult rv = mRoot->GetDocument(*getter_AddRefs(doc));
nsresult rv = mRoot->GetDocument(getter_AddRefs(doc));
nsXULTreeBuilder::RebuildAll(){    NS_PRECONDITION(mRoot != nsnull, "not initialized");    if (! mRoot)        return NS_ERROR_NOT_INITIALIZED;    nsCOMPtr<nsIDocument> doc;    nsresult rv = mRoot->GetDocument(*getter_AddRefs(doc));    if (NS_FAILED(rv)) return rv;    // Bail out early if we are being torn down.    if (!doc)        return NS_OK;    if (mBoxObject) {        mBoxObject->BeginUpdateBatch();    }    mRows.Clear();    mConflictSet.Clear();    rv = CompileRules();    if (NS_FAILED(rv)) return rv;    // Seed the rule network with assignments for the tree row    // variable    nsCOMPtr<nsIRDFResource> root;    nsXULContentUtils::GetElementRefResource(mRoot, getter_AddRefs(root));    mRows.SetRootResource(root);#ifdef PR_LOGGING    if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) {        const char* s = "(null)";        if (root)            root->GetValueConst(&s);        PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,               ("xultemplate[%p] root=%s", this, s));    }#endif    if (root)        OpenContainer(-1, root);    if (mBoxObject) {        mBoxObject->EndUpdateBatch();    }    return NS_OK;}