Index: third_party/WebKit/Source/core/streams/ReadableStreamImpl.h |
diff --git a/third_party/WebKit/Source/core/streams/ReadableStreamImpl.h b/third_party/WebKit/Source/core/streams/ReadableStreamImpl.h |
index b532d3d70dd7a90f598f4e756736f89b714eaf56..970491164ffee08ac695dae9f47137537ae9b944 100644 |
--- a/third_party/WebKit/Source/core/streams/ReadableStreamImpl.h |
+++ b/third_party/WebKit/Source/core/streams/ReadableStreamImpl.h |
@@ -10,6 +10,7 @@ |
#include "bindings/core/v8/ScriptPromiseResolver.h" |
#include "bindings/core/v8/ScriptState.h" |
#include "bindings/core/v8/ScriptValue.h" |
+#include "bindings/core/v8/ToV8.h" |
#include "bindings/core/v8/V8ArrayBuffer.h" |
#include "bindings/core/v8/V8Binding.h" |
#include "bindings/core/v8/V8IteratorResultValue.h" |
@@ -191,6 +192,11 @@ bool ReadableStreamImpl<ChunkTypeTraits>::enqueue(typename ChunkTypeTraits::Pass |
template <typename ChunkTypeTraits> |
ScriptPromise ReadableStreamImpl<ChunkTypeTraits>::read(ScriptState* scriptState) |
{ |
+ if (stateInternal() == Closed) |
+ return ScriptPromise::cast(scriptState, v8IteratorResultDone(scriptState)); |
+ if (stateInternal() == Errored) |
+ return ScriptPromise::reject(scriptState, toV8(storedException(), scriptState->context()->Global(), scriptState->isolate())); |
+ |
ASSERT(stateInternal() == Readable); |
setIsDisturbed(); |
if (m_queue.isEmpty()) { |