Bug 1398659. P2 - remove the if statement since new() is infallible.
MozReview-Commit-ID: 9GobL4M2mjc
--- a/dom/media/MediaResource.cpp
+++ b/dom/media/MediaResource.cpp
@@ -645,27 +645,27 @@ bool ChannelMediaResource::CanClone()
already_AddRefed<BaseMediaResource>
ChannelMediaResource::CloneData(MediaResourceCallback* aCallback)
{
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
NS_ASSERTION(mCacheStream.IsAvailableForSharing(), "Stream can't be cloned");
RefPtr<ChannelMediaResource> resource =
new ChannelMediaResource(aCallback, nullptr, mURI, mChannelStatistics);
- if (resource) {
- // Initially the clone is treated as suspended by the cache, because
- // we don't have a channel. If the cache needs to read data from the clone
- // it will call CacheClientResume (or CacheClientSeek with aResume true)
- // which will recreate the channel. This way, if all of the media data
- // is already in the cache we don't create an unnecessary HTTP channel
- // and perform a useless HTTP transaction.
- resource->mSuspendAgent.Suspend();
- resource->mCacheStream.InitAsClone(&mCacheStream);
- resource->mChannelStatistics.Stop();
- }
+
+ // Initially the clone is treated as suspended by the cache, because
+ // we don't have a channel. If the cache needs to read data from the clone
+ // it will call CacheClientResume (or CacheClientSeek with aResume true)
+ // which will recreate the channel. This way, if all of the media data
+ // is already in the cache we don't create an unnecessary HTTP channel
+ // and perform a useless HTTP transaction.
+ resource->mSuspendAgent.Suspend();
+ resource->mCacheStream.InitAsClone(&mCacheStream);
+ resource->mChannelStatistics.Stop();
+
return resource.forget();
}
void ChannelMediaResource::CloseChannel()
{
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
mChannelStatistics.Stop();