- From: Takeshi Yoshino <notifications@github.com>
- Date: Tue, 24 Jan 2017 01:29:07 -0800
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/streams/pull/655/review/18112923@github.com>
tyoshino commented on this pull request. > 1. Let _controller_ be _stream_.[[writableStreamController]]. 1. Assert: _controller_ is not *undefined*. - 1. If _controller_.[[writing]] is *true* or _controller_.[[inClose]] is *true*, - 1. Set _stream_.[[pendingAbortRequest]] to <a>a new promise</a>. - 1. If _controller_.[[writing]] is *true*, return the result of <a>transforming</a> _stream_.[[pendingAbortRequest]] - with a fulfillment handler that returns ! WritableStreamDefaultControllerAbort(_controller_, _reason_). - 1. Otherwise, return _stream_.[[pendingAbortRequest]]. - 1. Return ! WritableStreamDefaultControllerAbort(_controller_, _reason_). + 1. If _state_ is `"writable"` and ! WritableStreamDefaultControllerGetBackpressure(_stream_.[[writableStreamController]]) is *true*, let _readyPromiseIsPending_ be *true*. Yeah, as it's uncommon idiom, I wondered how it looks to you reviewers. Given that it made you think a bit, I rewrote it by separating it into let and updating statement. I think it's ok. Thanks > 1. Let _controller_ be _stream_.[[writableStreamController]]. - 1. If _controller_ is *undefined*, or both _controller_.[[writing]] and _controller_.[[inClose]] are *false*, - perform ! WritableStreamRejectPromisesInReactionToError(_stream_). - 1. Let _writer_ be _stream_.[[writer]]. - 1. If _writer_ is not undefined, - 1. If _oldState_ is `"writable"` and ! - WritableStreamDefaultControllerGetBackpressure(_stream_.[[writableStreamController]]) is *true*, <a>reject</a> - _writer_.[[readyPromise]] with _e_. - 1. Otherwise, set _writer_.[[readyPromise]] to <a>a promise rejected with</a> _e_. - 1. Set _writer_.[[readyPromise]].[[PromiseIsHandled]] to *true*. + 1. If _wasAborted_ is *false*, return. + 1. Perform ! WritableStreamFinishAbort(_stream_, _state_). + 1. Let _abortRequest_ be _stream_.[[pendingAbortRequest]]. + 1. Set _stream_.[[pendingAbortRequest]] to *undefined*. + 1. Let _promise_ be ! WritableStreamDefaultControllerAbort(_controller_, _abortRequest_.[[reason]]). + 1. Transform _promise_ with a fulfillment handler which takes the argument _result_ and <a>resolves</a> _abortRequest_.[[promise]] with _result_ and a rejection handler which takes the argument _reason_ and <a>rejects</a> _abortRequest_.[[promise]] with _reason_. Good catch! Fixed > + 1. Set _stream_.[[pendingWriteRequest]] to *undefined*. + 1. Let _state_ be _stream_.[[state]]. + 1. If _stream_.[[pendingAbortRequest]] is not *undefined*, let _wasAborted_ be *true*. + 1. Otherwise, let _wasAborted_ be *false*. + 1. If _state_ is `"writable"` and _wasAborted_ is *false* and ! WritableStreamDefaultControllerGetBackpressure(_stream_.[[writableStreamController]]) is *true*, let _readyPromiseIsPending_ be *true*. + 1. Otherwise, let _readyPromiseIsPending_ be *false*. + 1. If _wasAborted_ is *true*, + 1. <a>Reject</a> _stream_.[[pendingAbortRequest]] with _reason_. + 1. Set _stream_.[[pendingAbortRequest]] to *undefined*. + 1. If _state_ is `"errored"`, + 1. Perform ! WritableStreamRejectPromisesInReactionToError(_stream_). + 1. Return. + 1. Set _stream_.[[state]] to `"errored"`. + 1. Set _stream_.[[storedError]] to _reason_. + 1. If _wasAborted_ is *false* and _stream_.[[writer]] is not *undefined*, + 1. WritableStreamDefaultWriterEnsureReadyPromiseRejectedWith(_stream_.[[writer]], _reason_, _readyPromiseIsPending_). Yeah. Moved and added "perform !" > + 1. Let _state_ be _stream_.[[state]]. + 1. If _stream_.[[pendingAbortRequest]] is not *undefined*, let _wasAborted_ be *true*. + 1. Otherwise, let _wasAborted_ be *false*. + 1. If _state_ is `"writable"` and _wasAborted_ is *false* and ! WritableStreamDefaultControllerGetBackpressure(_stream_.[[writableStreamController]]) is *true*, let _readyPromiseIsPending_ be *true*. + 1. Otherwise, let _readyPromiseIsPending_ be *false*. + 1. If _wasAborted_ is *true*, + 1. <a>Reject</a> _stream_.[[pendingAbortRequest]] with _reason_. + 1. Set _stream_.[[pendingAbortRequest]] to *undefined*. + 1. If _state_ is `"errored"`, + 1. Perform ! WritableStreamRejectClosedPromiseIfAny(_stream_). + 1. Return. + 1. Assert: _state_ is `"closing"`. + 1. Set _stream_.[[state]] to `"errored"`. + 1. Set _stream_.[[storedError]] to _reason_. + 1. If _wasAborted_ is *false* and _stream_.[[writer]] is not *undefined*, + 1. WritableStreamDefaultWriterEnsureReadyPromiseRejectedWith(_stream_.[[writer]], _reason_, _readyPromiseIsPending_). done -- 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/655
Received on Tuesday, 24 January 2017 09:29:45 UTC