Bug 162667

Summary: [Fetch API] Add support for URLSearchParams body
Product: WebKit Reporter: youenn fablet <youennf>
Component: WebCore Misc.Assignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, cdumez, commit-queue, esprehn+autocc, gyuyoung.kim
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch for landing none

youenn fablet
Reported 2016-09-28 02:21:14 PDT
We should support URLSearchParams bodies as per https://fetch.spec.whatwg.org/#body-mixin
Attachments
Patch (35.87 KB, patch)
2016-09-28 03:53 PDT, youenn fablet
no flags
Patch for landing (35.03 KB, patch)
2016-09-30 00:10 PDT, youenn fablet
no flags
youenn fablet
Comment 1 2016-09-28 03:53:44 PDT
Alex Christensen
Comment 2 2016-09-28 08:25:16 PDT
Comment on attachment 290073 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=290073&action=review > Source/WebCore/Modules/fetch/FetchBody.cpp:53 > + CString data = text.utf8(); Is this correct? I think there should be a test with an emoji in it. > Source/WebCore/Modules/fetch/FetchBody.cpp:95 > + , m_contentType(ASCIILiteral("application/x-www-form-urlencoded;charset=UTF-8")) This string exists in many places in WebCore, all of them so far without the charset. There should be a common place for this const char[] definition somewhere.
youenn fablet
Comment 3 2016-09-28 09:32:24 PDT
Comment on attachment 290073 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=290073&action=review >> Source/WebCore/Modules/fetch/FetchBody.cpp:53 >> + CString data = text.utf8(); > > Is this correct? I think there should be a test with an emoji in it. Good point, there is no test for that. I plan to fix the double allocation by moving this function in WTFString. Can it be tackled at that time? >> Source/WebCore/Modules/fetch/FetchBody.cpp:95 >> + , m_contentType(ASCIILiteral("application/x-www-form-urlencoded;charset=UTF-8")) > > This string exists in many places in WebCore, all of them so far without the charset. There should be a common place for this const char[] definition somewhere. Sounds good, how about adding in a future patch common HTTP header values in Source/WebCore/platform/, like in a new file like network/HTTPHeaderValues.*.
Alex Christensen
Comment 4 2016-09-28 12:19:25 PDT
(In reply to comment #3) > Comment on attachment 290073 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=290073&action=review > > >> Source/WebCore/Modules/fetch/FetchBody.cpp:53 > >> + CString data = text.utf8(); > > > > Is this correct? I think there should be a test with an emoji in it. > > Good point, there is no test for that. > I plan to fix the double allocation by moving this function in WTFString. > Can it be tackled at that time? I think this should be done in the same patch so we don't have incorrect behavior in trunk. > > >> Source/WebCore/Modules/fetch/FetchBody.cpp:95 > >> + , m_contentType(ASCIILiteral("application/x-www-form-urlencoded;charset=UTF-8")) > > > > This string exists in many places in WebCore, all of them so far without the charset. There should be a common place for this const char[] definition somewhere. > > Sounds good, how about adding in a future patch common HTTP header values in > Source/WebCore/platform/, like in a new file like network/HTTPHeaderValues.*. Sure. Different patch ok.
youenn fablet
Comment 5 2016-09-28 12:22:28 PDT
This behavior is already in the repository... This patch is only moving the code we are talking from method to function.
Alex Christensen
Comment 6 2016-09-28 20:32:11 PDT
Comment on attachment 290073 [details] Patch Dang it, you're right. This doesn't make things worse
Alex Christensen
Comment 7 2016-09-28 21:52:10 PDT
We really ought to fix it soon, though. Add a FIXME saying that it might not do the right thing with unicode characters.
youenn fablet
Comment 8 2016-09-30 00:10:41 PDT
Created attachment 290308 [details] Patch for landing
WebKit Commit Bot
Comment 9 2016-09-30 01:07:15 PDT
Comment on attachment 290308 [details] Patch for landing Clearing flags on attachment: 290308 Committed r206632: <http://trac.webkit.org/changeset/206632>
WebKit Commit Bot
Comment 10 2016-09-30 01:07:20 PDT
All reviewed patches have been landed. Closing bug.
youenn fablet
Comment 11 2016-09-30 01:25:44 PDT
(In reply to comment #7) > We really ought to fix it soon, though. Add a FIXME saying that it might > not do the right thing with unicode characters. I did some tests and cannot make it faulty, even with non-BMP characters. That said, it is more consistent to use UTF8Encoding. Also, this code needs to be changed anyway to remove the no-longer needed vector allocation.
youenn fablet
Comment 12 2016-10-06 03:58:22 PDT
> > > This string exists in many places in WebCore, all of them so far without the charset. There should be a common place for this const char[] definition somewhere. > > > > Sounds good, how about adding in a future patch common HTTP header values in > > Source/WebCore/platform/, like in a new file like network/HTTPHeaderValues.*. > Sure. Different patch ok. Filed bug 163002 for that.
Note You need to log in before you can comment on or make changes to this bug.