From 8c313db5c7192e3275d45318b30d0368b642fb97 Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Wed, 2 Mar 2016 18:51:33 +0100 Subject: [PATCH] Bug 1252839 - Remove some if stmt after allocation with 'new' - patch 2, r=bz --- xpfe/appshell/nsAppShellService.cpp | 5 ----- xpfe/appshell/nsChromeTreeOwner.cpp | 2 -- xpfe/appshell/nsWindowMediator.cpp | 2 -- xpfe/appshell/nsXULWindow.cpp | 6 ------ xpfe/components/directory/nsDirectoryViewer.cpp | 3 --- 5 files changed, 18 deletions(-) diff --git a/xpfe/appshell/nsAppShellService.cpp b/xpfe/appshell/nsAppShellService.cpp index f87b9f6a7f52..cd0acb338281 100644 --- a/xpfe/appshell/nsAppShellService.cpp +++ b/xpfe/appshell/nsAppShellService.cpp @@ -512,10 +512,6 @@ nsAppShellService::CreateWindowlessBrowser(bool aIsChrome, nsIWindowlessBrowser * of nsIWebBrowserChrome2. */ RefPtr stub = new WebBrowserChrome2Stub(); - if (!stub) { - NS_ERROR("Couldn't create instance of WebBrowserChrome2Stub!"); - return NS_ERROR_FAILURE; - } browser->SetContainerWindow(stub); nsCOMPtr navigation = do_QueryInterface(browser); @@ -642,7 +638,6 @@ nsAppShellService::JustCreateTopWindow(nsIXULWindow *aParent, parent = aParent; RefPtr window = new nsWebShellWindow(aChromeMask); - NS_ENSURE_TRUE(window, NS_ERROR_OUT_OF_MEMORY); #ifdef XP_WIN // If the parent is currently fullscreen, tell the child to ignore persisted diff --git a/xpfe/appshell/nsChromeTreeOwner.cpp b/xpfe/appshell/nsChromeTreeOwner.cpp index b5182535a7ee..22e7dbc6bd04 100644 --- a/xpfe/appshell/nsChromeTreeOwner.cpp +++ b/xpfe/appshell/nsChromeTreeOwner.cpp @@ -63,8 +63,6 @@ nsChromeTreeOwner::InitGlobals() { NS_ASSERTION(gLiterals == nullptr, "already initialized"); gLiterals = new nsChromeTreeOwnerLiterals(); - if (!gLiterals) - return NS_ERROR_OUT_OF_MEMORY; return NS_OK; } diff --git a/xpfe/appshell/nsWindowMediator.cpp b/xpfe/appshell/nsWindowMediator.cpp index 05874b479dd4..6d69bc764541 100644 --- a/xpfe/appshell/nsWindowMediator.cpp +++ b/xpfe/appshell/nsWindowMediator.cpp @@ -90,8 +90,6 @@ NS_IMETHODIMP nsWindowMediator::RegisterWindow(nsIXULWindow* inWindow) // Create window info struct and add to list of windows nsWindowInfo* windowInfo = new nsWindowInfo(inWindow, mTimeStamp); - if (!windowInfo) - return NS_ERROR_OUT_OF_MEMORY; WindowTitleData winData = { inWindow, nullptr }; mListeners.EnumerateForwards(notifyOpenWindow, &winData); diff --git a/xpfe/appshell/nsXULWindow.cpp b/xpfe/appshell/nsXULWindow.cpp index 650c454ea5ca..d45cafeae29c 100644 --- a/xpfe/appshell/nsXULWindow.cpp +++ b/xpfe/appshell/nsXULWindow.cpp @@ -968,8 +968,6 @@ NS_IMETHODIMP nsXULWindow::EnsureChromeTreeOwner() return NS_OK; mChromeTreeOwner = new nsChromeTreeOwner(); - NS_ENSURE_TRUE(mChromeTreeOwner, NS_ERROR_OUT_OF_MEMORY); - NS_ADDREF(mChromeTreeOwner); mChromeTreeOwner->XULWindow(this); @@ -982,8 +980,6 @@ NS_IMETHODIMP nsXULWindow::EnsureContentTreeOwner() return NS_OK; mContentTreeOwner = new nsContentTreeOwner(false); - NS_ENSURE_TRUE(mContentTreeOwner, NS_ERROR_FAILURE); - NS_ADDREF(mContentTreeOwner); mContentTreeOwner->XULWindow(this); @@ -996,8 +992,6 @@ NS_IMETHODIMP nsXULWindow::EnsurePrimaryContentTreeOwner() return NS_OK; mPrimaryContentTreeOwner = new nsContentTreeOwner(true); - NS_ENSURE_TRUE(mPrimaryContentTreeOwner, NS_ERROR_FAILURE); - NS_ADDREF(mPrimaryContentTreeOwner); mPrimaryContentTreeOwner->XULWindow(this); diff --git a/xpfe/components/directory/nsDirectoryViewer.cpp b/xpfe/components/directory/nsDirectoryViewer.cpp index 5449fc170e6d..8c6603eab698 100644 --- a/xpfe/components/directory/nsDirectoryViewer.cpp +++ b/xpfe/components/directory/nsDirectoryViewer.cpp @@ -651,9 +651,6 @@ nsHTTPIndex::Create(nsIURI* aBaseURL, nsIInterfaceRequestor* aRequestor, *aResult = nullptr; nsHTTPIndex* result = new nsHTTPIndex(aRequestor); - if (! result) - return NS_ERROR_OUT_OF_MEMORY; - nsresult rv = result->Init(aBaseURL); if (NS_SUCCEEDED(rv)) {