Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 07b1c640309bedfa57e6ea975b2bb2123b3bb9fa
      
https://github.com/WebKit/WebKit/commit/07b1c640309bedfa57e6ea975b2bb2123b3bb9fa
  Author: Youenn Fablet <[email protected]>
  Date:   2025-11-10 (Mon, 10 Nov 2025)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/FileAPI/blob/Blob-stream.any-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/FileAPI/blob/Blob-stream.any.worker-expected.txt
    M Source/WebCore/Modules/streams/ReadableByteStreamController.cpp
    M Source/WebCore/Modules/streams/ReadableByteStreamController.h
    M Source/WebCore/Modules/streams/ReadableStream.cpp
    M Source/WebCore/Modules/streams/ReadableStream.h
    M Source/WebCore/fileapi/Blob.cpp

  Log Message:
  -----------
  Blob ReadableStream should allow a byob reader
rdar://164307723
https://bugs.webkit.org/show_bug.cgi?id=302201

Reviewed by Chris Dumez.

Blob stream was using the non-byte version of ReadableStream.
This disallows calling getReader({mode:'byob'}) on it.

We migrate to ReadableStream::createReadableByteStream, which takes a cancel 
and a pull algorithms.
Both algorithms are implemented using BlobStreamSource which does no longer 
need to derive from ReadableStreamSource.

BlobStreamSource, when being asked to pull by the ReadableStream will keep a 
reference to the controller and to the promise that controls whether pulling or 
not.
Both are either null together or non null together.
Whenever being asked to pull, BlobStreamSource will enqueue a chunk provided by 
FileReaderLoader.

We update the controller to be able to directly enqueue an ArrayBuffer instead 
of a view.
We add a getter to the ReadableStream globalObject as we sometimes have to get 
it to enqueue/close a stream from native C++ code.

To fully work, we also have to update the ReadableStream implementation:
- Allow closing a byob readable stream, following 
https://streams.spec.whatwg.org/#readablestream-close.
- Lock the VM when calling toJS from native C++ code.

Covered by existing tests, in particular WPT FileAPI/blob/Blob-stream.any.js.

Canonical link: https://commits.webkit.org/302787@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to