Bug 489830 - Make MediaListener's mNextListener assertion a non-fatal error to avoid crashing in the face of a listener that breaks nsIRequest's contract. r+sr=roc
authorMatthew Gregan <kinetik@flim.org>
Tue, 05 May 2009 18:13:26 +1200
changeset 27985 26e323fea0081e698132bab52971a797b4b796d7
parent 27984 7ef08c5305178d97b2c4a80ace60aa63731a4211
child 27986 42dd384c9c57507c9ae29838e4fe492117b94c99
push id6826
push usermgregan@mozilla.com
push dateTue, 05 May 2009 07:28:31 +0000
treeherdermozilla-central@26e323fea008 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs489830
milestone1.9.2a1pre
Bug 489830 - Make MediaListener's mNextListener assertion a non-fatal error to avoid crashing in the face of a listener that breaks nsIRequest's contract. r+sr=roc
content/html/content/src/nsHTMLMediaElement.cpp
--- a/content/html/content/src/nsHTMLMediaElement.cpp
+++ b/content/html/content/src/nsHTMLMediaElement.cpp
@@ -240,17 +240,20 @@ NS_IMETHODIMP nsHTMLMediaElement::MediaL
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP nsHTMLMediaElement::MediaLoadListener::OnDataAvailable(nsIRequest* aRequest, nsISupports* aContext,
                                                                        nsIInputStream* aStream, PRUint32 aOffset,
                                                                        PRUint32 aCount)
 {
-  NS_ABORT_IF_FALSE(mNextListener, "Must have a listener");
+  if (!mNextListener) {
+    NS_ERROR("Must have a chained listener; OnStartRequest should have canceled this request");
+    return NS_BINDING_ABORTED;
+  }
   return mNextListener->OnDataAvailable(aRequest, aContext, aStream, aOffset, aCount);
 }
 
 NS_IMPL_ADDREF_INHERITED(nsHTMLMediaElement, nsGenericHTMLElement)
 NS_IMPL_RELEASE_INHERITED(nsHTMLMediaElement, nsGenericHTMLElement)
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLMediaElement)