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

Streams: reject pending reads when releasing reader #32072

Merged

Conversation

MattiasBuelens
Copy link
Contributor

See whatwg/streams#1168 for the accompanying spec change.

Comment on lines +218 to +219
}, 'ReadableStream with byte source: respondWithNewView() throws if the supplied view has a different offset ' +
'(in the readable state)');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive-by fix: I noticed that this check was not covered by any tests, so I added one. 🙂

Copy link
Contributor

@ricea ricea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

const read2 = reader2.read(new Uint8Array([4, 5]));
assert_not_equals(controller.byobRequest, null, 'byobRequest should not be invalidated after releaseLock()');
assert_equals(controller.byobRequest, byobRequest1, 'byobRequest should be unchanged');
assert_array_equals([...new Uint8Array(byobRequest1.view.buffer)], [1, 2, 3], 'byobRequest.view.buffer should be unchanged');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's not necessary to unwrap the Uint8Array with [...]. assert_array_equals doesn't check the types of the arguments are equal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It matters for format_value() though, when the array ends up in an error message. 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, interesting.

streams/readable-byte-streams/general.any.js Outdated Show resolved Hide resolved
streams/readable-byte-streams/general.any.js Outdated Show resolved Hide resolved
@domenic domenic merged commit 99d74f9 into web-platform-tests:master Jan 13, 2022
@MattiasBuelens MattiasBuelens deleted the reject-pending-reads-on-release branch January 13, 2022 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants