Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix assertion failure in RespondInternal after transferring array buffer in RespondWithNewView #1174

Merged
merged 10 commits into from
Oct 12, 2021
3 changes: 2 additions & 1 deletion index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -3489,9 +3489,10 @@ The following abstract operations support the implementation of the
|view|.\[[ViewedArrayBuffer]].\[[ByteLength]], throw a {{RangeError}} exception.
1. If |firstDescriptor|'s [=pull-into descriptor/bytes filled=] + |view|.\[[ByteLength]] >
|firstDescriptor|'s [=pull-into descriptor/byte length=], throw a {{RangeError}} exception.
1. Let |viewByteLength| be |view|.\[[ByteLength]].
1. Set |firstDescriptor|'s [=pull-into descriptor/buffer=] to ?
[$TransferArrayBuffer$](|view|.\[[ViewedArrayBuffer]]).
1. Perform ? [$ReadableByteStreamControllerRespondInternal$](|controller|, |view|.\[[ByteLength]]).
1. Perform ? [$ReadableByteStreamControllerRespondInternal$](|controller|, |viewByteLength|).
</div>

<div algorithm>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1634,9 +1634,11 @@ function ReadableByteStreamControllerRespondWithNewView(controller, view) {
throw new RangeError('The region specified by view is larger than byobRequest');
}

const viewByteLength = view.byteLength;

firstDescriptor.buffer = TransferArrayBuffer(view.buffer);

ReadableByteStreamControllerRespondInternal(controller, view.byteLength);
ReadableByteStreamControllerRespondInternal(controller, viewByteLength);
}

function ReadableByteStreamControllerShiftPendingPullInto(controller) {
Expand Down