Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1870,7 +1870,9 @@ has the following [=struct/items=]:
exception.
1. If [=this=].[=ReadableByteStreamController/[[stream]]=].[=ReadableStream/[[state]]=] is not
"`readable`", throw a {{TypeError}} exception.
1. Perform ? [$ReadableByteStreamControllerClose$]([=this=]).
1. Perform ! [$ReadableByteStreamControllerClose$]([=this=]).
1. If [=this=].[=ReadableByteStreamController/[[stream]]=].[=ReadableStream/[[state]]=] is
"`errored`", throw [=this=].[=ReadableByteStreamController/[[stream]]=].[=ReadableStream/[[storedError]]=].
</div>

<div algorithm>
Expand Down Expand Up @@ -2573,7 +2575,9 @@ create them does not matter.
[$ReadableByteStreamControllerClose$](|otherBranch|.[=ReadableStream/[[controller]]=]).
1. If |chunk| is not undefined,
1. Assert: |chunk|.\[[ByteLength]] is 0.
1. If |byobCanceled| is false, perform !
1. If |byobCanceled| is false and
|byobBranch|.[=ReadableStream/[[controller]]=].[=ReadableByteStreamController/[[pendingPullIntos]]=]
is not [=list/is empty|empty=], perform !
[$ReadableByteStreamControllerRespondWithNewView$](|byobBranch|.[=ReadableStream/[[controller]]=],
|chunk|).
1. If |otherCanceled| is false and
Expand Down Expand Up @@ -3249,7 +3253,7 @@ The following abstract operations support the implementation of the
by |firstPendingPullInto|'s [=pull-into descriptor/element size=] is not 0,
1. Let |e| be a new {{TypeError}} exception.
1. Perform ! [$ReadableByteStreamControllerError$](|controller|, |e|).
1. Throw |e|.
1. Return.
1. Perform ! [$ReadableByteStreamControllerClearAlgorithms$](|controller|).
1. Perform ! [$ReadableStreamClose$](|stream|).
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ exports.implementation = class ReadableByteStreamControllerImpl {
}

aos.ReadableByteStreamControllerClose(this);

if (this._stream._state === 'errored') {
throw this._stream._storedError;
}
}

enqueue(chunk) {
Expand Down
4 changes: 2 additions & 2 deletions reference-implementation/lib/abstract-ops/readable-streams.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ function ReadableByteStreamTee(stream) {
if (chunk !== undefined) {
assert(chunk.byteLength === 0);

if (byobCanceled === false) {
if (byobCanceled === false && byobBranch._controller._pendingPullIntos.length > 0) {
ReadableByteStreamControllerRespondWithNewView(byobBranch._controller, chunk);
}
if (otherCanceled === false && otherBranch._controller._pendingPullIntos.length > 0) {
Expand Down Expand Up @@ -1276,7 +1276,7 @@ function ReadableByteStreamControllerClose(controller) {
const e = new TypeError('Insufficient bytes to fill elements in the given buffer');
ReadableByteStreamControllerError(controller, e);

throw e;
return;
}
}

Expand Down
Loading