From 4be6fd1ff79ec26934b816e31c08a97cafaff38b Mon Sep 17 00:00:00 2001 From: isonmad Date: Thu, 22 Sep 2016 02:29:15 +0000 Subject: [PATCH] Add asserts to ReadableStreamDefaultController These asserts are in ReadableByteStreamController, so they should be here too. --- index.bs | 2 ++ reference-implementation/lib/readable-stream.js | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/index.bs b/index.bs index 6d93db3a2..2d1feaf79 100644 --- a/index.bs +++ b/index.bs @@ -1446,6 +1446,8 @@ ReadableStreamDefaultController(stream, underlyingSource, 1. Resolve _startResult_ as a promise: 1. Upon fulfillment, 1. Set _controller_.[[started]] to *true*. + 1. Assert: _controller_.[[pulling]] is *false*. + 1. Assert: _controller_.[[pullAgain]] is *false*. 1. Perform ! ReadableStreamDefaultControllerCallPullIfNeeded(_controller_). 1. Upon rejection with reason _r_, 1. Perform ! ReadableStreamDefaultControllerErrorIfNeeded(_controller_, _r_). diff --git a/reference-implementation/lib/readable-stream.js b/reference-implementation/lib/readable-stream.js index e7e40cfac..05e1e78f2 100644 --- a/reference-implementation/lib/readable-stream.js +++ b/reference-implementation/lib/readable-stream.js @@ -976,6 +976,10 @@ class ReadableStreamDefaultController { Promise.resolve(startResult).then( () => { controller._started = true; + + assert(controller._pulling === false); + assert(controller._pullAgain === false); + ReadableStreamDefaultControllerCallPullIfNeeded(controller); }, r => {