if (domparent) {    nsAutoString value; rv = element->GetAttribute(kNameSpaceID_None, kCommandUpdaterAtom, value); if ((rv == NS_CONTENT_ATTR_HAS_VALUE) && value.Equals("true")) { rv = gXULUtils->SetCommandUpdater(mDocument, element); if (NS_FAILED(rv)) return rv; } }
XULContentSinkImpl::OpenOverlayTag(const nsIParserNode& aNode, PRInt32 aNameSpaceID, nsIAtom* aTag){    nsresult rv;    if ((aNameSpaceID == kNameSpaceID_HTML) && (aTag == kScriptAtom)) {        // Oops, it's a script!        return OpenScript(aNode);    }    // First, see if the element is already in the tree. If so, we can    // do _immediate_ hookup.    nsAutoString id;    rv = GetXULIDAttribute(aNode, id);    if (NS_FAILED(rv)) return rv;    if (id.Length() == 0) {        // XXX We will probably get our context stack screwed up        // because we haven't pushed something here...        PR_LOG(gLog, PR_LOG_ALWAYS,               ("xul: overlay element at line %d has no 'id' attribute",                aNode.GetSourceLineNumber()));        return NS_OK;    }    nsCOMPtr<nsIDOMXULDocument> domxuldoc = do_QueryInterface(mDocument);    if (! domxuldoc)        return NS_ERROR_UNEXPECTED;    nsCOMPtr<nsIDOMElement> domparent;    rv = domxuldoc->GetElementById(id, getter_AddRefs(domparent));    if (NS_FAILED(rv)) return rv;    nsCOMPtr<nsIContent> element;    if (domparent) {        // Great, the element was already in the content model. We'll        // just hook it up.        element = do_QueryInterface(domparent);        NS_ASSERTION(element != nsnull, "element is not an nsIContent");        if (! element)            return NS_ERROR_UNEXPECTED;    }    else {        // Create a dummy element that we can throw some attributes        // and children onto.        nsCOMPtr<nsIXMLContent> xml;        rv = gXMLElementFactory->CreateInstanceByTag(nsAutoString("overlay"), getter_AddRefs(xml));        NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create overlay element");        if (NS_FAILED(rv)) return rv;        element = do_QueryInterface(xml);        NS_ASSERTION(element != nsnull, "xml element is not an nsIXMLContent");        if (! xml)            return NS_ERROR_UNEXPECTED;        // Initialize the overlay element        rv = element->SetDocument(mDocument, PR_FALSE);        if (NS_FAILED(rv)) return rv;                    // Set up namespace junk so that subsequent parsing won't        // freak out.        nsCOMPtr<nsINameSpace> ns;        rv = GetTopNameSpace(&ns);        if (NS_FAILED(rv)) return rv;                    rv = xml->SetContainingNameSpace(ns);        if (NS_FAILED(rv)) return rv;        OverlayForwardReference* fwdref = new OverlayForwardReference(element);        if (! fwdref)            return NS_ERROR_OUT_OF_MEMORY;        nsCOMPtr<nsIXULDocument> xuldoc = do_QueryInterface(mDocument);        if (! xuldoc)            return NS_ERROR_UNEXPECTED;        // transferring ownership to ya...        rv = xuldoc->AddForwardReference(fwdref);        if (NS_FAILED(rv)) return rv;        // No match, just push the overlay element onto the context        // stack so we have somewhere to hang its child nodes off'n.    }    // Add the attributes    rv = AddAttributes(aNode, element);    if (NS_FAILED(rv)) return rv;    // Push the element onto the context stack, so that child    // containers will hook up to us as their parent.    rv = mContextStack.Push(element, mState);    if (NS_FAILED(rv)) return rv;    mState = eInDocumentElement;    return NS_OK;}