Bug 270102

Summary: Fetch Request Fails with `TypeError: Load failed` Error After Initiating Download in Safari
Product: WebKit Reporter: misinoe.t
Component: WebKit Misc.Assignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: cdumez, mike, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: Safari 17   
Hardware: Mac (Apple Silicon)   
OS: macOS 14   
Attachments:
Description Flags
File to reproduce the issue none

Description misinoe.t 2024-02-26 10:33:26 PST
Created attachment 470050 [details]
File to reproduce the issue

During development, I have encountered a specific bug in Safari. Specifically, after initiating a file download using a dynamic <a> element, subsequent HTTP requests made with the fetch function fail with a `TypeError: Load failed` error. This issue only occurs after the download has been initiated and does not affect any fetch requests made prior to it.

The steps to reproduce are as follows:
1. Open the Developer Tools' Console tab.
2. Click the "Start Download and Fetch" button to start the file download and initiate fetch requests to `https://webkit.org`.
3. Observe in the console that fetch requests made before the download succeed, while fetch requests made after the download fail with a `TypeError: Load failed` error.

This issue could have a significant impact on web applications that need to perform data communication with servers after downloading files. I have attached code that can reproduce this issue, and I kindly request an investigation for a possible fix.

Thank you for your attention to this matter.
Comment 1 Radar WebKit Bug Importer 2024-03-04 10:36:55 PST
<rdar://problem/124018850>