Changeset 280046 in webkit
- Timestamp:
- Jul 19, 2021 2:33:16 PM (12 months ago)
- Location:
- trunk
- Files:
-
- 9 edited
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty.any-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty.any.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-empty.any-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-empty.any.worker-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/fetch/FetchBodyConsumer.cpp (modified) (2 diffs)
-
Source/WebCore/Modules/fetch/FetchBodyConsumer.h (modified) (2 diffs)
-
Source/WebCore/Modules/fetch/FetchBodyOwner.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r280044 r280046 1 2021-07-19 Chris Dumez <cdumez@apple.com> 2 3 FetchResponse.formData() should not reject promise if the body is null and the MIME Type is "application/x-www-form-urlencoded" 4 https://bugs.webkit.org/show_bug.cgi?id=228085 5 6 Reviewed by Alex Christensen. 7 8 Rebaseline WPT tests now that more checks are passing. 9 10 * web-platform-tests/fetch/api/request/request-consume-empty.any-expected.txt: 11 * web-platform-tests/fetch/api/request/request-consume-empty.any.worker-expected.txt: 12 * web-platform-tests/fetch/api/response/response-consume-empty.any-expected.txt: 13 * web-platform-tests/fetch/api/response/response-consume-empty.any.worker-expected.txt: 14 1 15 2021-07-19 Chris Dumez <cdumez@apple.com> 2 16 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty.any-expected.txt
r279969 r280046 5 5 PASS Consume request's body as json (error case) 6 6 PASS Consume request's body as formData with correct multipart type (error case) 7 FAIL Consume request's body as formData with correct urlencoded type promise_test: Unhandled rejection with value: object "TypeError: Type error" 7 PASS Consume request's body as formData with correct urlencoded type 8 8 PASS Consume request's body as formData without correct type (error case) 9 9 PASS Consume empty blob request body as arrayBuffer -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty.any.worker-expected.txt
r279969 r280046 5 5 PASS Consume request's body as json (error case) 6 6 PASS Consume request's body as formData with correct multipart type (error case) 7 FAIL Consume request's body as formData with correct urlencoded type promise_test: Unhandled rejection with value: object "TypeError: Type error" 7 PASS Consume request's body as formData with correct urlencoded type 8 8 PASS Consume request's body as formData without correct type (error case) 9 9 PASS Consume empty blob request body as arrayBuffer -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-empty.any-expected.txt
r279969 r280046 5 5 PASS Consume response's body as json (error case) 6 6 PASS Consume response's body as formData with correct multipart type (error case) 7 FAIL Consume response's body as formData with correct urlencoded type promise_test: Unhandled rejection with value: object "TypeError: Type error" 7 PASS Consume response's body as formData with correct urlencoded type 8 8 PASS Consume response's body as formData without correct type (error case) 9 9 PASS Consume empty blob response body as arrayBuffer -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-empty.any.worker-expected.txt
r279969 r280046 5 5 PASS Consume response's body as json (error case) 6 6 PASS Consume response's body as formData with correct multipart type (error case) 7 FAIL Consume response's body as formData with correct urlencoded type promise_test: Unhandled rejection with value: object "TypeError: Type error" 7 PASS Consume response's body as formData with correct urlencoded type 8 8 PASS Consume response's body as formData without correct type (error case) 9 9 PASS Consume empty blob response body as arrayBuffer -
trunk/Source/WebCore/ChangeLog
r280024 r280046 1 2021-07-19 Chris Dumez <cdumez@apple.com> 2 3 FetchResponse.formData() should not reject promise if the body is null and the MIME Type is "application/x-www-form-urlencoded" 4 https://bugs.webkit.org/show_bug.cgi?id=228085 5 6 Reviewed by Alex Christensen. 7 8 FetchResponse.formData() should not reject promise if the body is null and the MIME Type is "application/x-www-form-urlencoded": 9 - https://fetch.spec.whatwg.org/#concept-body-consume-body 10 - https://fetch.spec.whatwg.org/#concept-body-package-data 11 12 As per the specification, we should package an empty byte sequence in this case and resolve the promise with that. 13 14 No new tests, rebaselined existing tests. 15 16 * Modules/fetch/FetchBodyConsumer.cpp: 17 (WebCore::FetchBodyConsumer::packageFormData): 18 (WebCore::resolveWithTypeAndData): 19 (WebCore::packageFormData): Deleted. 20 * Modules/fetch/FetchBodyConsumer.h: 21 * Modules/fetch/FetchBodyOwner.cpp: 22 (WebCore::FetchBodyOwner::formData): 23 1 24 2021-07-19 Ziran Sun <zsun@igalia.com> 2 25 -
trunk/Source/WebCore/Modules/fetch/FetchBodyConsumer.cpp
r278714 r280046 125 125 126 126 // https://fetch.spec.whatwg.org/#concept-body-package-data 127 static RefPtr<DOMFormData>packageFormData(ScriptExecutionContext* context, const String& contentType, const uint8_t* data, size_t length)127 RefPtr<DOMFormData> FetchBodyConsumer::packageFormData(ScriptExecutionContext* context, const String& contentType, const uint8_t* data, size_t length) 128 128 { 129 129 auto parseMultipartPart = [context] (const uint8_t* part, size_t partLength, DOMFormData& form) -> bool { … … 230 230 return; 231 231 case FetchBodyConsumer::Type::FormData: 232 if (auto formData = packageFormData(context, contentType, data, length))232 if (auto formData = FetchBodyConsumer::packageFormData(context, contentType, data, length)) 233 233 promise->resolve<IDLInterface<DOMFormData>>(*formData); 234 234 else -
trunk/Source/WebCore/Modules/fetch/FetchBodyConsumer.h
r278532 r280046 38 38 39 39 class Blob; 40 class DOMFormData; 40 41 class FetchBodySource; 41 42 class ReadableStream; … … 74 75 void setAsLoading() { m_isLoading = true; } 75 76 77 static RefPtr<DOMFormData> packageFormData(ScriptExecutionContext*, const String& contentType, const uint8_t* data, size_t length); 78 76 79 private: 77 80 Ref<Blob> takeAsBlob(ScriptExecutionContext*); -
trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp
r279969 r280046 35 35 #include "HTTPParsers.h" 36 36 #include "JSBlob.h" 37 #include "JSDOMFormData.h" 37 38 #include "ResourceError.h" 38 39 #include "ResourceResponse.h" … … 186 187 } 187 188 189 if (isDisturbedOrLocked()) { 190 promise->reject(Exception { TypeError, "Body is disturbed or locked"_s }); 191 return; 192 } 193 188 194 if (isBodyNullOrOpaque()) { 195 if (isBodyNull()) { 196 // 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. 197 if (auto formData = FetchBodyConsumer::packageFormData(promise->scriptExecutionContext(), m_contentType, nullptr, 0)) { 198 promise->resolve<IDLInterface<DOMFormData>>(*formData); 199 return; 200 } 201 } 202 189 203 promise->reject(TypeError); 190 204 return; 191 205 } 192 if (isDisturbedOrLocked()) { 193 promise->reject(Exception { TypeError, "Body is disturbed or locked"_s }); 194 return; 195 } 206 196 207 m_isDisturbed = true; 197 208 m_body->formData(*this, WTFMove(promise));
Note: See TracChangeset
for help on using the changeset viewer.