Bug 1455811 - ReadableStream.cancel() must cancel the actual download - part 1, r=bkelly
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 24 Apr 2018 16:09:58 +0200
changeset 471447 21d58d5d3819b36a5c7dd8267e9bf1ca96e5ba30
parent 471446 f43030a06c611e2d1d63c646fe72f7fbc757d082
child 471448 1723fb2d2d83a3022daa8ad19efb1c65ca9d895b
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly
bugs1455811
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1455811 - ReadableStream.cancel() must cancel the actual download - part 1, r=bkelly
dom/fetch/FetchStream.cpp
--- a/dom/fetch/FetchStream.cpp
+++ b/dom/fetch/FetchStream.cpp
@@ -261,16 +261,23 @@ FetchStream::CancelCallback(JSContext* a
     // The stream has been used for the first time.
     stream->mStreamHolder->MarkAsRead();
   }
 
   if (stream->mInputStream) {
     stream->mInputStream->CloseWithStatus(NS_BASE_STREAM_CLOSED);
   }
 
+  // It could be that we don't have mInputStream yet, but we still have the
+  // original stream. We need to close that too.
+  if (stream->mOriginalInputStream) {
+    MOZ_ASSERT(!stream->mInputStream);
+    stream->mOriginalInputStream->Close();
+  }
+
   stream->ReleaseObjects();
   return JS::UndefinedValue();
 }
 
 /* static */ void
 FetchStream::ClosedCallback(JSContext* aCx, JS::HandleObject aStream,
                             void* aUnderlyingSource, uint8_t aFlags)
 {