Bug 688154 - Remove return value (and |new| success-checking) from NewRequestAndEntry (imgLoader.cpp); r=jrmuizel

This commit is contained in:
Ms2ger 2011-10-01 18:14:40 +02:00
parent 3225e81aff
commit 6f88b35b18

View File

@ -397,23 +397,13 @@ nsProgressNotificationProxy::GetInterface(const nsIID& iid,
return NS_NOINTERFACE;
}
static bool NewRequestAndEntry(bool forcePrincipalCheckForCacheEntry,
imgRequest **request, imgCacheEntry **entry)
static void NewRequestAndEntry(bool aForcePrincipalCheckForCacheEntry,
imgRequest **aRequest, imgCacheEntry **aEntry)
{
*request = new imgRequest();
if (!*request)
return PR_FALSE;
*entry = new imgCacheEntry(*request, forcePrincipalCheckForCacheEntry);
if (!*entry) {
delete *request;
return PR_FALSE;
}
NS_ADDREF(*request);
NS_ADDREF(*entry);
return PR_TRUE;
nsRefPtr<imgRequest> request = new imgRequest();
nsRefPtr<imgCacheEntry> entry = new imgCacheEntry(request, aForcePrincipalCheckForCacheEntry);
request.forget(aRequest);
entry.forget(aEntry);
}
static bool ShouldRevalidateEntry(imgCacheEntry *aEntry,
@ -1697,9 +1687,8 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
if (!NewRequestAndEntry(forcePrincipalCheck, getter_AddRefs(request),
getter_AddRefs(entry)))
return NS_ERROR_OUT_OF_MEMORY;
NewRequestAndEntry(forcePrincipalCheck, getter_AddRefs(request),
getter_AddRefs(entry));
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgLoader::LoadImage -- Created new imgRequest [request=%p]\n", this, request.get()));
@ -1902,9 +1891,7 @@ NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgIDecoderOb
// Default to doing a principal check because we don't know who
// started that load and whether their principal ended up being
// inherited on the channel.
if (!NewRequestAndEntry(PR_TRUE, getter_AddRefs(request),
getter_AddRefs(entry)))
return NS_ERROR_OUT_OF_MEMORY;
NewRequestAndEntry(PR_TRUE, getter_AddRefs(request), getter_AddRefs(entry));
// We use originalURI here to fulfil the imgIRequest contract on GetURI.
nsCOMPtr<nsIURI> originalURI;