Bug 228085

Summary: FetchResponse.formData() should not reject promise if the body is null and the MIME Type is "application/x-www-form-urlencoded"
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: Page LoadingAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, beidson, darin, sam, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
ews-feeder: commit-queue-
Patch
none
Patch none

Chris Dumez
Reported 2021-07-19 12:49:56 PDT
FetchResponse.formData() should not reject promise if the body is null and the MIME Type is "application/x-www-form-urlencoded": - https://fetch.spec.whatwg.org/#concept-body-consume-body - https://fetch.spec.whatwg.org/#concept-body-package-data As per the specification, we should package an empty byte sequence in this case and resolve the promise with that.
Attachments
Patch (10.86 KB, patch)
2021-07-19 12:52 PDT, Chris Dumez
ews-feeder: commit-queue-
Patch (10.86 KB, patch)
2021-07-19 12:56 PDT, Chris Dumez
no flags
Patch (10.92 KB, patch)
2021-07-19 13:06 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2021-07-19 12:52:04 PDT
Chris Dumez
Comment 2 2021-07-19 12:56:32 PDT
Alex Christensen
Comment 3 2021-07-19 13:02:43 PDT
Comment on attachment 433814 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=433814&action=review > Source/WebCore/Modules/fetch/FetchBodyOwner.cpp:195 > + if (isBodyNullOrOpaque()) { > + // If the content-type is 'application/x-www-form-urlencoded', a body is not required and we should package an empty byte sequence as per the specification. It seems like we should only do this for isBodyNull
Chris Dumez
Comment 4 2021-07-19 13:06:07 PDT
Chris Dumez
Comment 5 2021-07-19 13:06:33 PDT
(In reply to Alex Christensen from comment #3) > Comment on attachment 433814 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=433814&action=review > > > Source/WebCore/Modules/fetch/FetchBodyOwner.cpp:195 > > + if (isBodyNullOrOpaque()) { > > + // If the content-type is 'application/x-www-form-urlencoded', a body is not required and we should package an empty byte sequence as per the specification. > > It seems like we should only do this for isBodyNull Good point, the spec only mentions the body being null.
Chris Dumez
Comment 6 2021-07-19 13:21:18 PDT
Why the r-??
Alex Christensen
Comment 7 2021-07-19 13:21:55 PDT
isBodyNullOrOpaque needs to be changed to isBodyNull
Chris Dumez
Comment 8 2021-07-19 13:22:37 PDT
Comment on attachment 433815 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=433815&action=review > Source/WebCore/Modules/fetch/FetchBodyOwner.cpp:195 > + if (isBodyNull()) { It does check isBodyNull()... ?
Alex Christensen
Comment 9 2021-07-19 13:23:38 PDT
Comment on attachment 433815 [details] Patch Oh, I didn't see that there was a new patch. Sorry
EWS
Comment 10 2021-07-19 14:33:24 PDT
Committed r280046 (239781@main): <https://commits.webkit.org/239781@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 433815 [details].
Radar WebKit Bug Importer
Comment 11 2021-07-19 14:34:24 PDT
Note You need to log in before you can comment on or make changes to this bug.