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

FF102 User define byte stream interface - not experimental #16818

Merged
merged 45 commits into from
Jul 12, 2022

Conversation

hamishwillee
Copy link
Collaborator

@hamishwillee hamishwillee commented May 31, 2022

FF102 brings support for the following interfaces:

This work includes updates to the above classes (and their properties and methods), along with a new guide Using_readable_byte_streams.

There are lots of other minor changes to related docs to cross link the new docs and also minor fixes to things like TransformStreams and streaming API doc while trying to get my head around the above.

Other docs work can be tracked in #16816

@hamishwillee hamishwillee requested a review from a team as a code owner May 31, 2022 07:43
@hamishwillee hamishwillee requested review from wbamberg and removed request for a team May 31, 2022 07:43
@github-actions github-actions bot added the Content:WebAPI Web API docs label May 31, 2022
@github-actions
Copy link
Contributor

github-actions bot commented May 31, 2022

Preview URLs

Flaws

Note! 25 documents with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView
Title: ReadableStreamBYOBRequest.respondWithNewView()
on GitHub
Flaw count: 2

  • macros:
    • wrong xref macro used (consider changing which macro you use)
    • wrong xref macro used (consider changing which macro you use)

External URLs

URL: /en-US/docs/Web/API/ReadableStream/ReadableStream
Title: ReadableStream()
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/ReadableStream/getReader
Title: ReadableStream.getReader()
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/ReadableStreamBYOBReader
Title: ReadableStreamBYOBReader
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/ReadableStreamBYOBReader/closed
Title: ReadableStreamBYOBReader.closed
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/ReadableStreamBYOBReader/read
Title: ReadableStreamBYOBReader.read()
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/ReadableStreamBYOBReader/ReadableStreamBYOBReader
Title: ReadableStreamBYOBReader()
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/ReadableStreamBYOBReader/cancel
Title: ReadableStreamBYOBReader.cancel()
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/ReadableStreamBYOBReader/releaseLock
Title: ReadableStreamBYOBReader.releaseLock()
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/Streams_API
Title: Streams API
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/Streams_API/Using_readable_streams
Title: Using readable streams
on GitHub


URL: /en-US/docs/Web/API/Streams_API/Using_readable_byte_streams
Title: Using readable byte streams
on GitHub


URL: /en-US/docs/Web/API/Streams_API/Concepts
Title: Streams API concepts
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/Streams_API/Using_writable_streams
Title: Using writable streams
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/ReadableStreamBYOBRequest
Title: ReadableStreamBYOBRequest
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView
Title: ReadableStreamBYOBRequest.respondWithNewView()
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/ReadableStreamBYOBRequest/view
Title: ReadableStreamBYOBRequest.view
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/ReadableStreamBYOBRequest/respond
Title: ReadableStreamBYOBRequest.respond()
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/ReadableByteStreamController
Title: ReadableByteStreamController
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/ReadableByteStreamController/enqueue
Title: ReadableByteStreamController.enqueue()
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/ReadableByteStreamController/error
Title: ReadableByteStreamController.error()
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/ReadableByteStreamController/desiredSize
Title: ReadableByteStreamController.desiredSize
on GitHub


URL: /en-US/docs/Web/API/ReadableByteStreamController/close
Title: ReadableByteStreamController.close()
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/ReadableByteStreamController/byobRequest
Title: ReadableByteStreamController.byobRequest
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/ReadableStreamDefaultReader
Title: ReadableStreamDefaultReader
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/ReadableStreamDefaultReader/releaseLock
Title: ReadableStreamDefaultReader.releaseLock()
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/TransformStream
Title: TransformStream
on GitHub

No new external URLs

(this comment was updated 2022-07-12 00:04:04.359661)

@hamishwillee
Copy link
Collaborator Author

@wbamberg If you're happy with this please approve but don't merge.

@mgaudet
Copy link

mgaudet commented Jun 10, 2022

Hey @domenic and @mathiasbynens:

Hamish has been working up the MDN documentation for user defined byte streams, based partially on my explanations at the bottom of this bug. I would love it if either of you had the time, if you could take a peek as well for accuracy.

@hamishwillee
Copy link
Collaborator Author

hamishwillee commented Jun 11, 2022

Thanks @mgaudet . FYI @domenic and @mathiasbynens

This PR is now worth looking at. ReadableStreamBYOBRequest, ReadableByteStreamController and reader docs are all updated and should be accurate. But they don't yet have examples. I also need to create the high level intro.

The work continues ...

@hamishwillee
Copy link
Collaborator Author

@mgaudet Howdy, FYI, the first draft of the guide is now done in https://pr16818.content.dev.mdn.mozit.cloud/en-US/docs/Web/API/Streams_API/Using_readable_byte_streams

The examples clarified a few things for me, as they always do, including that the auto buffer allocation is ignored if you have a byte reader. Now that I have the examples I plan to flesh out all the pages tomorrow. That means this should be ready for proper remove in about 24 hours. I'll ping the spec authors then too.

@mgaudet
Copy link

mgaudet commented Jul 3, 2022

I am on vacation this week, so won’t be able to take a look till the 11th.

@hamishwillee hamishwillee requested a review from a team as a code owner July 4, 2022 04:55
@hamishwillee
Copy link
Collaborator Author

hamishwillee commented Jul 4, 2022

@domenic and @mathiasbynens . First draft complete. There might be tweaks but the shape of it is done. Matthew is hoping to review next week. If you have comments, in particular about https://pr16818.content.dev.mdn.mozit.cloud/en-US/docs/Web/API/Streams_API/Using_readable_byte_streams they would be much appreciated.

EDIT: Added request for review in whatwg/streams#1237

Copy link
Contributor

@MattiasBuelens MattiasBuelens left a comment

Choose a reason for hiding this comment

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

Reviewed about half of the files, will try to get through the rest later this week. Overall it's looking very good, nice work! 👏

@hamishwillee hamishwillee force-pushed the ff102_readable_stream_basicfix branch from 84107e9 to 0b1de15 Compare July 11, 2022 08:12
hamishwillee and others added 6 commits July 11, 2022 18:14
@hamishwillee hamishwillee requested a review from teoli2003 July 11, 2022 08:42
@hamishwillee
Copy link
Collaborator Author

Thanks @teoli2003
I accepted reviews and did a rebase which fixed up some of the other page type stuff.

YOu raised a few questions about cases where a reject is not used. I can remove these if you like. I left them in because originally this was a generally purpose mock and I wasn't sure whether I'd add error fail cases etc. They aren't needed, but nor do they do much harm. So unless you say "must be commented or removed" then I lean to leaving them along - in particular since most are hidden.

Copy link
Contributor

@teoli2003 teoli2003 left a comment

Choose a reason for hiding this comment

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

I proposed an alternative, your call. I'm approving, and let you merge it.

Copy link
Contributor

@MattiasBuelens MattiasBuelens left a comment

Choose a reason for hiding this comment

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

Some final nits, other than that this LGTM. Thank you so much for this excellent write-up! 😄

files/en-us/web/api/readablestreambyobrequest/index.md Outdated Show resolved Hide resolved
files/en-us/web/api/streams_api/concepts/index.md Outdated Show resolved Hide resolved
@mgaudet
Copy link

mgaudet commented Jul 11, 2022

I did a cursory review, but I'm very happy that the spec authors found the time to review this, and I will defer to their expertise. LGTM as well :)

Co-authored-by: Mattias Buelens <649348+MattiasBuelens@users.noreply.github.com>
Co-authored-by: Jean-Yves Perrier <jypenator@gmail.com>
@hamishwillee
Copy link
Collaborator Author

hamishwillee commented Jul 12, 2022

Thanks @teoli2003 - I accepted all your nits and will merge.

Thanks @MattiasBuelens for your reviews. This took longer for me to get my head around than necessary. FYI only - these will seem stupid to you:

  • the byob naming seemed odd. It took me forever to understand the the buffer that is BYOB is provided by the reader. The reason this is confusing is because it might not be BYOB and I started looking at this from the stream constructor end.
  • There isn't always a BYOB buffer - it gets created when appropriate.
  • The autoallocation only applies for default reader.
  • The change you made to the releaseLock is much better! The original way made it hard to sensibly manage unlocking.

At some point it might be worth me/someone coming back and adding a mock backpressure. IMO the ability to try stuff in live examples adds a lot of value.

@mgaudet You've gone above and beyond. Really appreciate it. Note the comment from @MattiasBuelens that the spec does not require that if a byobRequest is provided that it is used - you can enqueue if you like and the controller should handle that. If FF does something different it might be off spec. I'll leave you guys to chat about that elsewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants