Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e9225c70f71ec8804d155b8c905cc77b44aa5ae1
      
https://github.com/WebKit/WebKit/commit/e9225c70f71ec8804d155b8c905cc77b44aa5ae1
  Author: Youenn Fablet <[email protected]>
  Date:   2025-10-03 (Fri, 03 Oct 2025)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/tee.any-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/tee.any.serviceworker-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/tee.any.sharedworker-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/tee.any.worker-expected.txt
    A LayoutTests/streams/overriding-then-expected.txt
    A LayoutTests/streams/overriding-then.html
    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/Modules/streams/ReadableStreamBYOBReader.cpp
    M Source/WebCore/Modules/streams/ReadableStreamBYOBReader.h
    M Source/WebCore/Modules/streams/ReadableStreamBYOBReader.idl
    M Source/WebCore/Modules/streams/ReadableStreamDefaultReader.cpp
    M Source/WebCore/Modules/streams/ReadableStreamDefaultReader.h
    A Source/WebCore/Modules/streams/ReadableStreamReadRequest.cpp
    A Source/WebCore/Modules/streams/ReadableStreamReadRequest.h
    M Source/WebCore/Modules/streams/StreamTeeUtilities.cpp
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj

  Log Message:
  -----------
  byteStreamTee should not be observable from JS
rdar://161883428
https://bugs.webkit.org/show_bug.cgi?id=300087

Reviewed by Chris Dumez.

We were previously relying on promise based reads for byteStreamTee.
But this is observable to JS via Object.prototype.then.
To prevent this, we introduce read requests as defined in the specification.
The read request (ReadRequest for default reading and ReadIntoRequest for byob 
reading) will be used for both the JS read methods and byteStreamTee.

For the JS read methods, the read requests encapsulate a promise and 
resolve/reject it as defined in the spec.
See https://streams.spec.whatwg.org/#default-reader-read and 
https://streams.spec.whatwg.org/#byob-reader-read.

For byteStreamTee, the read requests will be used to fuel the teed streams as 
per https://streams.spec.whatwg.org/#abstract-opdef-readablebytestreamtee.

In byteStreamTee, we need to queue a micro task, which was done by the previous 
promise-based mechanism.
To do so, we make StreamTeeState a ContextDestructionObserver, which allows us 
to get to the event loop.
We also make use of ContextDestructionObserver to clean-up StreamTeeState 
whenver its context is destroyed, which can help for potential ref cycles.

Test: streams/overriding-then.html
Canonical link: https://commits.webkit.org/300941@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to