Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4863df935d2003de4ec5248d7d0ecc4c934485ce
      
https://github.com/WebKit/WebKit/commit/4863df935d2003de4ec5248d7d0ecc4c934485ce
  Author: Youenn Fablet <[email protected]>
  Date:   2026-01-09 (Fri, 09 Jan 2026)

  Changed paths:
    A LayoutTests/streams/pipeTo-gc-expected.txt
    A LayoutTests/streams/pipeTo-gc.html
    M Source/WebCore/Modules/streams/StreamPipeToUtilities.cpp
    M Source/WebCore/testing/Internals.cpp
    M Source/WebCore/testing/Internals.h
    M Source/WebCore/testing/Internals.idl

  Log Message:
  -----------
  StreamPipeToState creates a reference cycle when creating a read request
rdar://166710239
https://bugs.webkit.org/show_bug.cgi?id=305109

Reviewed by Chris Dumez.

We were creating a ref cycle between StreamPipeToState and 
PipeToDefaultReadRequest which was supposed to be broken at finalize time. But 
this is not happening.
We are now making StreamPipeToState keeping a WeakPtr to its 
PipeToDefaultReadRequest and keeping PipeToDefaultReadRequest taking a strong 
ref to its StreamPipeToState.

This ensures that, until PipeToDefaultReadRequest is fulfilled, 
StreamPipeToState stays alive.
In case PipeToDefaultReadRequest is being closed/errored, we need to ensure 
that StreamPipeToState stays alive until the clsoed promise callback is called 
to forward the closure to the writable stream.
We add readableStreamIsClosing for that purpose.

To further strengthen the appraoch, we are also clearing the pending read and 
write request in finalize.
We add an internals API to allow testing that the ref cycle is correctly broken.

Covered by added test.

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



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

Reply via email to