Re: [whatwg/streams] Fix queue total size tracking logic (#661)

ricea commented on this pull request.



>  
 <emu-alg>
-  1. Assert: _queue_ is not empty.
-  1. Let _pair_ be the first element of _queue_.
-  1. Remove _pair_ from _queue_, shifting all other elements downward (so that the second becomes the first, and so on).
+  1. Assert: _container_ has [[queue]] and [[queueTotalSize]] internal slots.
+  1. Assert: _container_.[[queue]] is not empty.
+  1. Let _pair_ be the first element of _container_.[[queue]].
+  1. Remove _pair_ from _container_.[[queue]], shifting all other elements downward (so that the second becomes the
+     first, and so on).
+  1. Set _container_.[[queueTotalSize]] to _container_.[[queueTotalSize]] − _pair_.[[size]].
+  1. If _container_.[[queueTotalSize]] < *0*, set _container_.[[queueTotalSize]] to *0*. (This can occur due to
+     floating-point arithmetic.)

Optional: "rounding errors" rather than "floating-point arithmetic".

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/661#pullrequestreview-21705387

Received on Tuesday, 14 February 2017 09:20:29 UTC