(controller, chunk)
| 11652 | ReadableStreamClose(stream4); |
| 11653 | } |
| 11654 | function ReadableByteStreamControllerEnqueue(controller, chunk) { |
| 11655 | const stream4 = controller._controlledReadableByteStream; |
| 11656 | if (controller._closeRequested || stream4._state !== "readable") { |
| 11657 | return; |
| 11658 | } |
| 11659 | const { buffer, byteOffset, byteLength } = chunk; |
| 11660 | if (IsDetachedBuffer(buffer)) { |
| 11661 | throw new TypeError("chunk's buffer is detached and so cannot be enqueued"); |
| 11662 | } |
| 11663 | const transferredBuffer = TransferArrayBuffer(buffer); |
| 11664 | if (controller._pendingPullIntos.length > 0) { |
| 11665 | const firstPendingPullInto = controller._pendingPullIntos.peek(); |
| 11666 | if (IsDetachedBuffer(firstPendingPullInto.buffer)) { |
| 11667 | throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk"); |
| 11668 | } |
| 11669 | ReadableByteStreamControllerInvalidateBYOBRequest(controller); |
| 11670 | firstPendingPullInto.buffer = TransferArrayBuffer(firstPendingPullInto.buffer); |
| 11671 | if (firstPendingPullInto.readerType === "none") { |
| 11672 | ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller, firstPendingPullInto); |
| 11673 | } |
| 11674 | } |
| 11675 | if (ReadableStreamHasDefaultReader(stream4)) { |
| 11676 | ReadableByteStreamControllerProcessReadRequestsUsingQueue(controller); |
| 11677 | if (ReadableStreamGetNumReadRequests(stream4) === 0) { |
| 11678 | ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength); |
| 11679 | } else { |
| 11680 | if (controller._pendingPullIntos.length > 0) { |
| 11681 | ReadableByteStreamControllerShiftPendingPullInto(controller); |
| 11682 | } |
| 11683 | const transferredView = new Uint8Array(transferredBuffer, byteOffset, byteLength); |
| 11684 | ReadableStreamFulfillReadRequest(stream4, transferredView, false); |
| 11685 | } |
| 11686 | } else if (ReadableStreamHasBYOBReader(stream4)) { |
| 11687 | ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength); |
| 11688 | ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller); |
| 11689 | } else { |
| 11690 | ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength); |
| 11691 | } |
| 11692 | ReadableByteStreamControllerCallPullIfNeeded(controller); |
| 11693 | } |
| 11694 | function ReadableByteStreamControllerError(controller, e3) { |
| 11695 | const stream4 = controller._controlledReadableByteStream; |
| 11696 | if (stream4._state !== "readable") { |
no test coverage detected
searching dependent graphs…