Bug 251463

Summary: Error on piped ReadableStream leads to Unhandled Promise Rejection
Product: WebKit Reporter: hazae41
Component: JavaScriptCoreAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: Safari 16   
Hardware: All   
OS: All   

Description hazae41 2023-01-31 15:22:42 PST
Hey, the following code leads to an Unhandled Promise Rejection on some websites: 

```
new ReadableStream({ start: c => c.error("error") }).pipeTo(new WritableStream()).catch(() => {})
```

It also happens when calling controller.error after the pipe:

```
new ReadableStream({ start: c => window.c = c }).pipeTo(new WritableStream()).catch(() => {})

c.error("error")
```

Just run it in Safari console on latest macOS (Ventura 13.2) and latest iOS (16.0)

Websites where it happens:
- example.com
- bugs.webkit.org
- github.com
- facebook.com
- amazon.com
- blankwebsite.com

Websites where it doesn't happen:
- google.com
Comment 1 Radar WebKit Bug Importer 2023-02-07 15:23:16 PST
<rdar://problem/105149496>
Comment 2 youenn fablet 2023-03-23 08:15:47 PDT
Pull request: https://github.com/WebKit/WebKit/pull/11864
Comment 3 EWS 2023-03-27 00:25:22 PDT
Committed 262137@main (3a75b5d2de94): <https://commits.webkit.org/262137@main>

Reviewed commits have been landed. Closing PR #11864 and removing active labels.