From a55842a3e8127a3c1579230f0c97144293cae3fe Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Thu, 2 Apr 2015 14:54:45 -0700 Subject: [PATCH] Bug 1147946, part 6 - Remove some useless null checks on infallible new in XULContentSinkImpl. r=baku --- dom/xul/nsXULContentSink.cpp | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/dom/xul/nsXULContentSink.cpp b/dom/xul/nsXULContentSink.cpp index 2209151a3d95..74dd0675efbb 100644 --- a/dom/xul/nsXULContentSink.cpp +++ b/dom/xul/nsXULContentSink.cpp @@ -81,12 +81,10 @@ nsresult XULContentSinkImpl::ContextStack::Push(nsXULPrototypeNode* aNode, State aState) { Entry* entry = new Entry; - if (! entry) - return NS_ERROR_OUT_OF_MEMORY; - entry->mNode = aNode; entry->mState = aState; entry->mNext = mTop; + mTop = entry; ++mDepth; @@ -388,9 +386,6 @@ XULContentSinkImpl::FlushText(bool aCreateTextNode) break; nsXULPrototypeText* text = new nsXULPrototypeText(); - if (! text) - return NS_ERROR_OUT_OF_MEMORY; - text->mValue.Assign(mText, mTextLength); if (stripWhitespace) text->mValue.Trim(" \t\n\r"); @@ -440,11 +435,8 @@ XULContentSinkImpl::CreateElement(mozilla::dom::NodeInfo *aNodeInfo, nsXULPrototypeElement** aResult) { nsXULPrototypeElement* element = new nsXULPrototypeElement(); - if (! element) - return NS_ERROR_OUT_OF_MEMORY; - element->mNodeInfo = aNodeInfo; - + *aResult = element; return NS_OK; } @@ -636,9 +628,6 @@ XULContentSinkImpl::HandleProcessingInstruction(const char16_t *aTarget, // Note: the created nsXULPrototypePI has mRefCnt == 1 nsRefPtr pi = new nsXULPrototypePI(); - if (!pi) - return NS_ERROR_OUT_OF_MEMORY; - pi->mTarget = target; pi->mData = data; @@ -923,8 +912,6 @@ XULContentSinkImpl::OpenScript(const char16_t** aAttributes, globalObject = do_QueryInterface(doc->GetWindow()); nsRefPtr script = new nsXULPrototypeScript(aLineNumber, version); - if (! script) - return NS_ERROR_OUT_OF_MEMORY; // If there is a SRC attribute... if (! src.IsEmpty()) { @@ -988,8 +975,6 @@ XULContentSinkImpl::AddAttributes(const char16_t** aAttributes, nsXULPrototypeAttribute* attrs = nullptr; if (aAttrLen > 0) { attrs = new nsXULPrototypeAttribute[aAttrLen]; - if (! attrs) - return NS_ERROR_OUT_OF_MEMORY; } aElement->mAttributes = attrs;