Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(584)

Unified Diff: third_party/WebKit/Source/core/streams/ReadableStreamImpl.h

Issue 1418813004: [Fetch API] Reflect spec changes of bodyUsed property (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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()) {

Powered by Google App Engine
This is Rietveld 408576698