Bug 857102 part 2 - Make NS_NewTextNode and nsIDocument::CreateTextNode infallible; r=bz
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user