Bug 1207864 - Fix nsWebBrowserPersist's onStateChange callback in error cases. r=billm, a=lizzard
authorJed Davis <jld@mozilla.com>
Wed, 07 Oct 2015 12:49:53 -0700
changeset 289543 170d90101b72
parent 289542 2f828f5ec27c
child 289544 28efbb818caa
push id5178
push usercbook@mozilla.com
push date2015-10-15 09:17 +0000
treeherdermozilla-beta@b09a797a251b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm, lizzard
bugs1207864
milestone42.0
Bug 1207864 - Fix nsWebBrowserPersist's onStateChange callback in error cases. r=billm, a=lizzard
embedding/components/webbrowserpersist/nsWebBrowserPersist.cpp
--- a/embedding/components/webbrowserpersist/nsWebBrowserPersist.cpp
+++ b/embedding/components/webbrowserpersist/nsWebBrowserPersist.cpp
@@ -2273,29 +2273,29 @@ void
 nsWebBrowserPersist::FinishDownload()
 {
     EndDownload(NS_OK);
 }
 
 void
 nsWebBrowserPersist::EndDownload(nsresult aResult)
 {
+    // Store the error code in the result if it is an error
+    if (NS_SUCCEEDED(mPersistResult) && NS_FAILED(aResult))
+    {
+        mPersistResult = aResult;
+    }
+
     // State stop notification
     if (mProgressListener) {
         mProgressListener->OnStateChange(nullptr, nullptr,
             nsIWebProgressListener::STATE_STOP
             | nsIWebProgressListener::STATE_IS_NETWORK, mPersistResult);
     }
 
-    // Store the error code in the result if it is an error
-    if (NS_SUCCEEDED(mPersistResult) && NS_FAILED(aResult))
-    {
-        mPersistResult = aResult;
-    }
-
     // Do file cleanup if required
     if (NS_FAILED(aResult) && (mPersistFlags & PERSIST_FLAGS_CLEANUP_ON_FAILURE))
     {
         CleanupLocalFiles();
     }
 
     // Cleanup the channels
     mCompleted = true;