Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b7516bee73066d5798581e69c381fbe25aeab58c
      
https://github.com/WebKit/WebKit/commit/b7516bee73066d5798581e69c381fbe25aeab58c
  Author: Youenn Fablet <[email protected]>
  Date:   2026-07-01 (Wed, 01 Jul 2026)

  Changed paths:
    A LayoutTests/streams/byob-close-exception-expected.txt
    A LayoutTests/streams/byob-close-exception.html
    M Source/WebCore/Modules/streams/ReadableByteStreamController.cpp
    M Source/WebCore/Modules/streams/ReadableByteStreamController.h
    M Source/WebCore/Modules/streams/StreamTeeUtilities.cpp

  Log Message:
  -----------
  [WebCore] unchecked exception return in 
ReadableByteStreamController::closeAndRespondToPendingPullIntos and 
TeeDefaultReadRequest::runCloseSteps
rdar://175673816

Reviewed by Chris Dumez.

ReadableByteStreamController::closeAndRespondToPendingPullIntos() and
TeeDefaultReadRequest::runCloseSteps() both call close(globalObject) with
the default ShouldThrowOnError::Yes flag and discard the bool return value.
When the first pending pull-into has bytesFilled % elementSize != 0,
close() calls this->error(), then throwException(...), and returns false —
leaving a TypeError pending on the VM with no RETURN_IF_EXCEPTION guard in
any caller.

The sibling BYOB path (TeeBYOBReadRequest::runCloseSteps) was fixed in
rdar://165613840 (303821@main) to use ShouldThrowOnError::No and check the
return; these two callers were not updated at the same time.

This patch mirrors the rdar://165613840 pattern at both unfixed callers:
- Pass ShouldThrowOnError::No and check return value in both callers
- Stop processing pending pull-intos when close() fails

It also makes ShouldThrowOnError parameter non-optional to prevent future 
misuse.

Test: streams/byob-close-exception.html

* Source/WebCore/Modules/streams/ReadableByteStreamController.cpp:
(WebCore::ReadableByteStreamController::closeForBindings):
(WebCore::ReadableByteStreamController::closeAndRespondToPendingPullIntos):
* Source/WebCore/Modules/streams/ReadableByteStreamController.h:
* Source/WebCore/Modules/streams/StreamTeeUtilities.cpp:
(WebCore::TeeDefaultReadRequest::runCloseSteps):

Originally-landed-as: 305413.819@safari-7624-branch (cbd729a317dc). 
rdar://180429188
Canonical link: https://commits.webkit.org/316363@main



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

Reply via email to