Bug 1411745 - crash for svg linking to mailbox URI. r=smaug a=gchang
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Sat, 09 Dec 2017 16:43:16 +0200
changeset 445372 d16cbfcbb8993d8831b6a0c0c1a7d55db1720e34
parent 445371 fd1e2b98664abc89da68d53da72cf57fb69f88aa
child 445373 2c6da9d74cdaea33f7f4d9d1b5574f4bb687e191
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, gchang
bugs1411745
milestone58.0
Bug 1411745 - crash for svg linking to mailbox URI. r=smaug a=gchang
dom/base/nsDocument.cpp
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -1228,17 +1228,18 @@ nsExternalResourceMap::PendingLoad::Setu
 
 NS_IMETHODIMP
 nsExternalResourceMap::PendingLoad::OnDataAvailable(nsIRequest* aRequest,
                                                     nsISupports* aContext,
                                                     nsIInputStream* aStream,
                                                     uint64_t aOffset,
                                                     uint32_t aCount)
 {
-  NS_PRECONDITION(mTargetListener, "Shouldn't be getting called!");
+  // mTargetListener might be null if SetupViewer or AddExternalResource failed.
+  NS_ENSURE_TRUE(mTargetListener, NS_ERROR_FAILURE);
   if (mDisplayDocument->ExternalResourceMap().HaveShutDown()) {
     return NS_BINDING_ABORTED;
   }
   return mTargetListener->OnDataAvailable(aRequest, aContext, aStream, aOffset,
                                           aCount);
 }
 
 NS_IMETHODIMP