gXULUtils->GetElementRefResource(content, getter_AddRefs(resource));
nsXULContentUtils::GetElementRefResource(content, getter_AddRefs(resource));
nsXULTemplateBuilder::ContentTestNode::FilterInstantiations(InstantiationSet& aInstantiations, void* aClosure) const{    nsresult rv;    nsCOMPtr<nsISupportsArray> elements;    rv = NS_NewISupportsArray(getter_AddRefs(elements));    if (NS_FAILED(rv)) return rv;    InstantiationSet::Iterator last = aInstantiations.Last();    for (InstantiationSet::Iterator inst = aInstantiations.First(); inst != last; ++inst) {        Value contentValue;        PRBool hasContentBinding = inst->mAssignments.GetAssignmentFor(mContentVariable, &contentValue);        Value idValue;        PRBool hasIdBinding = inst->mAssignments.GetAssignmentFor(mIdVariable, &idValue);        if (hasContentBinding && hasIdBinding) {            // both are bound, consistency check            PRBool consistent = PR_TRUE;            nsIContent* content = VALUE_TO_ICONTENT(contentValue);            if (mTag) {                // If we're supposed to be checking the tag, do it now.                nsCOMPtr<nsIAtom> tag;                content->GetTag(*getter_AddRefs(tag));                if (tag != mTag)                    consistent = PR_FALSE;            }            if (consistent) {                nsCOMPtr<nsIRDFResource> resource;                gXULUtils->GetElementRefResource(content, getter_AddRefs(resource));                            if (resource.get() != VALUE_TO_IRDFRESOURCE(idValue))                    consistent = PR_FALSE;            }            if (consistent) {                Element* element = new (mConflictSet.GetPool())                    Element(VALUE_TO_ICONTENT(contentValue));                if (! element)                    return NS_ERROR_OUT_OF_MEMORY;                inst->AddSupportingElement(element);            }            else {                aInstantiations.Erase(inst--);            }        }        else if (hasContentBinding) {            // the content node is bound, get its id            PRBool consistent = PR_TRUE;            nsIContent* content = VALUE_TO_ICONTENT(contentValue);            if (mTag) {                // If we're supposed to be checking the tag, do it now.                nsCOMPtr<nsIAtom> tag;                content->GetTag(*getter_AddRefs(tag));                if (tag != mTag)                    consistent = PR_FALSE;            }            if (consistent) {                nsCOMPtr<nsIRDFResource> resource;                gXULUtils->GetElementRefResource(content, getter_AddRefs(resource));                if (NS_FAILED(rv)) return rv;                if (resource) {                    Instantiation newinst = *inst;                    newinst.AddAssignment(mIdVariable, Value(resource.get()));                    Element* element = new (mConflictSet.GetPool())                        Element(VALUE_TO_ICONTENT(contentValue));                    if (! element)                        return NS_ERROR_OUT_OF_MEMORY;                    newinst.AddSupportingElement(element);                    aInstantiations.Insert(inst, newinst);                }            }            aInstantiations.Erase(inst--);        }        else if (hasIdBinding) {            // the 'id' is bound, find elements in the content tree that match            const char* uri;            rv = VALUE_TO_IRDFRESOURCE(idValue)->GetValueConst(&uri);            if (NS_FAILED(rv)) return rv;            rv = mDocument->GetElementsForID(NS_ConvertUTF8toUCS2(uri), elements);            if (NS_FAILED(rv)) return rv;            PRUint32 count;            rv = elements->Count(&count);            if (NS_FAILED(rv)) return rv;            for (PRInt32 j = PRInt32(count) - 1; j >= 0; --j) {                nsISupports* isupports = elements->ElementAt(j);                nsCOMPtr<nsIContent> content = do_QueryInterface(isupports);                NS_IF_RELEASE(isupports);                if (IsElementContainedBy(content, mRoot)) {                    if (mTag) {                        // If we've got a tag, check it to ensure                        // we're consistent.                        nsCOMPtr<nsIAtom> tag;                        content->GetTag(*getter_AddRefs(tag));                        if (tag != mTag)                            continue;                    }                    Instantiation newinst = *inst;                    newinst.AddAssignment(mContentVariable, Value(content.get()));                    Element* element = new (mConflictSet.GetPool()) Element(content);                    if (! element)                        return NS_ERROR_OUT_OF_MEMORY;                    newinst.AddSupportingElement(element);                    aInstantiations.Insert(inst, newinst);                }            }            aInstantiations.Erase(inst--);        }    }    return NS_OK;}