[whatwg/streams] Lookup methods in constructors (#860)

Lookup methods on underlyingSource, underlyingSink and transformer in
the constructor. The main benefit is that identity transforms can be
simply implemented without touching Javascript. Other less critical
optimisation opportunities are unlocked for other stream types.

The algorithm construction for used-supplied methods is changed so that
a different algorithm is constructed depending on whether or not the
method was supplied. Two new abstract operations are added:

* GetMethod works like GetV but throws if the value is neither undefined
  nor a function.
* PromiseInvoke works like PromiseInvokeOrNoop but doesn't check for
  undefined.

PromiseInvokeOrNoop is no longer used and has been removed.

Constructors now throw for invalid method parameters, which results in
some test expectation changes. Changing the methods or prototype on the
underlying object after construction no longer does anything. Other than
these edge cases there are no web-developer visible changes.

Fixes https://github.com/whatwg/streams/issues/691.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Lookup methods in constructors

-- File Changes --

    M reference-implementation/lib/helpers.js (19)
    M reference-implementation/lib/readable-stream.js (40)
    M reference-implementation/lib/transform-stream.js (74)
    M reference-implementation/lib/writable-stream.js (29)
    M reference-implementation/web-platform-tests (2)

-- Patch Links --

https://github.com/whatwg/streams/pull/860.patch
https://github.com/whatwg/streams/pull/860.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/860

Received on Thursday, 30 November 2017 15:05:02 UTC