bug 1113065 - spdy should not close session on imglib error r=bagder r=seth
authorPatrick McManus <mcmanus@ducksong.com>
Mon, 22 Dec 2014 11:03:05 -0500
changeset 247787 dc7317efb518884b0774ddbc9ff882784e9ff410
parent 247786 c61b88b3479a7356136fe0916c6e5df8e00e67ff
child 247788 636498d041b548b37c8b30b27d702852fb0064de
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbagder, seth
bugs1113065
milestone37.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 1113065 - spdy should not close session on imglib error r=bagder r=seth
image/src/imgRequest.cpp
netwerk/protocol/http/ASpdySession.h
--- a/image/src/imgRequest.cpp
+++ b/image/src/imgRequest.cpp
@@ -926,17 +926,17 @@ imgRequest::OnDataAvailable(nsIRequest *
       // Notify listeners that we have an image.
       nsRefPtr<ProgressTracker> progressTracker = GetProgressTracker();
       progressTracker->OnImageAvailable();
 
       if (mImage->HasError() && !mIsMultiPartChannel) { // Probably bad mimetype
         // We allow multipart images to fail to initialize without cancelling the
         // load because subsequent images might be fine; thus only single part
         // images end up here.
-        this->Cancel(NS_ERROR_FAILURE);
+        this->Cancel(NS_IMAGELIB_ERROR_FAILURE);
         return NS_BINDING_ABORTED;
       }
 
       NS_ABORT_IF_FALSE(progressTracker->HasImage(), "Status tracker should have an image!");
       NS_ABORT_IF_FALSE(mImage, "imgRequest should have an image!");
 
       if (mDecodeRequested)
         mImage->StartDecoding();
--- a/netwerk/protocol/http/ASpdySession.h
+++ b/netwerk/protocol/http/ASpdySession.h
@@ -45,22 +45,36 @@ public:
   const static uint32_t kTCPSendBufferSize = 131072;
 
   // until we have an API that can push back on receiving data (right now
   // WriteSegments is obligated to accept data and buffer) there is no
   // reason to throttle with the rwin other than in server push
   // scenarios.
   const static uint32_t kInitialRwin = 256 * 1024 * 1024;
 
+  // soft errors are errors that terminate a stream without terminating the
+  // connection. In general non-network errors are stream errors as well
+  // as network specific items like cancels.
   bool SoftStreamError(nsresult code)
   {
     if (NS_SUCCEEDED(code)) {
       return false;
     }
 
+    // this could go either way, but because there are network instances of
+    // it being a hard error we should consider it hard.
+    if (code == NS_ERROR_FAILURE) {
+      return false;
+    }
+
+    if (NS_ERROR_GET_MODULE(code) != NS_ERROR_MODULE_NETWORK) {
+      return true;
+    }
+
+    // these are network specific soft errors
     return (code == NS_BASE_STREAM_CLOSED || code == NS_BINDING_FAILED ||
             code == NS_BINDING_ABORTED || code == NS_BINDING_REDIRECTED ||
             code == NS_ERROR_INVALID_CONTENT_ENCODING ||
             code == NS_BINDING_RETARGETED || code == NS_ERROR_CORRUPTED_CONTENT);
   }
 };
 
 typedef bool (*ALPNCallback) (nsISupports *); // nsISSLSocketControl is typical