Bug 1199049 - Part 12: Move the calls on the listener object to OnPreflightFailed(); r=jduell
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 03 Sep 2015 16:17:13 -0400
changeset 294831 b0ee24b21b2ad27962d6affa3ec06c652af68a53
parent 294830 7117493f38b2712ef8d0713a55a44d8a83cb2200
child 294832 03449091a3a3fdad9ed27fa36b4fa56236341604
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjduell
bugs1199049
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1199049 - Part 12: Move the calls on the listener object to OnPreflightFailed(); r=jduell
netwerk/protocol/http/nsCORSListenerProxy.cpp
netwerk/protocol/http/nsHttpChannel.cpp
--- a/netwerk/protocol/http/nsCORSListenerProxy.cpp
+++ b/netwerk/protocol/http/nsCORSListenerProxy.cpp
@@ -1221,18 +1221,16 @@ nsCORSPreflightListener::OnStartRequest(
 
   if (NS_SUCCEEDED(rv)) {
     // Everything worked, try to cache and then fire off the actual request.
     AddResultToCache(aRequest);
 
     mCallback->OnPreflightSucceeded();
   } else {
     mCallback->OnPreflightFailed(rv);
-    mOuterListener->OnStartRequest(mOuterChannel, mOuterContext);
-    mOuterListener->OnStopRequest(mOuterChannel, mOuterContext, rv);
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
 nsCORSPreflightListener::OnStopRequest(nsIRequest *aRequest,
                                        nsISupports *aContext,
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -7010,15 +7010,17 @@ nsHttpChannel::OnPreflightSucceeded()
 
 NS_IMETHODIMP
 nsHttpChannel::OnPreflightFailed(nsresult aError)
 {
     MOZ_ASSERT(mRequireCORSPreflight, "Why did a preflight happen?");
     mIsCorsPreflightDone = 1;
 
     Cancel(aError);
+    mListener->OnStartRequest(this, mListenerContext);
+    mListener->OnStopRequest(this, mListenerContext, aError);
 
     CloseCacheEntry(true);
     return NS_OK;
 }
 
 } // namespace net
 } // namespace mozilla