Re: [whatwg/streams] "Set totalSize to totalSize + pair.[[size]]." (#582)

> @tschneidereit we haven't explicitly forbidden negative sizes (yet?). We could add a check every time we call the size function, but we don't have one right now. I think most of your pose assumes nonnegative sizes.

I had assumed that mostly because we're throwing a RangeError if any enqueued item has a negative size.

I just realize that `NaN` is the more serious issue: any one item being enqueued can "infect" the queue, and that actually seems like a plausible bug in content code to me. What exactly would be the problem with adding a simple check to `GetTotalQueueSize`? In light of `NaN` perhaps `if (IsFiniteNonNegativeNumber(size)) return size else return 0`.

> I think introducing something like ResetQueue is necessary since otherwise when you empty the queue you could still have a desiredSize of 5.

Agreed.

-- 
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/issues/582#issuecomment-273835704

Received on Thursday, 19 January 2017 17:07:20 UTC