Bug 839261 - 'Assertion failure: false (Remote blob didn
authorBen Turner <bent.mozilla@gmail.com>
Fri, 15 Feb 2013 13:39:43 -0800
changeset 131947 4d6beb1fff45ef80c99183ecde31bb3701fe64be
parent 131946 fe1923122c44219e0d3483de2974d61c79ecbf44
child 131948 f1b4f443548dce0b45648e53d5322e2bd176e98b
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs839261
milestone21.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 839261 - 'Assertion failure: false (Remote blob didn 't return a remote stream)'. r=sicking.
dom/ipc/Blob.cpp
--- a/dom/ipc/Blob.cpp
+++ b/dom/ipc/Blob.cpp
@@ -1291,35 +1291,37 @@ Blob<Parent>::RecvPBlobStreamConstructor
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(mBlob);
   MOZ_ASSERT(!mRemoteBlob);
 
   nsCOMPtr<nsIInputStream> stream;
   nsresult rv = mBlob->GetInternalStream(getter_AddRefs(stream));
   NS_ENSURE_SUCCESS(rv, false);
 
-  nsCOMPtr<nsIIPCSerializableInputStream> serializableStream;
+  nsCOMPtr<nsIRemoteBlob> remoteBlob = do_QueryInterface(mBlob);
 
-  nsCOMPtr<nsIRemoteBlob> remoteBlob = do_QueryInterface(mBlob);
+  nsCOMPtr<IPrivateRemoteInputStream> remoteStream;
   if (remoteBlob) {
-    // Sanity check that the remote blob returned a remote stream.
-    nsCOMPtr<IPrivateRemoteInputStream> remoteStream =
-      do_QueryInterface(stream);
-    if (!remoteStream) {
-      MOZ_ASSERT(false, "Remote blob didn't return a remote stream!");
-      return false;
-    }
+    remoteStream = do_QueryInterface(stream);
   }
 
-  // If the underlying blob is not a remote blob or it is a remote blob
-  // representing this actor then we can use the internal stream that it
-  // provides. Otherwise we need to be on a background thread before we can
-  // get to the real stream.
+  // There are three cases in which we can use the stream obtained from the blob
+  // directly as our serialized stream:
+  //
+  //   1. The blob is not a remote blob.
+  //   2. The blob is a remote blob that represents this actor.
+  //   3. The blob is a remote blob representing a different actor but we
+  //      already have a non-remote, i.e. serialized, serialized stream.
+  //
+  // In all other cases we need to be on a background thread before we can get
+  // to the real stream.
+  nsCOMPtr<nsIIPCSerializableInputStream> serializableStream;
   if (!remoteBlob ||
-      static_cast<ProtocolType*>(remoteBlob->GetPBlob()) == this) {
+      static_cast<ProtocolType*>(remoteBlob->GetPBlob()) == this ||
+      !remoteStream) {
     serializableStream = do_QueryInterface(stream);
     if (!serializableStream) {
       MOZ_ASSERT(false, "Must be serializable!");
       return false;
     }
   }
 
   nsCOMPtr<nsIEventTarget> target =