Bug 732178. Set up the image cache validator before the CORS listener. r=joe,sicking
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 02 Mar 2012 00:13:54 -0500
changeset 91013 593ae548729340f0242f98468a6823acde8da0d1
parent 91012 c30b6943dc98e8b2d24f76fba20764eefbfb109a
child 91014 b1eb49737d05a4d89ac681a91fa0075a7846829c
push id783
push userlsblakk@mozilla.com
push dateTue, 24 Apr 2012 17:33:42 +0000
treeherdermozilla-beta@11faed19f136 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjoe, sicking
bugs732178
milestone13.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 732178. Set up the image cache validator before the CORS listener. r=joe,sicking
image/src/imgLoader.cpp
--- a/image/src/imgLoader.cpp
+++ b/image/src/imgLoader.cpp
@@ -1281,29 +1281,32 @@ bool imgLoader::ValidateRequestWithNewCh
     if (!progressproxy)
       return false;
 
     nsRefPtr<imgCacheValidator> hvc =
       new imgCacheValidator(progressproxy, request, aCX, forcePrincipalCheck);
 
     nsCOMPtr<nsIStreamListener> listener = hvc.get();
 
+    // We must set the notification callbacks before setting up the
+    // CORS listener, because that's also interested inthe
+    // notification callbacks.
+    newChannel->SetNotificationCallbacks(hvc);
+
     if (aCORSMode != imgIRequest::CORS_NONE) {
       bool withCredentials = aCORSMode == imgIRequest::CORS_USE_CREDENTIALS;
       nsCOMPtr<nsIStreamListener> corsproxy =
         new nsCORSListenerProxy(hvc, aLoadingPrincipal, newChannel, withCredentials, &rv);
       if (NS_FAILED(rv)) {
         return false;
       }
 
       listener = corsproxy;
     }
 
-    newChannel->SetNotificationCallbacks(hvc);
-
     request->mValidator = hvc;
 
     imgRequestProxy* proxy = static_cast<imgRequestProxy*>
                                (static_cast<imgIRequest*>(req.get()));
 
     // We will send notifications from imgCacheValidator::OnStartRequest().
     // In the mean time, we must defer notifications because we are added to
     // the imgRequest's proxy list, and we can get extra notifications