Closed
Bug 1500879
Opened 6 years ago
Closed 6 years ago
Fetch should not consume Request/Response with null-body
Categories
(Core :: DOM: Core & HTML, enhancement, P2)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla65
Tracking | Status | |
---|---|---|
firefox65 | --- | fixed |
People
(Reporter: baku, Assigned: baku)
Details
Attachments
(1 file)
15.25 KB,
patch
|
asuth
:
review+
|
Details | Diff | Splinter Review |
Assignee | ||
Comment 1•6 years ago
|
||
Attachment #9018997 -
Flags: review?(bugmail)
Updated•6 years ago
|
Priority: -- → P2
Comment 2•6 years ago
|
||
Comment on attachment 9018997 [details] [diff] [review] fetch_empty.patch Review of attachment 9018997 [details] [diff] [review]: ----------------------------------------------------------------- Please add a commit message, something like the following. The extra context of a commit message like this and a slightly more spec-explaining comment like the below would have made it much easier to address this review. I'll try and be better in the future about providing an immediate "r-" like :smaug and others do instead of trying to figure the patch out myself. The fetch spec treats null bodies specially. Their Body cannot become disturbed or locked and a fresh empty ReadableStream is returned whenever an attempt is made to consume the body. We currently fail a number of WPT tests in this area because we do mark the body consumed as exposed via bodyUsed. ::: dom/fetch/Fetch.cpp @@ +1238,5 @@ > aRv.ThrowTypeError<MSG_FETCH_BODY_CONSUMED_ERROR>(); > return nullptr; > } > > + // By spec, if the body is null, we have to create an empty ReadableStream. This comment could be a little more illuminating given the unusual behavior of the spec around null bodies. I'd suggest something like the following. null bodies are a special-case in the fetch spec. The Body mix-in can only be "disturbed" or "locked" if its associated "body" is non-null. Additionally, the Body min-in's "consume body" algorithm explicitly creates a fresh empty ReadableStream object in step 2. This means that `bodyUsed` will never return true for a null body. To this end, we create a fresh (empty) body every time a request is made and consume its body here, without marking this FetchBody consumed via SetBodyUsed.
Attachment #9018997 -
Flags: review?(bugmail) → review+
Pushed by amarchesini@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/01232c002d2d Fetch should not consume Request/Response with null-body, r=asuth
Comment 4•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/01232c002d2d
Status: NEW → RESOLVED
Closed: 6 years ago
status-firefox65:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•