Bug 809533, patch 2: Don't null-check inside NS_New*Frame. r=roc

This commit is contained in:
L. David Baron 2012-11-07 11:55:53 -08:00
parent cbecfc83f0
commit 0f4a543158
6 changed files with 5 additions and 23 deletions

View File

@ -3659,9 +3659,6 @@ nsresult
PresShell::PostReflowCallback(nsIReflowCallback* aCallback)
{
void* result = AllocateMisc(sizeof(nsCallbackEventRequest));
if (MOZ_UNLIKELY(!result)) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCallbackEventRequest* request = (nsCallbackEventRequest*)result;
request->callback = aCallback;

View File

@ -260,9 +260,7 @@ nsIFrame*
NS_NewBlockFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, uint32_t aFlags)
{
nsBlockFrame* it = new (aPresShell) nsBlockFrame(aContext);
if (it) {
it->SetFlags(aFlags);
}
it->SetFlags(aFlags);
return it;
}

View File

@ -160,10 +160,7 @@ nsIFrame*
NS_NewColumnSetFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, uint32_t aStateFlags)
{
nsColumnSetFrame* it = new (aPresShell) nsColumnSetFrame(aContext);
if (it) {
it->AddStateBits(aStateFlags | NS_BLOCK_MARGIN_ROOT);
}
it->AddStateBits(aStateFlags | NS_BLOCK_MARGIN_ROOT);
return it;
}

View File

@ -423,8 +423,6 @@ nsHTMLFramesetFrame::Init(nsIContent* aContent,
// XXX the blank frame is using the content of its parent - at some point it
// should just have null content, if we support that
nsHTMLFramesetBlankFrame* blankFrame = new (shell) nsHTMLFramesetBlankFrame(pseudoStyleContext);
if (!blankFrame)
return NS_ERROR_OUT_OF_MEMORY;
result = blankFrame->Init(mContent, this, nullptr);
if (NS_FAILED(result)) {

View File

@ -71,9 +71,7 @@ NS_NewLineBox(nsIPresShell* aPresShell, nsLineBox* aFromLine,
nsIFrame* aFrame, int32_t aCount)
{
nsLineBox* newLine = new (aPresShell) nsLineBox(aFrame, aCount, false);
if (newLine) {
newLine->NoteFramesMovedFrom(aFromLine);
}
newLine->NoteFramesMovedFrom(aFromLine);
return newLine;
}

View File

@ -153,10 +153,7 @@ nsIFrame*
NS_NewMenuFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
nsMenuFrame* it = new (aPresShell) nsMenuFrame (aPresShell, aContext);
if (it)
it->SetIsMenu(true);
it->SetIsMenu(true);
return it;
}
@ -164,10 +161,7 @@ nsIFrame*
NS_NewMenuItemFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
nsMenuFrame* it = new (aPresShell) nsMenuFrame (aPresShell, aContext);
if (it)
it->SetIsMenu(false);
it->SetIsMenu(false);
return it;
}