Bug 732319. Fix leaks on CORS failures in imagelib. r=joe

This commit is contained in:
Boris Zbarsky 2012-03-02 23:44:55 -05:00
parent ea8d2e3b58
commit a7d0a9267e
3 changed files with 10 additions and 0 deletions

View File

@ -1718,12 +1718,19 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
// request.
nsCOMPtr<nsIStreamListener> listener = pl;
if (corsmode != imgIRequest::CORS_NONE) {
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgLoader::LoadImage -- Setting up a CORS load",
this));
bool withCredentials = corsmode == imgIRequest::CORS_USE_CREDENTIALS;
nsCOMPtr<nsIStreamListener> corsproxy =
new nsCORSListenerProxy(pl, aLoadingPrincipal, newChannel,
withCredentials, &rv);
if (NS_FAILED(rv)) {
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgLoader::LoadImage -- nsCORSListenerProxy "
"creation failed: 0x%x\n", this, rv));
request->CancelAndAbort(rv);
return NS_ERROR_FAILURE;
}

View File

@ -0,0 +1,2 @@
<!DOCTYPE html>
<img crossorigin src="data:a/a,">

View File

@ -25,3 +25,4 @@ HTTP load delayedframe.sjs
load 681190.html
load 694165-1.xhtml
load 732319-1.html