- From: Adam Rice <notifications@github.com>
- Date: Sun, 09 Apr 2017 23:11:44 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 10 April 2017 06:12:16 UTC
ricea commented on this pull request. > @@ -1935,3 +1934,16 @@ function byteStreamControllerBrandCheckException(name) { return new TypeError( `ReadableByteStreamController.prototype.${name} can only be used on a ReadableByteStreamController`); } + +// Helper function for ReadableStream pipeThrough + +function hasPromiseIsHandledInternalSlot(promise) { + try { + // This relies on the brand-check that is enforced by Promise.prototype.then(). As with the rest of the reference + // implementation, it doesn't attempt to do the right thing if someone has modified the global environment. + Promise.prototype.then.call(promise, undefined, () => {}); This is not side-effect free; it marks the promise as handled itself. Calling `then(undefined, undefined)` somehow prevents the promise from subsequently being marked as handled. I don't know whether that is standard behaviour or a bug in V8. In the specific case where we are using it, this doesn't matter, because when this function runs true we always mark the promise as handled anyway. -- 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#pullrequestreview-31761518
Received on Monday, 10 April 2017 06:12:16 UTC