(stream, reason)
| 694 | } |
| 695 | |
| 696 | function writableStreamAbort(stream, reason) { |
| 697 | const { |
| 698 | state, |
| 699 | controller, |
| 700 | } = stream[kState]; |
| 701 | if (state === 'closed' || state === 'errored') |
| 702 | return PromiseResolve(); |
| 703 | |
| 704 | controller[kState].abortController.abort(reason); |
| 705 | |
| 706 | if (stream[kState].pendingAbortRequest.abort.promise !== undefined) |
| 707 | return stream[kState].pendingAbortRequest.abort.promise; |
| 708 | |
| 709 | assert(state === 'writable' || state === 'erroring'); |
| 710 | |
| 711 | let wasAlreadyErroring = false; |
| 712 | if (state === 'erroring') { |
| 713 | wasAlreadyErroring = true; |
| 714 | reason = undefined; |
| 715 | } |
| 716 | |
| 717 | const abort = PromiseWithResolvers(); |
| 718 | |
| 719 | stream[kState].pendingAbortRequest = { |
| 720 | abort, |
| 721 | reason, |
| 722 | wasAlreadyErroring, |
| 723 | }; |
| 724 | |
| 725 | if (!wasAlreadyErroring) |
| 726 | writableStreamStartErroring(stream, reason); |
| 727 | |
| 728 | return abort.promise; |
| 729 | } |
| 730 | |
| 731 | function writableStreamClose(stream) { |
| 732 | const { |
no test coverage detected
searching dependent graphs…