Bug 788275 - Part 0: Make nsCORSListenerProxy's constructor not cause the object to be destroyed before it is constructed; r=bzbarsky

That is always a nice property to have!
This commit is contained in:
Ehsan Akhgari
2012-09-18 22:16:23 -04:00
parent a42f7263ef
commit 6c934f3dff
12 changed files with 59 additions and 91 deletions

View File

@@ -485,10 +485,9 @@ txCompileObserver::startLoad(nsIURI* aUri, txStylesheetCompiler* aCompiler,
parser->Parse(aUri);
// Always install in case of redirects
nsCOMPtr<nsIStreamListener> listener =
new nsCORSListenerProxy(sink, aReferrerPrincipal, channel,
false, &rv);
NS_ENSURE_TRUE(listener, NS_ERROR_OUT_OF_MEMORY);
nsRefPtr<nsCORSListenerProxy> listener =
new nsCORSListenerProxy(sink, aReferrerPrincipal, false);
rv = listener->Init(channel);
NS_ENSURE_SUCCESS(rv, rv);
return channel->AsyncOpen(listener, parser);