Bug 1194891. P2 - don't write any data for a closed stream. draft
authorJW Wang <jwwang@mozilla.com>
Thu, 06 Apr 2017 16:24:44 +0800
changeset 557703 66b817dfa81a7af16d6836fc5cf2658b7afc4ace
parent 557702 6275a979aeaa51a6db3e5770aaa7cc0a78fb641b
child 557704 52bc246fbcee99424dce763600c8722c3bdbc93b
push id52791
push userjwwang@mozilla.com
push dateFri, 07 Apr 2017 06:23:27 +0000
bugs1194891
milestone55.0a1
Bug 1194891. P2 - don't write any data for a closed stream. MozReview-Commit-ID: 3buPoKxVXbH
dom/media/MediaCache.cpp
--- a/dom/media/MediaCache.cpp
+++ b/dom/media/MediaCache.cpp
@@ -1744,16 +1744,20 @@ MediaCacheStream::UpdatePrincipal(nsIPri
 }
 
 void
 MediaCacheStream::NotifyDataReceived(int64_t aSize, const char* aData,
     nsIPrincipal* aPrincipal)
 {
   NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
 
+  if (mClosed) {
+    return;
+  }
+
   // Update principals before putting the data in the cache. This is important,
   // we want to make sure all principals are updated before any consumer
   // can see the new data.
   // We do this without holding the cache monitor, in case the client wants
   // to do something that takes a lock.
   {
     MediaCache::ResourceStreamIterator iter(mResourceID);
     while (MediaCacheStream* stream = iter.Next()) {