[whatwg/streams] Execute strategySize first in write() (#680)

A strategy size() function can re-entrantly call controller, writer or writable
methods, leaving the stream in an unexpected state. To ensure predictable
behaviour, call size() before observing or modifying any state.

Previously, if size() threw an exception, writer.write() would reject with that
exception. After this change, it rejects with a TypeError instead.

Changes to the standard text are currently missing.
You can view, comment on, or merge this pull request online at:

  https://github.com/whatwg/streams/pull/680

-- Commit Summary --

  * Execute strategySize first in write()

-- File Changes --

    M reference-implementation/lib/writable-stream.js (54)
    M reference-implementation/web-platform-tests (2)

-- Patch Links --

https://github.com/whatwg/streams/pull/680.patch
https://github.com/whatwg/streams/pull/680.diff

-- 
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/680

Received on Friday, 10 February 2017 10:46:14 UTC