Bug 1398659. P8 - remove the call to mCacheStream.NotifyDataLength() from OpenChannel(). r=gerald
authorJW Wang <jwwang@mozilla.com>
Thu, 07 Sep 2017 15:23:57 +0800
changeset 662282 9692fc0d793721f8dc2cddf5081dc00dde7dea50
parent 662281 44e400e8dc12a39dc0acdfb7bad79325df6b6b52
child 662283 efd3ef5ae6f93952fbdc0483a5ffe598b321e477
push id79014
push userbmo:bpostelnicu@mozilla.com
push dateMon, 11 Sep 2017 09:58:20 +0000
reviewersgerald
bugs1398659
milestone57.0a1
Bug 1398659. P8 - remove the call to mCacheStream.NotifyDataLength() from OpenChannel(). r=gerald MediaCacheStream::mStreamLength has been set either in Init() or InitAsClone(). MozReview-Commit-ID: L259ecDgjN7
dom/media/MediaResource.cpp
--- a/dom/media/MediaResource.cpp
+++ b/dom/media/MediaResource.cpp
@@ -544,28 +544,16 @@ ChannelMediaResource::Open(nsIStreamList
 
 nsresult
 ChannelMediaResource::OpenChannel()
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(mChannel);
   MOZ_ASSERT(!mListener, "Listener should have been removed by now");
 
-  // Set the content length, if it's available as an HTTP header.
-  // This ensures that MediaResource wrapping objects for platform libraries
-  // that expect to know the length of a resource can get it before
-  // OnStartRequest() fires.
-  nsCOMPtr<nsIHttpChannel> hc = do_QueryInterface(mChannel);
-  if (hc && !IsPayloadCompressed(hc)) {
-    int64_t cl = -1;
-    if (NS_SUCCEEDED(hc->GetContentLength(&cl)) && cl != -1) {
-      mCacheStream.NotifyDataLength(cl);
-    }
-  }
-
   mListener = new Listener(this);
   nsresult rv = mChannel->SetNotificationCallbacks(mListener.get());
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = SetupChannelHeaders();
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = mChannel->AsyncOpen2(mListener);