Open Bug 1558978 Opened 5 years ago Updated 2 years ago

sendBeacon (fetch with keepalive set) should throw TypeError when request body is a readable stream

Categories

(Core :: DOM: Networking, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: rniwa, Unassigned)

Details

(Whiteboard: [necko-triaged])

The problem here is that https://searchfox.org/mozilla-central/source/dom/webidl/Fetch.webidl#11 does not mention ReadableStream and we cannot really mention it because we don't support "upload" streams. This means however that IDL kicks in when someone passes a ReadableStream. What IDL does in that case is stringify as one of the BodyInit types is USVString. And that is allowed in combination with keepalive.

As there still doesn't seem to be much interest in pushing ReadableStream for "upload" streams to completion (more specification work is required), perhaps the solution here should be to remove that and split BodyInit in RequestBodyInit and ResponseBodyInit or some such?

Component: DOM: Networking → DOM: Core & HTML
Type: defect → enhancement
Priority: -- → P3

Junior, this problem is with fetch()'s IDL which sendBeacon() uses. So I think the component should be DOM: Networking. Also, sendBeacon() is probably best maintained alongside fetch() and XMLHttpRequest.

Flags: needinfo?(juhsu)

That's fair. I was referring some beacon bugs before.

Component: DOM: Core & HTML → DOM: Networking
Flags: needinfo?(juhsu)
Whiteboard: [necko-triaged]

The component has been changed since the priority was decided, so we're resetting it.
For more information, please visit auto_nag documentation.

Priority: P3 → --
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.