Bug 1651887 Comment 6 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

The FormData appends follows the spec[1], however, the problem may in the fetch request which uses line break converting while constructing fetch request. While constructing a fetch request[2], it will run `ExtractByteStreamFromBody`[3] then `GetSendInfo`[4] will use `FSMultipartFormData`[5] to get form data which will do line break converting[5] at the same time.  

[1] https://xhr.spec.whatwg.org/#dom-formdata-append
[2] https://searchfox.org/mozilla-central/rev/227f22acef5c4865503bde9f835452bf38332c8e/dom/fetch/Request.cpp#583
[3] https://searchfox.org/mozilla-central/rev/227f22acef5c4865503bde9f835452bf38332c8e/dom/fetch/Fetch.cpp#888
[4] https://searchfox.org/mozilla-central/rev/cf561cece0ca9aeaf0202e68699836d957d0c670/dom/base/FormData.cpp#318
[5] https://searchfox.org/mozilla-central/rev/227f22acef5c4865503bde9f835452bf38332c8e/dom/html/HTMLFormSubmission.cpp#391-393
The FormData appends follows the spec[1], however, the problem may in the fetch request which uses line break converting while constructing fetch request. While constructing a fetch request[2], it will run `ExtractByteStreamFromBody`[3] then `GetSendInfo`[4] will use `FSMultipartFormData`[5] to get form data which will do line break converting[5] at the same time. I also test that Safari and Firefox has the same issue, but Chrome didn't.

[1] https://xhr.spec.whatwg.org/#dom-formdata-append
[2] https://searchfox.org/mozilla-central/rev/227f22acef5c4865503bde9f835452bf38332c8e/dom/fetch/Request.cpp#583
[3] https://searchfox.org/mozilla-central/rev/227f22acef5c4865503bde9f835452bf38332c8e/dom/fetch/Fetch.cpp#888
[4] https://searchfox.org/mozilla-central/rev/cf561cece0ca9aeaf0202e68699836d957d0c670/dom/base/FormData.cpp#318
[5] https://searchfox.org/mozilla-central/rev/227f22acef5c4865503bde9f835452bf38332c8e/dom/html/HTMLFormSubmission.cpp#391-393
The FormData appends follows the spec[1], however, the problem may in the fetch request which uses line break converting while constructing fetch request. While constructing a fetch request[2], it will run `ExtractByteStreamFromBody`[3] then `GetSendInfo`[4] will use `FSMultipartFormData`[5] to get form data which will do line break converting[5] at the same time. I also test that Safari and Firefox has the same issue, but Chrome didn't.

[1] https://xhr.spec.whatwg.org/#dom-formdata-append and https://searchfox.org/mozilla-central/rev/cf561cece0ca9aeaf0202e68699836d957d0c670/dom/base/FormData.h#108
[2] https://searchfox.org/mozilla-central/rev/227f22acef5c4865503bde9f835452bf38332c8e/dom/fetch/Request.cpp#583
[3] https://searchfox.org/mozilla-central/rev/227f22acef5c4865503bde9f835452bf38332c8e/dom/fetch/Fetch.cpp#888
[4] https://searchfox.org/mozilla-central/rev/cf561cece0ca9aeaf0202e68699836d957d0c670/dom/base/FormData.cpp#318
[5] https://searchfox.org/mozilla-central/rev/227f22acef5c4865503bde9f835452bf38332c8e/dom/html/HTMLFormSubmission.cpp#391-393

Back to Bug 1651887 Comment 6