Bug 203617 - "ReadableStream uploading is not supported" when fetch()ing a Request that has been logged to console
Summary: "ReadableStream uploading is not supported" when fetch()ing a Request that ha...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Service Workers (show other bugs)
Version: Safari 13
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-10-30 10:40 PDT by Jeffrey Posnick
Modified: 2019-12-04 08:24 PST (History)
7 users (show)

See Also:


Attachments
Screenshot of the failure sequence. (113.97 KB, image/png)
2019-10-30 10:40 PDT, Jeffrey Posnick
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeffrey Posnick 2019-10-30 10:40:25 PDT
Created attachment 382328 [details]
Screenshot of the failure sequence.

This came up at https://github.com/GoogleChrome/workbox/issues/1732, and was originally mentioned at https://stackoverflow.com/questions/49850705. While it has more to do with the Fetch API than Service Workers, I didn't see a dedicated Component for Fetch, so I chose Service Workers.

An attempt to call fetch(request) will lead to a "NotSupportedError: ReadableStream uploading is not supported" when request is a Request object that contains a body and has been previously logged to the JS console. This failure occurs whether the logging is implicit, by virtue of typing in an interactive command in the JS console (which logs the return value immediately after execution) or explicit from code, via console.log(request).

You can reproduce this issue by navigating to https://example.com in any recent version of Safari (I tested with Safari 13 on OS X 10.14.6), choosing "Show JavaScript console" from the Develop menu, and entering the following:

> res = await fetch(new Request('https://example.com', {method: 'POST', body: Math.random()}))
< undefined
[Info] Response {type: "basic", url: "https://example.com/", redirected: false, status: 200, ok: true, …}

> req = new Request('https://example.com', {method: 'POST', body: Math.random()})
< Request {method: "POST", url: "https://example.com/", headers: Headers, destination: "", referrer: "about:client", …}
> res = await fetch(req)
NotSupportedError: ReadableStream uploading is not supported

The first sequence succeeds, because the new Request is created inside of the fetch() call and is not logged to the JS console.

The second sequence fails, because the new Request is logged to the JS console automatically after creation, and then using it via fetch(req) triggers the exception.

Attached is a screenshot of this in action if that's easier to follow.

No other browsers demonstrate this issue. Logging a request to the JS console should change whether or not the request is eligible to be sent via fetch(). Presumably whatever ends up implicitly converting the Request body to a ReadableStream should be disabled when logging to the JS console.
Comment 1 Radar WebKit Bug Importer 2019-10-30 23:02:47 PDT
<rdar://problem/56772045>