Skip to content

Streams: reject pending reads when releasing reader - #32072

Merged
domenic merged 14 commits into
web-platform-tests:masterfrom
MattiasBuelens:reject-pending-reads-on-release
Jan 13, 2022
Merged

domenic merged 14 commits into
web-platform-tests:masterfrom
MattiasBuelens:reject-pending-reads-on-release

Conversation

@MattiasBuelens

Copy link
Copy Markdown
Contributor

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

@MattiasBuelens
MattiasBuelens force-pushed the reject-pending-reads-on-release branch from 5c4df18 to 04f6e39 Compare December 15, 2021 23:05
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
Copy Markdown
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. πŸ™‚

@ricea ricea left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah, interesting.

@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