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

Throw a TypeError in ReadableStreamBYOBReader constructor if stream isn't a byte stream #638

Merged
merged 6 commits into from Jan 6, 2017

Reference impl: Move type check for BYOB reader

To match the change to the standard text in the reference
implementation, move the check that the ReadableStream is of 'bytes'
type to the ReadableStreamBYOBReader constructor.
  • Loading branch information...
ricea authored and domenic committed Jan 6, 2017
commit 7a8929c41f681c7eb646e808def8eb56549aae22
@@ -69,10 +69,6 @@ class ReadableStream {
}
if (mode === 'byob') {
if (IsReadableByteStreamController(this._readableStreamController) === false) {
throw new TypeError('Cannot get a ReadableStreamBYOBReader for a stream not constructed with a byte source');
}
return AcquireReadableStreamBYOBReader(this);
}
@@ -665,6 +661,10 @@ class ReadableStreamBYOBReader {
throw new TypeError('ReadableStreamBYOBReader can only be constructed with a ReadableStream instance given a ' +
'byte source');
}
if (IsReadableByteStreamController(stream._readableStreamController) === false) {
throw new TypeError('Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte ' +
'source');
}
if (IsReadableStreamLocked(stream)) {
throw new TypeError('This stream has already been locked for exclusive reading by another reader');
}
ProTip! Use n and p to navigate between commits in a pull request.