[whatwg/streams] Use Promise.prototype.then brand check to detect real Promise (#730)

ReadableStream pipeTo() was using instanceof to distinguish Promises from
non-promises. However, this can be fooled by Object.create(Promise). Use
the brand-check performed by Promise.prototype.then() for the check instead.

The test for this is in https://github.com/w3c/web-platform-tests/pull/5519.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Use Promise.prototype.then brand check to detect real Promise

-- File Changes --

    M reference-implementation/lib/readable-stream.js (16)
    M reference-implementation/web-platform-tests (2)

-- Patch Links --

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

Received on Monday, 10 April 2017 06:09:28 UTC