Bug 857102 part 2 - Make NS_NewTextNode and nsIDocument::CreateTextNode infallible; r=bz

This commit is contained in:
Aryeh Gregor
2013-04-04 15:01:08 +03:00
parent 62e6c2fc96
commit fd76179457
26 changed files with 86 additions and 155 deletions

View File

@@ -22,6 +22,7 @@
#include "nsNodeInfoManager.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsContentList.h"
#include "nsTextNode.h"
const nscoord kSuggestedNotSet = -1;
@@ -67,15 +68,12 @@ nsGfxButtonControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements
GetLabel(label);
// Add a child text content node for the label
NS_NewTextNode(getter_AddRefs(mTextContent),
mContent->NodeInfo()->NodeInfoManager());
if (!mTextContent)
return NS_ERROR_OUT_OF_MEMORY;
mTextContent = new nsTextNode(mContent->NodeInfo()->NodeInfoManager());
// set the value of the text node and add it to the child list
mTextContent->SetText(label, false);
if (!aElements.AppendElement(mTextContent))
return NS_ERROR_OUT_OF_MEMORY;
aElements.AppendElement(mTextContent);
return NS_OK;
}