[Fetch API] Fetching with a FormData body should reject until it is implemented
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 6 Aug 2016 08:51:01 +0000 (08:51 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 6 Aug 2016 08:51:01 +0000 (08:51 +0000)
commit8552bea1f1ba0dedc5f272c36dce7ff41cde1988
tree87ec98b7f9dd992f1acf9bb68f6806a8be8cdd35
parent6857e9fbf8fcdc0c0d1fd32eb36d4e3953cd401d
[Fetch API] Fetching with a FormData body should reject until it is implemented
https://bugs.webkit.org/show_bug.cgi?id=160595

Patch by Youenn Fablet <youenn@apple.com> on 2016-08-06
Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Adding new tests to cover changes.
Removing HEAD with body test as it throws as expected and is redundant with
web-platform-tests/fetch/api/request/request-init-002.html.

* web-platform-tests/fetch/api/basic/request-headers-expected.txt:
* web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt:
* web-platform-tests/fetch/api/basic/request-headers.js:
(checkContentType):
(requestHeaders):

Source/WebCore:

Covered by updated tests.

This patch ensures that fetch will throw if trying to upload something that is not supported.
This is the case of BufferSource (FetchBody does not yet extract it) and FormData (no upload support yet).

* Modules/fetch/FetchBody.cpp:
(WebCore::FetchBody::extract): Added a FIXME.
* Modules/fetch/FetchBodyOwner.h:
(WebCore::FetchBodyOwner::bodyType): Getter used by FetchResponse.
* Modules/fetch/FetchRequest.cpp:
(WebCore::FetchRequest::setBody): Throwing if given body parameter cannot be extracted by FetchBody.
This ensures that a fetch with a body that cannot be uploaded will fail.
This is the case of BufferSource which is not yet supported.
* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::fetch): Rejecting fetch promise if trying to upload a FormData as it is not implemented.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204225 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.js
Source/WebCore/ChangeLog
Source/WebCore/Modules/fetch/FetchBody.cpp
Source/WebCore/Modules/fetch/FetchBodyOwner.h
Source/WebCore/Modules/fetch/FetchRequest.cpp
Source/WebCore/Modules/fetch/FetchResponse.cpp