bug 450777:deCOMtaminate nsNodeInfoManager::GetNodeInfo r+sr=jst
authorTaras Glek <tglek@mozilla.com>
Fri, 12 Sep 2008 15:32:18 -0700
changeset 19197 ec4733eb1bd808995ee2f6e46e0e1bd738ceb270
parent 19196 a917af161e35234c1cdf354fad0661388dca97a5
child 19198 4dfc88a342b280676e26e841f7600ee0aaf1c6c0
push id2014
push usertglek@mozilla.com
push dateFri, 12 Sep 2008 22:33:54 +0000
treeherdermozilla-central@ec4733eb1bd8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs450777
milestone1.9.1b1pre
bug 450777:deCOMtaminate nsNodeInfoManager::GetNodeInfo r+sr=jst
content/base/public/nsContentUtils.h
content/base/src/nsDOMAttribute.cpp
content/base/src/nsDOMAttributeMap.cpp
content/base/src/nsDOMDocumentType.cpp
content/base/src/nsDocument.cpp
content/base/src/nsDocumentFragment.cpp
content/base/src/nsGenericElement.cpp
content/base/src/nsNodeInfoManager.cpp
content/base/src/nsNodeInfoManager.h
content/base/src/nsNodeUtils.cpp
content/html/content/src/nsHTMLImageElement.cpp
content/html/content/src/nsHTMLOptionElement.cpp
content/html/document/src/nsHTMLContentSink.cpp
content/html/document/src/nsHTMLFragmentContentSink.cpp
content/html/document/src/nsImageDocument.cpp
content/html/document/src/nsMediaDocument.cpp
content/html/document/src/nsPluginDocument.cpp
content/svg/content/src/nsSVGElement.cpp
content/svg/content/src/nsSVGUseElement.cpp
content/xbl/src/nsXBLContentSink.cpp
content/xml/content/src/nsXMLCDATASection.cpp
content/xml/content/src/nsXMLProcessingInstruction.cpp
content/xml/content/src/nsXMLStylesheetPI.cpp
content/xml/document/src/nsXMLContentSink.cpp
content/xml/document/src/nsXMLFragmentContentSink.cpp
content/xslt/src/xslt/txMozillaTextOutput.cpp
content/xslt/src/xslt/txMozillaXMLOutput.cpp
content/xtf/src/nsXTFElementWrapper.cpp
content/xul/content/src/nsXULElement.cpp
content/xul/document/src/nsXULContentSink.cpp
content/xul/document/src/nsXULDocument.cpp
content/xul/document/src/nsXULPrototypeDocument.cpp
content/xul/templates/src/nsXULContentBuilder.cpp
layout/base/nsCSSFrameConstructor.cpp
layout/build/nsContentDLF.cpp
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsFileControlFrame.cpp
layout/forms/nsIsIndexFrame.cpp
layout/forms/nsTextControlFrame.cpp
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsVideoFrame.cpp
layout/xul/base/src/nsDocElementBoxFrame.cpp
--- a/content/base/public/nsContentUtils.h
+++ b/content/base/public/nsContentUtils.h
@@ -687,31 +687,33 @@ public:
    * Convenience method to create a new nodeinfo that differs only by name
    * from aNodeInfo.
    */
   static nsresult NameChanged(nsINodeInfo *aNodeInfo, nsIAtom *aName,
                               nsINodeInfo** aResult)
   {
     nsNodeInfoManager *niMgr = aNodeInfo->NodeInfoManager();
 
-    return niMgr->GetNodeInfo(aName, aNodeInfo->GetPrefixAtom(),
-                              aNodeInfo->NamespaceID(), aResult);
+    *aResult = niMgr->GetNodeInfo(aName, aNodeInfo->GetPrefixAtom(),
+                                  aNodeInfo->NamespaceID()).get();
+    return *aResult ? NS_OK : NS_ERROR_FAILURE;
   }
 
   /**
    * Convenience method to create a new nodeinfo that differs only by prefix
    * from aNodeInfo.
    */
   static nsresult PrefixChanged(nsINodeInfo *aNodeInfo, nsIAtom *aPrefix,
                                 nsINodeInfo** aResult)
   {
     nsNodeInfoManager *niMgr = aNodeInfo->NodeInfoManager();
 
-    return niMgr->GetNodeInfo(aNodeInfo->NameAtom(), aPrefix,
-                              aNodeInfo->NamespaceID(), aResult);
+    *aResult = niMgr->GetNodeInfo(aNodeInfo->NameAtom(), aPrefix,
+                                  aNodeInfo->NamespaceID()).get();
+    return *aResult ? NS_OK : NS_ERROR_FAILURE;
   }
 
   /**
    * Returns the appropriate event argument names for the specified
    * namespace and event name.  Added because we need to switch between
    * SVG's "evt" and the rest of the world's "event", and because onerror
    * takes 3 args.
    */
--- a/content/base/src/nsDOMAttribute.cpp
+++ b/content/base/src/nsDOMAttribute.cpp
@@ -141,20 +141,20 @@ nsDOMAttribute::SetOwnerDocument(nsIDocu
 
   nsIDocument *doc = GetOwnerDoc();
   NS_ASSERTION(doc != aDocument, "bad call to nsDOMAttribute::SetOwnerDocument");
   if (doc) {
     doc->PropertyTable()->DeleteAllPropertiesFor(this);
   }
 
   nsCOMPtr<nsINodeInfo> newNodeInfo;
-  nsresult rv = aDocument->NodeInfoManager()->
+  newNodeInfo = aDocument->NodeInfoManager()->
     GetNodeInfo(mNodeInfo->NameAtom(), mNodeInfo->GetPrefixAtom(),
-                mNodeInfo->NamespaceID(), getter_AddRefs(newNodeInfo));
-  NS_ENSURE_SUCCESS(rv, rv);
+                mNodeInfo->NamespaceID());
+  NS_ENSURE_TRUE(newNodeInfo, NS_ERROR_FAILURE);
   NS_ASSERTION(newNodeInfo, "GetNodeInfo lies");
   mNodeInfo.swap(newNodeInfo);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMAttribute::GetName(nsAString& aName)
--- a/content/base/src/nsDOMAttributeMap.cpp
+++ b/content/base/src/nsDOMAttributeMap.cpp
@@ -379,19 +379,18 @@ nsDOMAttributeMap::Item(PRUint32 aIndex,
 {
   NS_ENSURE_ARG_POINTER(aReturn);
 
   const nsAttrName* name;
   if (mContent && (name = mContent->GetAttrNameAt(aIndex))) {
     // Don't use the nodeinfo even if one exists since it can
     // have the wrong owner document.
     nsCOMPtr<nsINodeInfo> ni;
-    mContent->NodeInfo()->NodeInfoManager()->
-      GetNodeInfo(name->LocalName(), name->GetPrefix(), name->NamespaceID(),
-                  getter_AddRefs(ni));
+    ni = mContent->NodeInfo()->NodeInfoManager()->
+      GetNodeInfo(name->LocalName(), name->GetPrefix(), name->NamespaceID());
     NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
 
     return GetAttribute(ni, aReturn);
   }
 
   *aReturn = nsnull;
 
   return NS_OK;
@@ -449,19 +448,18 @@ nsDOMAttributeMap::GetNamedItemNSInterna
   for (i = 0; i < count; ++i) {
     const nsAttrName* name = mContent->GetAttrNameAt(i);
     PRInt32 attrNS = name->NamespaceID();
     nsIAtom* nameAtom = name->LocalName();
 
     if (nameSpaceID == attrNS &&
         nameAtom->EqualsUTF8(utf8Name)) {
       nsCOMPtr<nsINodeInfo> ni;
-      mContent->NodeInfo()->NodeInfoManager()->
-        GetNodeInfo(nameAtom, name->GetPrefix(), nameSpaceID,
-                    getter_AddRefs(ni));
+      ni = mContent->NodeInfo()->NodeInfoManager()->
+        GetNodeInfo(nameAtom, name->GetPrefix(), nameSpaceID);
       NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
 
       return GetAttribute(ni, aReturn, aRemove);
     }
   }
 
   return NS_OK;
 }
--- a/content/base/src/nsDOMDocumentType.cpp
+++ b/content/base/src/nsDOMDocumentType.cpp
@@ -80,19 +80,19 @@ NS_NewDOMDocumentType(nsIDOMDocumentType
     
     rv = nimgr->Init(nsnull);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nimgr->SetDocumentPrincipal(aPrincipal);
   }
 
   nsCOMPtr<nsINodeInfo> ni;
-  rv = nimgr->GetNodeInfo(nsGkAtoms::documentTypeNodeName, nsnull,
-                          kNameSpaceID_None, getter_AddRefs(ni));
-  NS_ENSURE_SUCCESS(rv, rv);
+  ni = nimgr->GetNodeInfo(nsGkAtoms::documentTypeNodeName, nsnull,
+                          kNameSpaceID_None);
+  NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
 
   *aDocType = new nsDOMDocumentType(ni, aName, aEntities, aNotations,
                                     aPublicId, aSystemId, aInternalSubset);
   if (!*aDocType) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   NS_ADDREF(*aDocType);
@@ -249,37 +249,36 @@ nsDOMDocumentType::BindToTree(nsIDocumen
     // according to the DOM spec, so we need to give them a new nodeinfo in that
     // case.
     // XXX We may want to move this to nsDOMImplementation::CreateDocument if
     //     we want to rely on the nodeinfo and wrappers being right before
     //     getting into doReplaceOrInsertBefore or doInsertChildAt. That would
     //     break inserting DOMDocumentType nodes through other DOM methods
     //     though.
     nsNodeInfoManager *nimgr = aParent ?
-                               aParent->NodeInfo()->NodeInfoManager() :
-                               aDocument->NodeInfoManager();
+      aParent->NodeInfo()->NodeInfoManager() :
+      aDocument->NodeInfoManager();
     nsCOMPtr<nsINodeInfo> newNodeInfo;
-    nsresult rv = nimgr->GetNodeInfo(mNodeInfo->NameAtom(),
+    newNodeInfo = nimgr->GetNodeInfo(mNodeInfo->NameAtom(),
                                      mNodeInfo->GetPrefixAtom(),
-                                     mNodeInfo->NamespaceID(),
-                                     getter_AddRefs(newNodeInfo));
-    NS_ENSURE_SUCCESS(rv, rv);
+                                     mNodeInfo->NamespaceID());
+    NS_ENSURE_TRUE(newNodeInfo, NS_ERROR_FAILURE);
 
     mNodeInfo.swap(newNodeInfo);
 
     nsCOMPtr<nsIDocument> oldOwnerDoc =
       do_QueryInterface(nsContentUtils::GetDocumentFromContext());
     nsIDocument *newOwnerDoc = nimgr->GetDocument();
     if (oldOwnerDoc && newOwnerDoc) {
       nsIXPConnect *xpc = nsContentUtils::XPConnect();
 
       JSContext *cx = nsnull;
       JSObject *oldScope = nsnull, *newScope = nsnull;
-      rv = nsContentUtils::GetContextAndScopes(oldOwnerDoc, newOwnerDoc, &cx,
-                                               &oldScope, &newScope);
+      nsresult rv = nsContentUtils::GetContextAndScopes(oldOwnerDoc, newOwnerDoc, &cx,
+                                                        &oldScope, &newScope);
       if (cx && xpc) {
         nsISupports *node = NS_ISUPPORTS_CAST(nsIContent*, this);
         nsCOMPtr<nsIXPConnectJSObjectHolder> oldWrapper;
         rv = xpc->ReparentWrappedNativeIfFound(cx, oldScope, newScope, node,
                                                getter_AddRefs(oldWrapper));
       }
 
       if (NS_FAILED(rv)) {
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -4442,18 +4442,18 @@ nsDocument::SetTitle(const nsAString& aT
   nsIContent* title = GetTitleContent(nsINode::eHTML);
   if (!title) {
     nsIContent *head = GetHeadContent();
     if (!head)
       return NS_OK;
 
     {
       nsCOMPtr<nsINodeInfo> titleInfo;
-      mNodeInfoManager->GetNodeInfo(nsGkAtoms::title, nsnull,
-              kNameSpaceID_None, getter_AddRefs(titleInfo));
+      titleInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::title, nsnull,
+                                                kNameSpaceID_None);
       if (!titleInfo)
         return NS_OK;
       title = NS_NewHTMLTitleElement(titleInfo);
       if (!title)
         return NS_OK;
     }
 
     head->AppendChildTo(title, PR_TRUE);
@@ -6154,17 +6154,16 @@ nsDocument::RetrieveRelevantHeaders(nsIC
     }
   }
 }
 
 nsresult
 nsDocument::CreateElem(nsIAtom *aName, nsIAtom *aPrefix, PRInt32 aNamespaceID,
                        PRBool aDocumentDefaultType, nsIContent **aResult)
 {
-  nsresult rv;
 #ifdef DEBUG
   nsAutoString qName;
   if (aPrefix) {
     aPrefix->ToString(qName);
     qName.Append(':');
   }
   const char *name;
   aName->GetUTF8String(&name);
@@ -6177,22 +6176,21 @@ nsDocument::CreateElem(nsIAtom *aName, n
   NS_ASSERTION(NS_SUCCEEDED(nsContentUtils::CheckQName(qName, nsAware)),
                "Don't pass invalid prefixes to nsDocument::CreateElem, "
                "check caller.");
 #endif
 
   *aResult = nsnull;
   
   PRInt32 elementType = aDocumentDefaultType ? mDefaultElementType :
-                                               aNamespaceID;
+    aNamespaceID;
 
   nsCOMPtr<nsINodeInfo> nodeInfo;
-  rv = mNodeInfoManager->GetNodeInfo(aName, aPrefix, aNamespaceID,
-                                     getter_AddRefs(nodeInfo));
-  NS_ENSURE_SUCCESS(rv, rv);
+  nodeInfo = mNodeInfoManager->GetNodeInfo(aName, aPrefix, aNamespaceID);
+  NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
 
   return NS_NewElement(aResult, elementType, nodeInfo, PR_FALSE);
 }
 
 PRBool
 nsDocument::IsSafeToFlush() const
 {
   PRBool isSafeToFlush = PR_TRUE;
--- a/content/base/src/nsDocumentFragment.cpp
+++ b/content/base/src/nsDocumentFragment.cpp
@@ -160,21 +160,19 @@ protected:
 
 nsresult
 NS_NewDocumentFragment(nsIDOMDocumentFragment** aInstancePtrResult,
                        nsNodeInfoManager *aNodeInfoManager)
 {
   NS_ENSURE_ARG(aNodeInfoManager);
 
   nsCOMPtr<nsINodeInfo> nodeInfo;
-  nsresult rv =
-    aNodeInfoManager->GetNodeInfo(nsGkAtoms::documentFragmentNodeName,
-                                  nsnull, kNameSpaceID_None,
-                                  getter_AddRefs(nodeInfo));
-  NS_ENSURE_SUCCESS(rv, rv);
+  nodeInfo = aNodeInfoManager->GetNodeInfo(nsGkAtoms::documentFragmentNodeName,
+                                           nsnull, kNameSpaceID_None);
+  NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
 
   nsDocumentFragment *it = new nsDocumentFragment(nodeInfo);
   if (!it) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   NS_ADDREF(*aInstancePtrResult = it);
 
--- a/content/base/src/nsGenericElement.cpp
+++ b/content/base/src/nsGenericElement.cpp
@@ -2989,18 +2989,18 @@ nsGenericElement::GetExistingAttrNameFro
 {
   const nsAttrName* name = InternalGetExistingAttrNameFromQName(aStr);
   if (!name) {
     return nsnull;
   }
 
   nsINodeInfo* nodeInfo;
   if (name->IsAtom()) {
-    mNodeInfo->NodeInfoManager()->GetNodeInfo(name->Atom(), nsnull,
-                                              kNameSpaceID_None, &nodeInfo);
+    nodeInfo = mNodeInfo->NodeInfoManager()->GetNodeInfo(name->Atom(), nsnull,
+                                                         kNameSpaceID_None).get();
   }
   else {
     NS_ADDREF(nodeInfo = name->NodeInfo());
   }
 
   return nodeInfo;
 }
 
@@ -4312,20 +4312,19 @@ nsGenericElement::SetAttrAndNotify(PRInt
     // stuff to nsGenericElement?
     if (!IsAttributeMapped(aName) ||
         !SetMappedAttribute(document, aName, aParsedValue, &rv)) {
       rv = mAttrsAndChildren.SetAndTakeAttr(aName, aParsedValue);
     }
   }
   else {
     nsCOMPtr<nsINodeInfo> ni;
-    rv = mNodeInfo->NodeInfoManager()->GetNodeInfo(aName, aPrefix,
-                                                   aNamespaceID,
-                                                   getter_AddRefs(ni));
-    NS_ENSURE_SUCCESS(rv, rv);
+    ni = mNodeInfo->NodeInfoManager()->GetNodeInfo(aName, aPrefix,
+                                                   aNamespaceID);
+    NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
 
     rv = mAttrsAndChildren.SetAndTakeAttr(ni, aParsedValue);
   }
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (document || HasFlag(NODE_FORCE_XBL_BINDINGS)) {
     nsIDocument* ownerDoc = GetOwnerDoc();
     if (ownerDoc) {
--- a/content/base/src/nsNodeInfoManager.cpp
+++ b/content/base/src/nsNodeInfoManager.cpp
@@ -209,61 +209,60 @@ nsNodeInfoManager::DropDocumentReference
   if (mBindingManager) {
     mBindingManager->DropDocumentReference();
   }
 
   mDocument = nsnull;
 }
 
 
-nsresult
+already_AddRefed<nsINodeInfo>
 nsNodeInfoManager::GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix,
-                               PRInt32 aNamespaceID, nsINodeInfo** aNodeInfo)
+                               PRInt32 aNamespaceID)
 {
-  NS_ENSURE_ARG_POINTER(aName);
+  NS_ENSURE_TRUE(aName, nsnull);
   NS_ASSERTION(!aName->Equals(EmptyString()),
                "Don't pass an empty string to GetNodeInfo, fix caller.");
 
   nsINodeInfo::nsNodeInfoInner tmpKey(aName, aPrefix, aNamespaceID);
 
   void *node = PL_HashTableLookup(mNodeInfoHash, &tmpKey);
 
   if (node) {
-    *aNodeInfo = static_cast<nsINodeInfo *>(node);
+    nsINodeInfo* nodeInfo = static_cast<nsINodeInfo *>(node);
 
-    NS_ADDREF(*aNodeInfo);
+    NS_ADDREF(nodeInfo);
 
-    return NS_OK;
+    return nodeInfo;
   }
 
-  nsNodeInfo *newNodeInfo = nsNodeInfo::Create();
-  NS_ENSURE_TRUE(newNodeInfo, NS_ERROR_OUT_OF_MEMORY);
-
-  NS_ADDREF(newNodeInfo);
-
+  nsRefPtr<nsNodeInfo> newNodeInfo = nsNodeInfo::Create();
+  NS_ENSURE_TRUE(newNodeInfo, nsnull);
+  
   nsresult rv = newNodeInfo->Init(aName, aPrefix, aNamespaceID, this);
-  NS_ENSURE_SUCCESS(rv, rv);
+  NS_ENSURE_SUCCESS(rv, nsnull);
 
   PLHashEntry *he;
   he = PL_HashTableAdd(mNodeInfoHash, &newNodeInfo->mInner, newNodeInfo);
-  NS_ENSURE_TRUE(he, NS_ERROR_OUT_OF_MEMORY);
+  NS_ENSURE_TRUE(he, nsnull);
 
-  *aNodeInfo = newNodeInfo;
+  nsNodeInfo *nodeInfo = nsnull;
+  newNodeInfo.swap(nodeInfo);
 
-  return NS_OK;
+  return nodeInfo;
 }
 
 
 nsresult
 nsNodeInfoManager::GetNodeInfo(const nsAString& aName, nsIAtom *aPrefix,
                                PRInt32 aNamespaceID, nsINodeInfo** aNodeInfo)
 {
   nsCOMPtr<nsIAtom> name = do_GetAtom(aName);
-  return nsNodeInfoManager::GetNodeInfo(name, aPrefix, aNamespaceID,
-                                        aNodeInfo);
+  *aNodeInfo = nsNodeInfoManager::GetNodeInfo(name, aPrefix, aNamespaceID).get();
+  return *aNodeInfo ? NS_OK : NS_ERROR_FAILURE;
 }
 
 
 nsresult
 nsNodeInfoManager::GetNodeInfo(const nsAString& aQualifiedName,
                                const nsAString& aNamespaceURI,
                                nsINodeInfo** aNodeInfo)
 {
@@ -296,53 +295,51 @@ nsNodeInfoManager::GetNodeInfo(const nsA
   PRInt32 nsid = kNameSpaceID_None;
 
   if (!aNamespaceURI.IsEmpty()) {
     nsresult rv = nsContentUtils::NameSpaceManager()->
       RegisterNameSpace(aNamespaceURI, nsid);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
-  return GetNodeInfo(nameAtom, prefixAtom, nsid, aNodeInfo);
+  *aNodeInfo = GetNodeInfo(nameAtom, prefixAtom, nsid).get();
+  return *aNodeInfo ? NS_OK : NS_ERROR_FAILURE;
 }
 
 already_AddRefed<nsINodeInfo>
 nsNodeInfoManager::GetTextNodeInfo()
 {
   if (!mTextNodeInfo) {
-    GetNodeInfo(nsGkAtoms::textTagName, nsnull, kNameSpaceID_None,
-                &mTextNodeInfo);
+    mTextNodeInfo = GetNodeInfo(nsGkAtoms::textTagName, nsnull, kNameSpaceID_None).get();
   }
   else {
     NS_ADDREF(mTextNodeInfo);
   }
 
   return mTextNodeInfo;
 }
 
 already_AddRefed<nsINodeInfo>
 nsNodeInfoManager::GetCommentNodeInfo()
 {
   if (!mCommentNodeInfo) {
-    GetNodeInfo(nsGkAtoms::commentTagName, nsnull, kNameSpaceID_None,
-                &mCommentNodeInfo);
+    mCommentNodeInfo = GetNodeInfo(nsGkAtoms::commentTagName, nsnull, kNameSpaceID_None).get();
   }
   else {
     NS_ADDREF(mCommentNodeInfo);
   }
 
   return mCommentNodeInfo;
 }
 
 already_AddRefed<nsINodeInfo>
 nsNodeInfoManager::GetDocumentNodeInfo()
 {
   if (!mDocumentNodeInfo) {
-    GetNodeInfo(nsGkAtoms::documentNodeName, nsnull, kNameSpaceID_None,
-                &mDocumentNodeInfo);
+    mDocumentNodeInfo = GetNodeInfo(nsGkAtoms::documentNodeName, nsnull, kNameSpaceID_None).get();
   }
   else {
     NS_ADDREF(mDocumentNodeInfo);
   }
 
   return mDocumentNodeInfo;
 }
 
--- a/content/base/src/nsNodeInfoManager.h
+++ b/content/base/src/nsNodeInfoManager.h
@@ -80,18 +80,18 @@ public:
    * Release the reference to the document, this will be called when
    * the document is going away.
    */
   void DropDocumentReference();
 
   /**
    * Methods for creating nodeinfo's from atoms and/or strings.
    */
-  nsresult GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix,
-                       PRInt32 aNamespaceID, nsINodeInfo** aNodeInfo);
+  already_AddRefed<nsINodeInfo> GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix,
+                                            PRInt32 aNamespaceID);
   nsresult GetNodeInfo(const nsAString& aName, nsIAtom *aPrefix,
                        PRInt32 aNamespaceID, nsINodeInfo** aNodeInfo);
   nsresult GetNodeInfo(const nsAString& aQualifiedName,
                        const nsAString& aNamespaceURI,
                        nsINodeInfo** aNodeInfo);
 
   /**
    * Returns the nodeinfo for text nodes. Can return null if OOM.
--- a/content/base/src/nsNodeUtils.cpp
+++ b/content/base/src/nsNodeUtils.cpp
@@ -511,21 +511,20 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNod
 
   nsresult rv;
   nsNodeInfoManager *nodeInfoManager = aNewNodeInfoManager;
 
   // aNode.
   nsINodeInfo *nodeInfo = aNode->mNodeInfo;
   nsCOMPtr<nsINodeInfo> newNodeInfo;
   if (nodeInfoManager) {
-    rv = nodeInfoManager->GetNodeInfo(nodeInfo->NameAtom(),
-                                      nodeInfo->GetPrefixAtom(),
-                                      nodeInfo->NamespaceID(),
-                                      getter_AddRefs(newNodeInfo));
-    NS_ENSURE_SUCCESS(rv, rv);
+    newNodeInfo = nodeInfoManager->GetNodeInfo(nodeInfo->NameAtom(),
+                                               nodeInfo->GetPrefixAtom(),
+                                               nodeInfo->NamespaceID());
+    NS_ENSURE_TRUE(newNodeInfo, NS_ERROR_FAILURE);
 
     nodeInfo = newNodeInfo;
   }
 
   nsGenericElement *elem = aNode->IsNodeOfType(nsINode::eELEMENT) ?
                            static_cast<nsGenericElement*>(aNode) :
                            nsnull;
 
--- a/content/html/content/src/nsHTMLImageElement.cpp
+++ b/content/html/content/src/nsHTMLImageElement.cpp
@@ -157,27 +157,25 @@ protected:
 nsGenericHTMLElement*
 NS_NewHTMLImageElement(nsINodeInfo *aNodeInfo, PRBool aFromParser)
 {
   /*
    * nsHTMLImageElement's will be created without a nsINodeInfo passed in
    * if someone says "var img = new Image();" in JavaScript, in a case like
    * that we request the nsINodeInfo from the document's nodeinfo list.
    */
-  nsresult rv;
   nsCOMPtr<nsINodeInfo> nodeInfo(aNodeInfo);
   if (!nodeInfo) {
     nsCOMPtr<nsIDocument> doc =
       do_QueryInterface(nsContentUtils::GetDocumentFromCaller());
     NS_ENSURE_TRUE(doc, nsnull);
 
-    rv = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::img, nsnull,
-                                             kNameSpaceID_None,
-                                             getter_AddRefs(nodeInfo));
-    NS_ENSURE_SUCCESS(rv, nsnull);
+    nodeInfo = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::img, nsnull,
+                                                   kNameSpaceID_None);
+    NS_ENSURE_TRUE(nodeInfo, nsnull);
   }
 
   return new nsHTMLImageElement(nodeInfo);
 }
 
 nsHTMLImageElement::nsHTMLImageElement(nsINodeInfo *aNodeInfo)
   : nsGenericHTMLElement(aNodeInfo)
 {
--- a/content/html/content/src/nsHTMLOptionElement.cpp
+++ b/content/html/content/src/nsHTMLOptionElement.cpp
@@ -140,27 +140,25 @@ protected:
 nsGenericHTMLElement*
 NS_NewHTMLOptionElement(nsINodeInfo *aNodeInfo, PRBool aFromParser)
 {
   /*
    * nsHTMLOptionElement's will be created without a nsINodeInfo passed in
    * if someone says "var opt = new Option();" in JavaScript, in a case like
    * that we request the nsINodeInfo from the document's nodeinfo list.
    */
-  nsresult rv;
   nsCOMPtr<nsINodeInfo> nodeInfo(aNodeInfo);
   if (!nodeInfo) {
     nsCOMPtr<nsIDocument> doc =
       do_QueryInterface(nsContentUtils::GetDocumentFromCaller());
     NS_ENSURE_TRUE(doc, nsnull);
 
-    rv = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::option, nsnull,
-                                             kNameSpaceID_None,
-                                             getter_AddRefs(nodeInfo));
-    NS_ENSURE_SUCCESS(rv, nsnull);
+    nodeInfo = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::option, nsnull,
+                                                   kNameSpaceID_None);
+    NS_ENSURE_TRUE(nodeInfo, nsnull);
   }
 
   return new nsHTMLOptionElement(nodeInfo);
 }
 
 nsHTMLOptionElement::nsHTMLOptionElement(nsINodeInfo *aNodeInfo)
   : nsGenericHTMLElement(aNodeInfo),
     mSelectedChanged(PR_FALSE),
--- a/content/html/document/src/nsHTMLContentSink.cpp
+++ b/content/html/document/src/nsHTMLContentSink.cpp
@@ -540,32 +540,30 @@ HTMLContentSink::CreateContentObject(con
 
   nsCOMPtr<nsINodeInfo> nodeInfo;
 
   if (aNodeType == eHTMLTag_userdefined) {
     NS_ConvertUTF16toUTF8 tmp(aNode.GetText());
     ToLowerCase(tmp);
 
     nsCOMPtr<nsIAtom> name = do_GetAtom(tmp);
-    mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_None,
-                                  getter_AddRefs(nodeInfo));
+    nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_None);
   }
   else if (mNodeInfoCache[aNodeType]) {
     nodeInfo = mNodeInfoCache[aNodeType];
   }
   else {
     nsIParserService *parserService = nsContentUtils::GetParserService();
     if (!parserService)
       return nsnull;
 
     nsIAtom *name = parserService->HTMLIdToAtomTag(aNodeType);
     NS_ASSERTION(name, "What? Reverse mapping of id to string broken!!!");
 
-    mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_None,
-                                  getter_AddRefs(nodeInfo));
+    nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_None);
     NS_IF_ADDREF(mNodeInfoCache[aNodeType] = nodeInfo);
   }
 
   NS_ENSURE_TRUE(nodeInfo, nsnull);
 
   // Make the content object
   return CreateHTMLElement(aNodeType, nodeInfo, PR_TRUE);
 }
@@ -1699,20 +1697,19 @@ HTMLContentSink::Init(nsIDocument* aDoc,
   }
 
 
   // Changed from 8192 to greatly improve page loading performance on
   // large pages.  See bugzilla bug 77540.
   mMaxTextRun = nsContentUtils::GetIntPref("content.maxtextrun", 8191);
 
   nsCOMPtr<nsINodeInfo> nodeInfo;
-  rv = mNodeInfoManager->GetNodeInfo(nsGkAtoms::html, nsnull,
-                                     kNameSpaceID_None,
-                                     getter_AddRefs(nodeInfo));
-  NS_ENSURE_SUCCESS(rv, rv);
+  nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::html, nsnull,
+                                           kNameSpaceID_None);
+  NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
 
   // Make root part
   nsIContent *doc_root = mDocument->GetRootContent();
 
   if (doc_root) {
     // If the document already has a root we'll use it. This will
     // happen when we do document.open()/.write()/.close()...
 
@@ -1728,20 +1725,19 @@ HTMLContentSink::Init(nsIDocument* aDoc,
 
     NS_ASSERTION(mDocument->GetChildCount() == 0,
                  "Document should have no kids here!");
     rv = mDocument->AppendChildTo(mRoot, PR_FALSE);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   // Make head part
-  rv = mNodeInfoManager->GetNodeInfo(nsGkAtoms::head,
-                                     nsnull, kNameSpaceID_None,
-                                     getter_AddRefs(nodeInfo));
-  NS_ENSURE_SUCCESS(rv, rv);
+  nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::head,
+                                           nsnull, kNameSpaceID_None);
+  NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
 
   mHead = NS_NewHTMLHeadElement(nodeInfo);
   if (NS_FAILED(rv)) {
     MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::Init()\n"));
     MOZ_TIMER_STOP(mWatch);
     return NS_ERROR_OUT_OF_MEMORY;
   }
   NS_ADDREF(mHead);
@@ -2912,18 +2908,17 @@ HTMLContentSink::ProcessLINKTag(const ns
   if (mCurrentContext) {
     parent = mCurrentContext->mStack[mCurrentContext->mStackPos - 1].mContent;
   }
 
   if (parent) {
     // Create content object
     nsCOMPtr<nsIContent> element;
     nsCOMPtr<nsINodeInfo> nodeInfo;
-    mNodeInfoManager->GetNodeInfo(nsGkAtoms::link, nsnull, kNameSpaceID_None,
-                                  getter_AddRefs(nodeInfo));
+    nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::link, nsnull, kNameSpaceID_None);
 
     result = NS_NewHTMLElement(getter_AddRefs(element), nodeInfo, PR_FALSE);
     NS_ENSURE_SUCCESS(result, result);
 
     nsCOMPtr<nsIStyleSheetLinkingElement> ssle(do_QueryInterface(element));
 
     if (ssle) {
       // XXX need prefs. check here.
--- a/content/html/document/src/nsHTMLFragmentContentSink.cpp
+++ b/content/html/document/src/nsHTMLFragmentContentSink.cpp
@@ -415,34 +415,32 @@ nsHTMLFragmentContentSink::OpenContainer
 
     nsCOMPtr<nsINodeInfo> nodeInfo;
 
     if (nodeType == eHTMLTag_userdefined) {
       NS_ConvertUTF16toUTF8 tmp(aNode.GetText());
       ToLowerCase(tmp);
 
       nsCOMPtr<nsIAtom> name = do_GetAtom(tmp);
-      result = mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_None,
-                                             getter_AddRefs(nodeInfo));
-      NS_ENSURE_SUCCESS(result, result);
+      nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_None);
+      NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
     }
     else if (mNodeInfoCache[nodeType]) {
       nodeInfo = mNodeInfoCache[nodeType];
     }
     else {
       nsIParserService* parserService = nsContentUtils::GetParserService();
       if (!parserService)
         return NS_ERROR_OUT_OF_MEMORY;
 
       nsIAtom *name = parserService->HTMLIdToAtomTag(nodeType);
       NS_ASSERTION(name, "This should not happen!");
 
-      result = mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_None,
-                                             getter_AddRefs(nodeInfo));
-      NS_ENSURE_SUCCESS(result, result);
+      nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_None);
+      NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
 
       NS_ADDREF(mNodeInfoCache[nodeType] = nodeInfo);
     }
 
     content = CreateHTMLElement(nodeType, nodeInfo, PR_FALSE).get();
     NS_ENSURE_TRUE(content, NS_ERROR_OUT_OF_MEMORY);
 
     result = AddAttributes(aNode, content);
@@ -518,32 +516,30 @@ nsHTMLFragmentContentSink::AddLeaf(const
 
         nsCOMPtr<nsINodeInfo> nodeInfo;
 
         if (nodeType == eHTMLTag_userdefined) {
           NS_ConvertUTF16toUTF8 tmp(aNode.GetText());
           ToLowerCase(tmp);
 
           nsCOMPtr<nsIAtom> name = do_GetAtom(tmp);
-          result = mNodeInfoManager->GetNodeInfo(name, nsnull,
-                                                 kNameSpaceID_None,
-                                                 getter_AddRefs(nodeInfo));
-          NS_ENSURE_SUCCESS(result, result);
+          nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull,
+                                                   kNameSpaceID_None);
+          NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
         }
         else if (mNodeInfoCache[nodeType]) {
           nodeInfo = mNodeInfoCache[nodeType];
         }
         else {
           nsIAtom *name = parserService->HTMLIdToAtomTag(nodeType);
           NS_ASSERTION(name, "This should not happen!");
 
-          result = mNodeInfoManager->GetNodeInfo(name, nsnull,
-                                                 kNameSpaceID_None,
-                                                 getter_AddRefs(nodeInfo));
-          NS_ENSURE_SUCCESS(result, result);
+          nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull,
+                                                   kNameSpaceID_None);
+          NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
           NS_ADDREF(mNodeInfoCache[nodeType] = nodeInfo);
         }
 
         content = CreateHTMLElement(nodeType, nodeInfo, PR_FALSE);
         NS_ENSURE_TRUE(content, NS_ERROR_OUT_OF_MEMORY);
 
         result = AddAttributes(aNode, content);
         NS_ENSURE_SUCCESS(result, result);
@@ -1174,20 +1170,19 @@ nsHTMLParanoidFragmentSink::AddLeaf(cons
     // We will process base tags, but we won't include them
     // in the output
     if (name == nsGkAtoms::base) {
       nsCOMPtr<nsIContent> content;
       nsCOMPtr<nsINodeInfo> nodeInfo;
       nsIParserService* parserService = nsContentUtils::GetParserService();
       if (!parserService)
         return NS_ERROR_OUT_OF_MEMORY;
-      rv = mNodeInfoManager->GetNodeInfo(name, nsnull,
-                                         kNameSpaceID_None,
-                                         getter_AddRefs(nodeInfo));
-      NS_ENSURE_SUCCESS(rv, rv);
+      nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull,
+                                               kNameSpaceID_None);
+      NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
       rv = NS_NewHTMLElement(getter_AddRefs(content), nodeInfo, PR_FALSE);
       NS_ENSURE_SUCCESS(rv, rv);
       AddAttributes(aNode, content);
       ProcessBaseTag(content);
       return NS_OK;
     }
 
     if (!sAllowedTags || !sAllowedTags->GetEntry(name)) {
--- a/content/html/document/src/nsImageDocument.cpp
+++ b/content/html/document/src/nsImageDocument.cpp
@@ -611,20 +611,19 @@ nsImageDocument::CreateSyntheticDocument
 
   nsIContent* body = GetBodyContent();
   if (!body) {
     NS_WARNING("no body on image document!");
     return NS_ERROR_FAILURE;
   }
 
   nsCOMPtr<nsINodeInfo> nodeInfo;
-  rv = mNodeInfoManager->GetNodeInfo(nsGkAtoms::img, nsnull,
-                                     kNameSpaceID_None,
-                                     getter_AddRefs(nodeInfo));
-  NS_ENSURE_SUCCESS(rv, rv);
+  nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::img, nsnull,
+                                           kNameSpaceID_None);
+  NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
 
   mImageContent = NS_NewHTMLImageElement(nodeInfo);
   if (!mImageContent) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
   nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mImageContent);
   NS_ENSURE_TRUE(imageLoader, NS_ERROR_UNEXPECTED);
 
--- a/content/html/document/src/nsMediaDocument.cpp
+++ b/content/html/document/src/nsMediaDocument.cpp
@@ -228,47 +228,44 @@ nsMediaDocument::StartDocumentLoad(const
 
 nsresult
 nsMediaDocument::CreateSyntheticDocument()
 {
   // Synthesize an empty html document
   nsresult rv;
 
   nsCOMPtr<nsINodeInfo> nodeInfo;
-  rv = mNodeInfoManager->GetNodeInfo(nsGkAtoms::html, nsnull,
-                                     kNameSpaceID_None,
-                                     getter_AddRefs(nodeInfo));
-  NS_ENSURE_SUCCESS(rv, rv);
+  nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::html, nsnull,
+                                           kNameSpaceID_None);
+  NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
 
   nsRefPtr<nsGenericHTMLElement> root = NS_NewHTMLHtmlElement(nodeInfo);
   if (!root) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   NS_ASSERTION(GetChildCount() == 0, "Shouldn't have any kids");
   rv = AppendChildTo(root, PR_FALSE);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = mNodeInfoManager->GetNodeInfo(nsGkAtoms::head, nsnull,
-                                     kNameSpaceID_None,
-                                     getter_AddRefs(nodeInfo));
-  NS_ENSURE_SUCCESS(rv, rv);
+  nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::head, nsnull,
+                                           kNameSpaceID_None);
+  NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
 
   // Create a <head> so our title has somewhere to live
   nsRefPtr<nsGenericHTMLElement> head = NS_NewHTMLHeadElement(nodeInfo);
   if (!head) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   root->AppendChildTo(head, PR_FALSE);
 
-  rv = mNodeInfoManager->GetNodeInfo(nsGkAtoms::body, nsnull,
-                                     kNameSpaceID_None,
-                                     getter_AddRefs(nodeInfo));
-  NS_ENSURE_SUCCESS(rv, rv);
+  nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::body, nsnull,
+                                           kNameSpaceID_None);
+  NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
 
   nsRefPtr<nsGenericHTMLElement> body = NS_NewHTMLBodyElement(nodeInfo);
   if (!body) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   root->AppendChildTo(body, PR_FALSE);
 
--- a/content/html/document/src/nsPluginDocument.cpp
+++ b/content/html/document/src/nsPluginDocument.cpp
@@ -236,20 +236,19 @@ nsPluginDocument::CreateSyntheticPluginD
   // remove margins from body
   NS_NAMED_LITERAL_STRING(zero, "0");
   body->SetAttr(kNameSpaceID_None, nsGkAtoms::marginwidth, zero, PR_FALSE);
   body->SetAttr(kNameSpaceID_None, nsGkAtoms::marginheight, zero, PR_FALSE);
 
 
   // make plugin content
   nsCOMPtr<nsINodeInfo> nodeInfo;
-  rv = mNodeInfoManager->GetNodeInfo(nsGkAtoms::embed, nsnull,
-                                     kNameSpaceID_None,
-                                    getter_AddRefs(nodeInfo));
-  NS_ENSURE_SUCCESS(rv, rv);
+  nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::embed, nsnull,
+                                           kNameSpaceID_None);
+  NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
   rv = NS_NewHTMLElement(getter_AddRefs(mPluginContent), nodeInfo, PR_FALSE);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // make it a named element
   mPluginContent->SetAttr(kNameSpaceID_None, nsGkAtoms::name,
                           NS_LITERAL_STRING("plugin"), PR_FALSE);
 
   // fill viewport and auto-resize
--- a/content/svg/content/src/nsSVGElement.cpp
+++ b/content/svg/content/src/nsSVGElement.cpp
@@ -1109,20 +1109,19 @@ nsSVGElement::AddMappedSVGValue(nsIAtom*
   nsAttrValue attrVal(svg_value);
 
   if (aNamespaceID == kNameSpaceID_None) {
     rv = mMappedAttributes.SetAndTakeAttr(aName, attrVal);
     NS_ENSURE_SUCCESS(rv, rv);
   }
   else {
     nsCOMPtr<nsINodeInfo> ni;
-    rv = mNodeInfo->NodeInfoManager()->GetNodeInfo(aName, nsnull,
-                                                   aNamespaceID,
-                                                   getter_AddRefs(ni));
-    NS_ENSURE_SUCCESS(rv, rv);
+    ni = mNodeInfo->NodeInfoManager()->GetNodeInfo(aName, nsnull,
+                                                   aNamespaceID);
+    NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
 
     rv = mMappedAttributes.SetAndTakeAttr(ni, attrVal);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   return NS_OK;
 }
 
--- a/content/svg/content/src/nsSVGUseElement.cpp
+++ b/content/svg/content/src/nsSVGUseElement.cpp
@@ -316,18 +316,17 @@ nsSVGUseElement::CreateAnonymousContent(
     if (!document)
       return nsnull;
 
     nsNodeInfoManager *nodeInfoManager = document->NodeInfoManager();
     if (!nodeInfoManager)
       return nsnull;
 
     nsCOMPtr<nsINodeInfo> nodeInfo;
-    nodeInfoManager->GetNodeInfo(nsGkAtoms::svg, nsnull, kNameSpaceID_SVG,
-                                 getter_AddRefs(nodeInfo));
+    nodeInfo = nodeInfoManager->GetNodeInfo(nsGkAtoms::svg, nsnull, kNameSpaceID_SVG);
     if (!nodeInfo)
       return nsnull;
 
     nsCOMPtr<nsIContent> svgNode;
     NS_NewSVGSVGElement(getter_AddRefs(svgNode), nodeInfo);
 
     if (!svgNode)
       return nsnull;
--- a/content/xbl/src/nsXBLContentSink.cpp
+++ b/content/xbl/src/nsXBLContentSink.cpp
@@ -941,18 +941,17 @@ nsXBLContentSink::AddAttributesToXULProt
     nsContentUtils::SplitExpatName(aAtts[i * 2], getter_AddRefs(prefix),
                                    getter_AddRefs(localName), &nameSpaceID);
 
     if (nameSpaceID == kNameSpaceID_None) {
       attrs[i].mName.SetTo(localName);
     }
     else {
       nsCOMPtr<nsINodeInfo> ni;
-      mNodeInfoManager->GetNodeInfo(localName, prefix, nameSpaceID,
-                                    getter_AddRefs(ni));
+      ni = mNodeInfoManager->GetNodeInfo(localName, prefix, nameSpaceID);
       attrs[i].mName.SetTo(ni);
     }
     
     rv = aElement->SetAttrAt(i, nsDependentString(aAtts[i * 2 + 1]),
                              mDocumentURI); 
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
--- a/content/xml/content/src/nsXMLCDATASection.cpp
+++ b/content/xml/content/src/nsXMLCDATASection.cpp
@@ -77,20 +77,19 @@ nsresult
 NS_NewXMLCDATASection(nsIContent** aInstancePtrResult,
                       nsNodeInfoManager *aNodeInfoManager)
 {
   NS_PRECONDITION(aNodeInfoManager, "Missing nodeinfo manager");
 
   *aInstancePtrResult = nsnull;
 
   nsCOMPtr<nsINodeInfo> ni;
-  nsresult rv = aNodeInfoManager->GetNodeInfo(nsGkAtoms::cdataTagName,
-                                              nsnull, kNameSpaceID_None,
-                                              getter_AddRefs(ni));
-  NS_ENSURE_SUCCESS(rv, rv);
+  ni = aNodeInfoManager->GetNodeInfo(nsGkAtoms::cdataTagName,
+                                     nsnull, kNameSpaceID_None);
+  NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
 
   nsXMLCDATASection *instance = new nsXMLCDATASection(ni);
   if (!instance) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   NS_ADDREF(*aInstancePtrResult = instance);
 
--- a/content/xml/content/src/nsXMLProcessingInstruction.cpp
+++ b/content/xml/content/src/nsXMLProcessingInstruction.cpp
@@ -53,21 +53,19 @@ NS_NewXMLProcessingInstruction(nsIConten
   if (aTarget.EqualsLiteral("xml-stylesheet")) {
     return NS_NewXMLStylesheetProcessingInstruction(aInstancePtrResult,
                                                     aNodeInfoManager, aData);
   }
 
   *aInstancePtrResult = nsnull;
 
   nsCOMPtr<nsINodeInfo> ni;
-  nsresult rv =
-    aNodeInfoManager->GetNodeInfo(nsGkAtoms::processingInstructionTagName,
-                                  nsnull, kNameSpaceID_None,
-                                  getter_AddRefs(ni));
-  NS_ENSURE_SUCCESS(rv, rv);
+  ni = aNodeInfoManager->GetNodeInfo(nsGkAtoms::processingInstructionTagName,
+                                     nsnull, kNameSpaceID_None);
+  NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
 
   nsXMLProcessingInstruction *instance =
     new nsXMLProcessingInstruction(ni, aTarget, aData);
   if (!instance) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   NS_ADDREF(*aInstancePtrResult = instance);
--- a/content/xml/content/src/nsXMLStylesheetPI.cpp
+++ b/content/xml/content/src/nsXMLStylesheetPI.cpp
@@ -254,21 +254,19 @@ NS_NewXMLStylesheetProcessingInstruction
                                          nsNodeInfoManager *aNodeInfoManager,
                                          const nsAString& aData)
 {
   NS_PRECONDITION(aNodeInfoManager, "Missing nodeinfo manager");
 
   *aInstancePtrResult = nsnull;
   
   nsCOMPtr<nsINodeInfo> ni;
-  nsresult rv =
-    aNodeInfoManager->GetNodeInfo(nsGkAtoms::processingInstructionTagName,
-                                  nsnull, kNameSpaceID_None,
-                                  getter_AddRefs(ni));
-  NS_ENSURE_SUCCESS(rv, rv);
+  ni = aNodeInfoManager->GetNodeInfo(nsGkAtoms::processingInstructionTagName,
+                                     nsnull, kNameSpaceID_None);
+  NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
 
   nsXMLStylesheetPI *instance = new nsXMLStylesheetPI(ni, aData);
   if (!instance) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   NS_ADDREF(*aInstancePtrResult = instance);
 
--- a/content/xml/document/src/nsXMLContentSink.cpp
+++ b/content/xml/document/src/nsXMLContentSink.cpp
@@ -996,19 +996,18 @@ nsXMLContentSink::HandleStartElement(con
   nsContentUtils::SplitExpatName(aName, getter_AddRefs(prefix),
                                  getter_AddRefs(localName), &nameSpaceID);
 
   if (!OnOpenContainer(aAtts, aAttsCount, nameSpaceID, localName, aLineNumber)) {
     return NS_OK;
   }
   
   nsCOMPtr<nsINodeInfo> nodeInfo;
-  result = mNodeInfoManager->GetNodeInfo(localName, prefix, nameSpaceID,
-                                         getter_AddRefs(nodeInfo));
-  NS_ENSURE_SUCCESS(result, result);
+  nodeInfo = mNodeInfoManager->GetNodeInfo(localName, prefix, nameSpaceID);
+  NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
 
   result = CreateElement(aAtts, aAttsCount, nodeInfo, aLineNumber,
                          getter_AddRefs(content), &appendContent);
   NS_ENSURE_SUCCESS(result, result);
 
   // Have to do this before we push the new content on the stack... and have to
   // do that before we set attributes, call BindToTree, etc.  Ideally we'd push
   // on the stack inside CreateElement (which is effectively what the HTML sink
--- a/content/xml/document/src/nsXMLFragmentContentSink.cpp
+++ b/content/xml/document/src/nsXMLFragmentContentSink.cpp
@@ -616,19 +616,18 @@ nsXHTMLParanoidFragmentSink::AddAttribut
   // code get the attributes before this method is called.
   nsTArray<const PRUnichar *> allowedAttrs;
   PRInt32 nameSpaceID;
   nsCOMPtr<nsIAtom> prefix, localName;
   nsCOMPtr<nsINodeInfo> nodeInfo;
   while (*aAtts) {
     nsContentUtils::SplitExpatName(aAtts[0], getter_AddRefs(prefix),
                                    getter_AddRefs(localName), &nameSpaceID);
-    rv = mNodeInfoManager->GetNodeInfo(localName, prefix, nameSpaceID,
-                                       getter_AddRefs(nodeInfo));
-    NS_ENSURE_SUCCESS(rv, rv);
+    nodeInfo = mNodeInfoManager->GetNodeInfo(localName, prefix, nameSpaceID);
+    NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
     // check the attributes we allow that contain URIs
     if (IsAttrURI(nodeInfo->NameAtom())) {
       if (!aAtts[1])
         rv = NS_ERROR_FAILURE;
       if (!baseURI)
         baseURI = aContent->GetBaseURI();
       nsCOMPtr<nsIURI> attrURI;
       rv = NS_NewURI(getter_AddRefs(attrURI), nsDependentString(aAtts[1]),
@@ -665,19 +664,18 @@ nsXHTMLParanoidFragmentSink::HandleStart
   nsContentUtils::SplitExpatName(aName, getter_AddRefs(prefix),
                                  getter_AddRefs(localName), &nameSpaceID);
   
   // If the element is not in the XHTML namespace, bounce it
   if (nameSpaceID != kNameSpaceID_XHTML)
     return NS_OK;
   
   nsCOMPtr<nsINodeInfo> nodeInfo;
-  rv = mNodeInfoManager->GetNodeInfo(localName, prefix, nameSpaceID,
-                                     getter_AddRefs(nodeInfo));
-  NS_ENSURE_SUCCESS(rv, rv);
+  nodeInfo = mNodeInfoManager->GetNodeInfo(localName, prefix, nameSpaceID);
+  NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
   
   // bounce it if it's not on the whitelist or we're inside
   // <script> or <style>
   nsCOMPtr<nsIAtom> name = nodeInfo->NameAtom();
   if (mSkipLevel != 0 ||
       name == nsGkAtoms::script ||
       name == nsGkAtoms::style) {
     ++mSkipLevel; // track this so we don't spew script text
@@ -687,19 +685,18 @@ nsXHTMLParanoidFragmentSink::HandleStart
   if (!sAllowedTags || !sAllowedTags->GetEntry(name))
     return NS_OK;
   
   // It's an allowed element, so let's scrub the attributes
   nsTArray<const PRUnichar *> allowedAttrs;
   for (PRUint32 i = 0; i < aAttsCount; i += 2) {
     nsContentUtils::SplitExpatName(aAtts[i], getter_AddRefs(prefix),
                                    getter_AddRefs(localName), &nameSpaceID);
-    rv = mNodeInfoManager->GetNodeInfo(localName, prefix, nameSpaceID,
-                                       getter_AddRefs(nodeInfo));
-    NS_ENSURE_SUCCESS(rv, rv);
+    nodeInfo = mNodeInfoManager->GetNodeInfo(localName, prefix, nameSpaceID);
+    NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
     
     name = nodeInfo->NameAtom();
     // Add if it's xmlns, xml: or on the HTML whitelist
     if (nameSpaceID == kNameSpaceID_XMLNS ||
         nameSpaceID == kNameSpaceID_XML ||
         (sAllowedAttributes && sAllowedAttributes->GetEntry(name))) {
       allowedAttrs.AppendElement(aAtts[i]);
       allowedAttrs.AppendElement(aAtts[i + 1]);
@@ -712,31 +709,29 @@ nsXHTMLParanoidFragmentSink::HandleStart
                                                  allowedAttrs.Length() - 1,
                                                  aIndex,
                                                  aLineNumber);
 }
 
 NS_IMETHODIMP 
 nsXHTMLParanoidFragmentSink::HandleEndElement(const PRUnichar *aName)
 {
-  nsresult rv;
   PRInt32 nameSpaceID;
   nsCOMPtr<nsIAtom> prefix, localName;
   nsContentUtils::SplitExpatName(aName, getter_AddRefs(prefix),
                                  getter_AddRefs(localName), &nameSpaceID);
   
   // If the element is not in the XHTML namespace, bounce it
   if (nameSpaceID != kNameSpaceID_XHTML) {
     return NS_OK;
   }
   
   nsCOMPtr<nsINodeInfo> nodeInfo;
-  rv = mNodeInfoManager->GetNodeInfo(localName, prefix, nameSpaceID,
-                                     getter_AddRefs(nodeInfo));
-  NS_ENSURE_SUCCESS(rv, rv);
+  nodeInfo = mNodeInfoManager->GetNodeInfo(localName, prefix, nameSpaceID);
+  NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
   
   nsCOMPtr<nsIAtom> name = nodeInfo->NameAtom();
   if (mSkipLevel != 0) {
     --mSkipLevel;
     return NS_OK;
   }
 
   if (!sAllowedTags || !sAllowedTags->GetEntry(name)) {
--- a/content/xslt/src/xslt/txMozillaTextOutput.cpp
+++ b/content/xslt/src/xslt/txMozillaTextOutput.cpp
@@ -283,15 +283,15 @@ void txMozillaTextOutput::getOutputDocum
 
 nsresult
 txMozillaTextOutput::createXHTMLElement(nsIAtom* aName,
                                         nsIContent** aResult)
 {
     *aResult = nsnull;
 
     nsCOMPtr<nsINodeInfo> ni;
-    nsresult rv = mDocument->NodeInfoManager()->
-        GetNodeInfo(aName, nsnull, kNameSpaceID_XHTML, getter_AddRefs(ni));
-    NS_ENSURE_SUCCESS(rv, rv);
+    ni = mDocument->NodeInfoManager()->
+        GetNodeInfo(aName, nsnull, kNameSpaceID_XHTML);
+    NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
 
     return NS_NewHTMLElement(aResult, ni, PR_FALSE);
 }
 
--- a/content/xslt/src/xslt/txMozillaXMLOutput.cpp
+++ b/content/xslt/src/xslt/txMozillaXMLOutput.cpp
@@ -529,19 +529,18 @@ txMozillaXMLOutput::startElementInternal
         return NS_ERROR_OUT_OF_MEMORY;
     }
 
     mTableState = NORMAL;
     mOpenedElementIsHTML = PR_FALSE;
 
     // Create the element
     nsCOMPtr<nsINodeInfo> ni;
-    rv = mNodeInfoManager->GetNodeInfo(aLocalName, aPrefix, aNsID,
-                                       getter_AddRefs(ni));
-    NS_ENSURE_SUCCESS(rv, rv);
+    ni = mNodeInfoManager->GetNodeInfo(aLocalName, aPrefix, aNsID);
+    NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
 
     NS_NewElement(getter_AddRefs(mOpenedElement), aElemType, ni, PR_FALSE);
 
     // Set up the element and adjust state
     if (!mNoFixup) {
         if (aElemType == kNameSpaceID_XHTML) {
             mOpenedElementIsHTML = aNsID != kNameSpaceID_XHTML;
             rv = startHTMLElement(mOpenedElement, mOpenedElementIsHTML);
@@ -962,20 +961,19 @@ txMozillaXMLOutput::createHTMLElement(ns
                                       nsIContent** aResult)
 {
     NS_ASSERTION(mOutputFormat.mMethod == eHTMLOutput,
                  "need to adjust createHTMLElement");
 
     *aResult = nsnull;
 
     nsCOMPtr<nsINodeInfo> ni;
-    nsresult rv = mNodeInfoManager->GetNodeInfo(aName, nsnull,
-                                                kNameSpaceID_None,
-                                                getter_AddRefs(ni));
-    NS_ENSURE_SUCCESS(rv, rv);
+    ni = mNodeInfoManager->GetNodeInfo(aName, nsnull,
+                                       kNameSpaceID_None);
+    NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
 
     return NS_NewHTMLElement(aResult, ni, PR_FALSE);
 }
 
 txTransformNotifier::txTransformNotifier()
     : mPendingStylesheetCount(0),
       mInTransform(PR_FALSE)      
 {
--- a/content/xtf/src/nsXTFElementWrapper.cpp
+++ b/content/xtf/src/nsXTFElementWrapper.cpp
@@ -523,17 +523,17 @@ already_AddRefed<nsINodeInfo>
 nsXTFElementWrapper::GetExistingAttrNameFromQName(const nsAString& aStr) const
 {
   nsINodeInfo* nodeInfo = nsXTFElementWrapperBase::GetExistingAttrNameFromQName(aStr).get();
 
   // Maybe this attribute is handled by our inner element:
   if (!nodeInfo) {
     nsCOMPtr<nsIAtom> nameAtom = do_GetAtom(aStr);
     if (HandledByInner(nameAtom)) 
-      mNodeInfo->NodeInfoManager()->GetNodeInfo(nameAtom, nsnull, kNameSpaceID_None, &nodeInfo);
+      nodeInfo = mNodeInfo->NodeInfoManager()->GetNodeInfo(nameAtom, nsnull, kNameSpaceID_None).get();
   }
   
   return nodeInfo;
 }
 
 PRInt32
 nsXTFElementWrapper::IntrinsicState() const
 {
--- a/content/xul/content/src/nsXULElement.cpp
+++ b/content/xul/content/src/nsXULElement.cpp
@@ -324,24 +324,22 @@ nsXULElement::Create(nsXULPrototypeEleme
     if (! aPrototype)
         return NS_ERROR_NULL_POINTER;
 
     NS_PRECONDITION(aResult != nsnull, "null ptr");
     if (! aResult)
         return NS_ERROR_NULL_POINTER;
 
     nsCOMPtr<nsINodeInfo> nodeInfo;
-    nsresult rv;
     if (aDocument) {
         nsINodeInfo* ni = aPrototype->mNodeInfo;
-        rv = aDocument->NodeInfoManager()->GetNodeInfo(ni->NameAtom(),
-                                                       ni->GetPrefixAtom(),
-                                                       ni->NamespaceID(),
-                                                       getter_AddRefs(nodeInfo));
-        NS_ENSURE_SUCCESS(rv, rv);
+        nodeInfo = aDocument->NodeInfoManager()->GetNodeInfo(ni->NameAtom(),
+                                                             ni->GetPrefixAtom(),
+                                                             ni->NamespaceID());
+        NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
     }
     else {
         nodeInfo = aPrototype->mNodeInfo;
     }
 
     nsRefPtr<nsXULElement> element = Create(aPrototype, nodeInfo,
                                             aIsScriptable);
     if (!element) {
@@ -2697,19 +2695,19 @@ nsXULPrototypeElement::Serialize(nsIObje
     // Write Attributes
     rv |= aStream->Write32(mNumAttributes);
 
     nsAutoString attributeValue;
     PRUint32 i;
     for (i = 0; i < mNumAttributes; ++i) {
         nsCOMPtr<nsINodeInfo> ni;
         if (mAttributes[i].mName.IsAtom()) {
-            mNodeInfo->NodeInfoManager()->
+            ni = mNodeInfo->NodeInfoManager()->
                 GetNodeInfo(mAttributes[i].mName.Atom(), nsnull,
-                            kNameSpaceID_None, getter_AddRefs(ni));
+                            kNameSpaceID_None);
             NS_ASSERTION(ni, "the nodeinfo should already exist");
         }
         else {
             ni = mAttributes[i].mName.NodeInfo();
         }
 
         index = aNodeInfos->IndexOf(ni);
         NS_ASSERTION(index >= 0, "unknown nsINodeInfo index");
--- a/content/xul/document/src/nsXULContentSink.cpp
+++ b/content/xul/document/src/nsXULContentSink.cpp
@@ -473,20 +473,19 @@ XULContentSinkImpl::NormalizeAttributeSt
 
     if (nameSpaceID == kNameSpaceID_None) {
         aName.SetTo(localName);
 
         return NS_OK;
     }
 
     nsCOMPtr<nsINodeInfo> ni;
-    nsresult rv = mNodeInfoManager->GetNodeInfo(localName, prefix,
-                                                nameSpaceID,
-                                                getter_AddRefs(ni));
-    NS_ENSURE_SUCCESS(rv, rv);
+    ni = mNodeInfoManager->GetNodeInfo(localName, prefix,
+                                       nameSpaceID);
+    NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
 
     aName.SetTo(ni);
 
     return NS_OK;
 }
 
 nsresult
 XULContentSinkImpl::CreateElement(nsINodeInfo *aNodeInfo,
@@ -528,20 +527,20 @@ XULContentSinkImpl::HandleStartElement(c
   }
 
   PRInt32 nameSpaceID;
   nsCOMPtr<nsIAtom> prefix, localName;
   nsContentUtils::SplitExpatName(aName, getter_AddRefs(prefix),
                                  getter_AddRefs(localName), &nameSpaceID);
 
   nsCOMPtr<nsINodeInfo> nodeInfo;
-  nsresult rv = mNodeInfoManager->GetNodeInfo(localName, prefix, nameSpaceID,
-                                              getter_AddRefs(nodeInfo));
-  NS_ENSURE_SUCCESS(rv, rv);
-
+  nodeInfo = mNodeInfoManager->GetNodeInfo(localName, prefix, nameSpaceID);
+  NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
+  
+  nsresult rv = NS_OK;
   switch (mState) {
   case eInProlog:
       // We're the root document element
       rv = OpenRoot(aAtts, aAttsCount, nodeInfo);
       break;
 
   case eInDocumentElement:
       rv = OpenTag(aAtts, aAttsCount, aLineNumber, nodeInfo);
--- a/content/xul/document/src/nsXULDocument.cpp
+++ b/content/xul/document/src/nsXULDocument.cpp
@@ -3564,21 +3564,20 @@ nsXULDocument::CreateElementFromPrototyp
         if (NS_FAILED(rv)) return rv;
     }
     else {
         // If it's not a XUL element, it's gonna be heavyweight no matter
         // what. So we need to copy everything out of the prototype
         // into the element.  Get a nodeinfo from our nodeinfo manager
         // for this node.
         nsCOMPtr<nsINodeInfo> newNodeInfo;
-        rv = mNodeInfoManager->GetNodeInfo(aPrototype->mNodeInfo->NameAtom(),
-                                           aPrototype->mNodeInfo->GetPrefixAtom(),
-                                           aPrototype->mNodeInfo->NamespaceID(),
-                                           getter_AddRefs(newNodeInfo));
-        if (NS_FAILED(rv)) return rv;
+        newNodeInfo = mNodeInfoManager->GetNodeInfo(aPrototype->mNodeInfo->NameAtom(),
+                                                    aPrototype->mNodeInfo->GetPrefixAtom(),
+                                                    aPrototype->mNodeInfo->NamespaceID());
+        if (!newNodeInfo) return NS_ERROR_FAILURE;
         rv = NS_NewElement(getter_AddRefs(result), newNodeInfo->NamespaceID(),
                            newNodeInfo, PR_FALSE);
         if (NS_FAILED(rv)) return rv;
 
 #ifdef MOZ_XTF
         if (result && newNodeInfo->NamespaceID() > kNameSpaceID_LastBuiltin) {
             result->BeginAddingChildren();
         }
--- a/content/xul/document/src/nsXULPrototypeDocument.cpp
+++ b/content/xul/document/src/nsXULPrototypeDocument.cpp
@@ -358,20 +358,19 @@ GetNodeInfos(nsXULPrototypeElement* aPro
     }
 
     // Search attributes
     PRUint32 i;
     for (i = 0; i < aPrototype->mNumAttributes; ++i) {
         nsCOMPtr<nsINodeInfo> ni;
         nsAttrName* name = &aPrototype->mAttributes[i].mName;
         if (name->IsAtom()) {
-            rv = aPrototype->mNodeInfo->NodeInfoManager()->
-                GetNodeInfo(name->Atom(), nsnull, kNameSpaceID_None,
-                            getter_AddRefs(ni));
-            NS_ENSURE_SUCCESS(rv, rv);
+            ni = aPrototype->mNodeInfo->NodeInfoManager()->
+                GetNodeInfo(name->Atom(), nsnull, kNameSpaceID_None);
+            NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
         }
         else {
             ni = name->NodeInfo();
         }
 
         if (aArray.IndexOf(ni) < 0) {
             if (!aArray.AppendObject(ni)) {
                 return NS_ERROR_OUT_OF_MEMORY;
--- a/content/xul/templates/src/nsXULContentBuilder.cpp
+++ b/content/xul/templates/src/nsXULContentBuilder.cpp
@@ -1622,18 +1622,17 @@ nsXULContentBuilder::CreateElement(PRInt
     NS_ASSERTION(doc != nsnull, "not initialized");
     if (! doc)
         return NS_ERROR_NOT_INITIALIZED;
 
     nsresult rv;
     nsCOMPtr<nsIContent> result;
 
     nsCOMPtr<nsINodeInfo> nodeInfo;
-    doc->NodeInfoManager()->GetNodeInfo(aTag, nsnull, aNameSpaceID,
-                                        getter_AddRefs(nodeInfo));
+    nodeInfo = doc->NodeInfoManager()->GetNodeInfo(aTag, nsnull, aNameSpaceID);
 
     rv = NS_NewElement(getter_AddRefs(result), aNameSpaceID, nodeInfo,
                        PR_FALSE);
     if (NS_FAILED(rv))
         return rv;
 
     *aResult = result;
     NS_ADDREF(*aResult);
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -1959,19 +1959,18 @@ nsCSSFrameConstructor::CreateGeneratedCo
       // image object
       return nsnull;
     }
     
     // Create an image content object and pass it the image request.
     // XXX Check if it's an image type we can handle...
 
     nsCOMPtr<nsINodeInfo> nodeInfo;
-    mDocument->NodeInfoManager()->GetNodeInfo(nsGkAtoms::mozgeneratedcontentimage, nsnull,
-                                              kNameSpaceID_XHTML,
-                                              getter_AddRefs(nodeInfo));
+    nodeInfo = mDocument->NodeInfoManager()->GetNodeInfo(nsGkAtoms::mozgeneratedcontentimage, nsnull,
+                                                         kNameSpaceID_XHTML);
 
     nsCOMPtr<nsIContent> content;
     NS_NewGenConImageContent(getter_AddRefs(content), nodeInfo,
                              data.mContent.mImage);
     return content.forget();
   }
 
   switch (type) {
@@ -2132,19 +2131,18 @@ nsCSSFrameConstructor::CreateGeneratedCo
                                                      aStyleContext);
   if (!pseudoStyleContext)
     return;
   // |ProbePseudoStyleFor| checked the 'display' property and the
   // |ContentCount()| of the 'content' property for us.
   nsCOMPtr<nsINodeInfo> nodeInfo;
   nsIAtom* elemName = aPseudoElement == nsCSSPseudoElements::before ?
     nsGkAtoms::mozgeneratedcontentbefore : nsGkAtoms::mozgeneratedcontentafter;
-  mDocument->NodeInfoManager()->GetNodeInfo(elemName, nsnull,
-                                            kNameSpaceID_None,
-                                            getter_AddRefs(nodeInfo));
+  nodeInfo = mDocument->NodeInfoManager()->GetNodeInfo(elemName, nsnull,
+                                                       kNameSpaceID_None);
   nsIContent* container;
   nsresult rv = NS_NewXMLElement(&container, nodeInfo);
   if (NS_FAILED(rv))
     return;
   container->SetNativeAnonymous();
   // Transfer ownership to the frame
   aParentFrame->SetProperty(aPseudoElement, container, DestroyContent);
 
--- a/layout/build/nsContentDLF.cpp
+++ b/layout/build/nsContentDLF.cpp
@@ -345,28 +345,25 @@ nsContentDLF::CreateBlankDocument(nsILoa
   if (NS_SUCCEEDED(rv)) {
     rv = NS_ERROR_FAILURE;
 
     nsNodeInfoManager *nim = blankDoc->NodeInfoManager();
 
     nsCOMPtr<nsINodeInfo> htmlNodeInfo;
 
     // generate an html html element
-    nim->GetNodeInfo(nsGkAtoms::html, 0, kNameSpaceID_None,
-                     getter_AddRefs(htmlNodeInfo));
+    htmlNodeInfo = nim->GetNodeInfo(nsGkAtoms::html, 0, kNameSpaceID_None);
     nsCOMPtr<nsIContent> htmlElement = NS_NewHTMLHtmlElement(htmlNodeInfo);
 
     // generate an html head element
-    nim->GetNodeInfo(nsGkAtoms::head, 0, kNameSpaceID_None,
-                     getter_AddRefs(htmlNodeInfo));
+    htmlNodeInfo = nim->GetNodeInfo(nsGkAtoms::head, 0, kNameSpaceID_None);
     nsCOMPtr<nsIContent> headElement = NS_NewHTMLHeadElement(htmlNodeInfo);
 
     // generate an html body element
-    nim->GetNodeInfo(nsGkAtoms::body, 0, kNameSpaceID_None,
-                     getter_AddRefs(htmlNodeInfo));
+    htmlNodeInfo = nim->GetNodeInfo(nsGkAtoms::body, 0, kNameSpaceID_None);
     nsCOMPtr<nsIContent> bodyElement = NS_NewHTMLBodyElement(htmlNodeInfo);
 
     // blat in the structure
     if (htmlElement && headElement && bodyElement) {
       NS_ASSERTION(blankDoc->GetChildCount() == 0,
                    "Shouldn't have children");
       rv = blankDoc->AppendChildTo(htmlElement, PR_FALSE);
       if (NS_SUCCEEDED(rv)) {
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -1040,18 +1040,17 @@ nsComboboxControlFrame::CreateAnonymousC
     mListControlFrame->GetOptionText(mDisplayedIndex, mDisplayedOptionText);
   }
   ActuallyDisplayText(PR_FALSE);
 
   if (!aElements.AppendElement(mDisplayContent))
     return NS_ERROR_OUT_OF_MEMORY;
 
   nsCOMPtr<nsINodeInfo> nodeInfo;
-  nimgr->GetNodeInfo(nsGkAtoms::input, nsnull, kNameSpaceID_None,
-                     getter_AddRefs(nodeInfo));
+  nodeInfo = nimgr->GetNodeInfo(nsGkAtoms::input, nsnull, kNameSpaceID_None);
 
   // create button which drops the list down
   NS_NewHTMLElement(getter_AddRefs(mButtonContent), nodeInfo, PR_FALSE);
   if (!mButtonContent)
     return NS_ERROR_OUT_OF_MEMORY;
 
   // make someone to listen to the button. If its pressed by someone like Accessibility
   // then open or close the combo box.
--- a/layout/forms/nsFileControlFrame.cpp
+++ b/layout/forms/nsFileControlFrame.cpp
@@ -148,19 +148,18 @@ nsFileControlFrame::Destroy()
 
 nsresult
 nsFileControlFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
 {
   // Get the NodeInfoManager and tag necessary to create input elements
   nsCOMPtr<nsIDocument> doc = mContent->GetDocument();
 
   nsCOMPtr<nsINodeInfo> nodeInfo;
-  doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::input, nsnull,
-                                      kNameSpaceID_None,
-                                      getter_AddRefs(nodeInfo));
+  nodeInfo = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::input, nsnull,
+                                                 kNameSpaceID_None);
 
   // Create the text content
   NS_NewHTMLElement(getter_AddRefs(mTextContent), nodeInfo, PR_FALSE);
   if (!mTextContent)
     return NS_ERROR_OUT_OF_MEMORY;
 
   mTextContent->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
                         NS_LITERAL_STRING("text"), PR_FALSE);
--- a/layout/forms/nsIsIndexFrame.cpp
+++ b/layout/forms/nsIsIndexFrame.cpp
@@ -186,18 +186,17 @@ nsresult
 nsIsIndexFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
 {
   // Get the node info manager (used to create hr's and input's)
   nsCOMPtr<nsIDocument> doc = mContent->GetDocument();
   nsNodeInfoManager *nimgr = doc->NodeInfoManager();
 
   // Create an hr
   nsCOMPtr<nsINodeInfo> hrInfo;
-  nimgr->GetNodeInfo(nsGkAtoms::hr, nsnull, kNameSpaceID_None,
-                     getter_AddRefs(hrInfo));
+  hrInfo = nimgr->GetNodeInfo(nsGkAtoms::hr, nsnull, kNameSpaceID_None);
 
   NS_NewHTMLElement(getter_AddRefs(mPreHr), hrInfo, PR_FALSE);
   if (!mPreHr || !aElements.AppendElement(mPreHr))
     return NS_ERROR_OUT_OF_MEMORY;
 
   // Add a child text content node for the label
   NS_NewTextNode(getter_AddRefs(mTextContent), nimgr);
   if (!mTextContent)
@@ -205,18 +204,17 @@ nsIsIndexFrame::CreateAnonymousContent(n
 
   // set the value of the text node and add it to the child list
   UpdatePromptLabel();
   if (!aElements.AppendElement(mTextContent))
     return NS_ERROR_OUT_OF_MEMORY;
 
   // Create text input field
   nsCOMPtr<nsINodeInfo> inputInfo;
-  nimgr->GetNodeInfo(nsGkAtoms::input, nsnull, kNameSpaceID_None,
-                     getter_AddRefs(inputInfo));
+  inputInfo = nimgr->GetNodeInfo(nsGkAtoms::input, nsnull, kNameSpaceID_None);
 
   NS_NewHTMLElement(getter_AddRefs(mInputContent), inputInfo, PR_FALSE);
   if (!mInputContent)
     return NS_ERROR_OUT_OF_MEMORY;
 
   mInputContent->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
                          NS_LITERAL_STRING("text"), PR_FALSE);
 
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -1707,22 +1707,21 @@ nsTextControlFrame::CreateAnonymousConte
     return NS_ERROR_FAILURE;
 
   nsIDocument *doc = shell->GetDocument();
   if (!doc)
     return NS_ERROR_FAILURE;
 
   // Now create a DIV and add it to the anonymous content child list.
   nsCOMPtr<nsINodeInfo> nodeInfo;
-  nsresult rv = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::div, nsnull,
-                                                    kNameSpaceID_XHTML,
-                                                    getter_AddRefs(nodeInfo));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = NS_NewHTMLElement(getter_AddRefs(mAnonymousDiv), nodeInfo, PR_FALSE);
+  nodeInfo = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::div, nsnull,
+                                                 kNameSpaceID_XHTML);
+  NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
+
+  nsresult rv = NS_NewHTMLElement(getter_AddRefs(mAnonymousDiv), nodeInfo, PR_FALSE);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Set the div native anonymous, so CSS will be its style language
   // no matter what.
   mAnonymousDiv->SetNativeAnonymous();
 
   // Set the necessary style attributes on the text control.
 
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -1706,19 +1706,19 @@ nsGfxScrollFrameInner::CreateAnonymousCo
     }
   }
 
   nsresult rv;
 
   nsNodeInfoManager *nodeInfoManager =
     presContext->Document()->NodeInfoManager();
   nsCOMPtr<nsINodeInfo> nodeInfo;
-  rv = nodeInfoManager->GetNodeInfo(nsGkAtoms::scrollbar, nsnull,
-                                    kNameSpaceID_XUL, getter_AddRefs(nodeInfo));
-  NS_ENSURE_SUCCESS(rv, rv);
+  nodeInfo = nodeInfoManager->GetNodeInfo(nsGkAtoms::scrollbar, nsnull,
+                                          kNameSpaceID_XUL);
+  NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
 
   if (canHaveHorizontal) {
     rv = NS_NewElement(getter_AddRefs(mHScrollbarContent),
                        kNameSpaceID_XUL, nodeInfo, PR_FALSE);
     NS_ENSURE_SUCCESS(rv, rv);
     mHScrollbarContent->SetAttr(kNameSpaceID_None, nsGkAtoms::orient,
                                 NS_LITERAL_STRING("horizontal"), PR_FALSE);
     if (!aElements.AppendElement(mHScrollbarContent))
@@ -1731,18 +1731,18 @@ nsGfxScrollFrameInner::CreateAnonymousCo
     NS_ENSURE_SUCCESS(rv, rv);
     mVScrollbarContent->SetAttr(kNameSpaceID_None, nsGkAtoms::orient,
                                 NS_LITERAL_STRING("vertical"), PR_FALSE);
     if (!aElements.AppendElement(mVScrollbarContent))
       return NS_ERROR_OUT_OF_MEMORY;
   }
 
   if (canHaveHorizontal && canHaveVertical) {
-    nodeInfoManager->GetNodeInfo(nsGkAtoms::scrollcorner, nsnull,
-                                 kNameSpaceID_XUL, getter_AddRefs(nodeInfo));
+    nodeInfo = nodeInfoManager->GetNodeInfo(nsGkAtoms::scrollcorner, nsnull,
+                                            kNameSpaceID_XUL);
     rv = NS_NewElement(getter_AddRefs(mScrollCornerContent),
                        kNameSpaceID_XUL, nodeInfo, PR_FALSE);
     NS_ENSURE_SUCCESS(rv, rv);
     if (!aElements.AppendElement(mScrollCornerContent))
       return NS_ERROR_OUT_OF_MEMORY;
   }
 
   return NS_OK;
--- a/layout/generic/nsVideoFrame.cpp
+++ b/layout/generic/nsVideoFrame.cpp
@@ -94,21 +94,21 @@ nsresult
 nsVideoFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
 {
   // Set up "videocontrols" XUL element which will be XBL-bound to the
   // actual controls.
   nsPresContext* presContext = PresContext();
   nsNodeInfoManager *nodeInfoManager =
     presContext->Document()->NodeInfoManager();
   nsCOMPtr<nsINodeInfo> nodeInfo;
-  nsresult rv = nodeInfoManager->GetNodeInfo(nsGkAtoms::videocontrols, nsnull,
-                                             kNameSpaceID_XUL, getter_AddRefs(nodeInfo));
-  NS_ENSURE_SUCCESS(rv, rv);
+  nodeInfo = nodeInfoManager->GetNodeInfo(nsGkAtoms::videocontrols, nsnull,
+                                          kNameSpaceID_XUL);
+  NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
 
-  rv = NS_NewElement(getter_AddRefs(mVideoControls), kNameSpaceID_XUL, nodeInfo, PR_FALSE);
+  nsresult rv = NS_NewElement(getter_AddRefs(mVideoControls), kNameSpaceID_XUL, nodeInfo, PR_FALSE);
   NS_ENSURE_SUCCESS(rv, rv);
   if (!aElements.AppendElement(mVideoControls))
     return NS_ERROR_OUT_OF_MEMORY;
   return NS_OK;
 }
 
 void
 nsVideoFrame::Destroy()
--- a/layout/xul/base/src/nsDocElementBoxFrame.cpp
+++ b/layout/xul/base/src/nsDocElementBoxFrame.cpp
@@ -116,31 +116,30 @@ nsDocElementBoxFrame::CreateAnonymousCon
   if (!doc) {
     // The page is currently being torn down.  Why bother.
     return NS_ERROR_FAILURE;
   }
   nsNodeInfoManager *nodeInfoManager = doc->NodeInfoManager();
 
   // create the top-secret popupgroup node. shhhhh!
   nsCOMPtr<nsINodeInfo> nodeInfo;
-  nsresult rv = nodeInfoManager->GetNodeInfo(nsGkAtoms::popupgroup,
-                                             nsnull, kNameSpaceID_XUL,
-                                             getter_AddRefs(nodeInfo));
-  NS_ENSURE_SUCCESS(rv, rv);
+  nodeInfo = nodeInfoManager->GetNodeInfo(nsGkAtoms::popupgroup,
+                                          nsnull, kNameSpaceID_XUL);
+  NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
 
-  rv = NS_NewXULElement(getter_AddRefs(mPopupgroupContent), nodeInfo);
+  nsresult rv = NS_NewXULElement(getter_AddRefs(mPopupgroupContent), nodeInfo);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!aElements.AppendElement(mPopupgroupContent))
     return NS_ERROR_OUT_OF_MEMORY;
 
   // create the top-secret default tooltip node. shhhhh!
-  rv = nodeInfoManager->GetNodeInfo(nsGkAtoms::tooltip, nsnull,
-                                    kNameSpaceID_XUL, getter_AddRefs(nodeInfo));
-  NS_ENSURE_SUCCESS(rv, rv);
+  nodeInfo = nodeInfoManager->GetNodeInfo(nsGkAtoms::tooltip, nsnull,
+                                          kNameSpaceID_XUL);
+  NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
 
   rv = NS_NewXULElement(getter_AddRefs(mTooltipContent), nodeInfo);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mTooltipContent->SetAttr(nsnull, nsGkAtoms::_default,
                            NS_LITERAL_STRING("true"), PR_FALSE);
 
   if (!aElements.AppendElement(mTooltipContent))