Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5d8c7f0a38c9fb57708a347dabd1660b85c51efe
      
https://github.com/WebKit/WebKit/commit/5d8c7f0a38c9fb57708a347dabd1660b85c51efe
  Author: Chris Dumez <[email protected]>
  Date:   2026-06-03 (Wed, 03 Jun 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-clone-readable-stream-body.any-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-clone-readable-stream-body.any.html
    A 
LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-clone-readable-stream-body.any.js
    A 
LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-clone-readable-stream-body.any.worker-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-clone-readable-stream-body.any.worker.html
    M Source/WebCore/Modules/fetch/FetchBody.cpp

  Log Message:
  -----------
  FetchBody::clone() leaves m_data and m_readableStream desynchronized
https://bugs.webkit.org/show_bug.cgi?id=316159

Reviewed by Anne van Kesteren.

When cloning a FetchBody whose body is a ReadableStream, only the
m_readableStream field was updated to point at the new tee branches;
m_data still held the original (now disturbed) stream on the source,
and was left as the default nullptr variant on the clone. This broke
the invariant established by FetchBody(Ref<ReadableStream>&&) that
m_data and m_readableStream refer to the same stream, causing
isReadableStream() and hasReadableStream() to disagree.

The visible consequence is that constructing a new Request from a
cloned Request silently dropped the body: FetchBody::createProxy()
keys off isReadableStream(), which returned false on the clone, so
the proxy short-circuited before piping the readable stream through.

Set m_data alongside m_readableStream on both branches of the tee
to keep the two fields in sync.

This aligns our behavior with Chrome.

Tests: 
imported/w3c/web-platform-tests/fetch/api/request/request-clone-readable-stream-body.any.html
       
imported/w3c/web-platform-tests/fetch/api/request/request-clone-readable-stream-body.any.worker.html

* 
LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-clone-readable-stream-body.any-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-clone-readable-stream-body.any.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-clone-readable-stream-body.any.js:
 Added.
(promise_test.async const):
(promise_test):
* 
LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-clone-readable-stream-body.any.worker-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-clone-readable-stream-body.any.worker.html:
 Added.
* Source/WebCore/Modules/fetch/FetchBody.cpp:
(WebCore::FetchBody::clone):

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



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

Reply via email to