Bug 1194891. P2 - don't write any data for a closed stream.
MozReview-Commit-ID: 3buPoKxVXbH
--- 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()) {