Re: [streams] Byte stream update, including reference implementation (#361)

> +      return Promise.reject(this._storedError);
> +    }
> +
> +    assert(this._ownerReadableByteStream !== undefined, 'This stream must be attached to a stream');
> +
> +    return CancelReadableByteStream(this._ownerReadableByteStream, reason);
> +  }
> +
> +  read(view) {
> +    if (!IsReadableByteStreamByobReader(this)) {
> +      return Promise.reject(
> +        new TypeError(
> +            'ReadableByteStreamByobReader.prototype.read can only be used on a ReadableByteStreamByobReader'));
> +    }
> +
> +    if (view === undefined) {

I think we want to use a stronger brand check. Check if it's Object, then check if it has a [[ViewedArrayBuffer]], like in https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraybuffer.isview. Once you do that you can probably actually use `view@[[ByteLength]]` etc directly, actually, without needing the abstract operations that throw if they're not present.

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/361/files#r32267723

Received on Thursday, 11 June 2015 21:02:14 UTC