pendingRead may be null when returning pendingRead.promise. Use local
authorTakeshi Yoshino <tyoshino@google.com>
Tue, 28 Jan 2014 14:42:50 +0900
changeset 136 351c58f63ce5
parent 135 8bc65bdf4605
child 137 142342673c3f
pendingRead may be null when returning pendingRead.promise. Use local
variable readPromise and return it
Overview.htm
--- a/Overview.htm	Tue Jan 28 14:38:48 2014 +0900
+++ b/Overview.htm	Tue Jan 28 14:42:50 2014 +0900
@@ -814,19 +814,21 @@
 
 							<li>If <a>pendingRead</a> is not <code>null</code>, return a <a>Promise</a> rejected with an "<code><a>InvalidStateError</a></code>"</li>
 
+							<li>Let <var>readPromise</var> be a newly-created <a>Promise</a></li>
+
 							<li>Set <a>pendingRead</a> to a newly-created <a>PendingReadDescriptor</a></li>
 
 							<li>Set <a>pendingRead</a>.<var>binaryAs</var> to the current value of <a href="#widl-ReadableStream-readBinaryAs">readBinaryAs</a></li>
 							<li>Set <a>pendingRead</a>.<var>encoding</var> to the current value of <a href="#widl-ReadableStream-readEncoding">readEncoding</a></li>
 							<li>Set <a>pendingRead</a>.<var>size</var> to <var>size</var></li>
-							<li>Set <a>pendingRead</a>.<var>promise</var> to a newly-created <a>Promise</a></li>
+							<li>Set <a>pendingRead</a>.<var>promise</var> to <var>readPromise</var></li>
 
 							<li>Set <a>readUpToPullAmount</a> to <var>size</var></li>
 							<li>Set <a>amountBeingReturned</a> to 0</li>
 
 							<li><a>Retrieve data</a></li>
 
-							<li>Return <a>pendingRead</a>.<var>promise</var></li>
+							<li>Return <var>readPromise</var></li>
 						</ol>
 					</p>
 
@@ -858,18 +860,20 @@
 						<ol>
 							<li>If <a>pendingRead</a> is not <code>null</code>, return a Promise reject with an "<code><a>InvalidStateError</a></code>"</li>
 
+							<li>Let <var>readPromise</var> be a newly-created <a>Promise</a></li>
+
 							<li>Set <a>pendingRead</a> to a newly-created <a>PendingReadDescriptor</a></li>
 
 							<li>Set <a>pendingRead</a>.<var>binaryAs</var> to the current value of <a href="#widl-ReadableStream-readBinaryAs">readBinaryAs</a></li>
 							<li>Set <a>pendingRead</a>.<var>encoding</var> to the current value of <a href="#widl-ReadableStream-readEncoding">readEncoding</a></li>
 							<li>Set <a>pendingRead</a>.<var>size</var> to <code>undefined</code></li>
-							<li>Set <a>pendingRead</a>.<var>promise</var> to a newly-created <a>Promise</a></li>
+							<li>Set <a>pendingRead</a>.<var>promise</var> to <var>readPromise</var></li>
 
 							<li>Set <a>amountBeingReturned</a> to 0</li>
 
 							<li><a>Retrieve data</a></li>
 
-							<li>Return <a>pendingRead</a>.<var>promise</var></li>
+							<li>Return <var>readPromise</var></li>
 						</ol>
 					</p>