Title: [216073] trunk
- Revision
- 216073
- Author
- [email protected]
- Date
- 2017-05-02 09:58:33 -0700 (Tue, 02 May 2017)
Log Message
Set Response.blob() type correctly when body is a ReadableStream.
https://bugs.webkit.org/show_bug.cgi?id=171489
Patch by Ben Kelly <[email protected]> on 2017-05-02
Reviewed by Youenn Fablet
LayoutTests/imported/w3c:
* web-platform-tests/fetch/api/response/response-consume-expected.txt:
Source/WebCore:
The Fetch API specification requires setting the blob contentType
using the Content-Type header value, if present. Currently WebKit
only sets the type on the FetchBodyConsumer when FetchBody::blob()
is called. Unfortunately, this is never called if the body is
actually a ReadableStream.
This change allows WebKit to pass the "Consume response's body: from
stream to blob" case in the WPT response-consume.html test.
Test: http://w3c-test.org/fetch/api/response/response-consume.html
* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::startConsumingStream): Modified to call
FetchBodyConsumer::setContentType() before processing the stream.
Modified Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (216072 => 216073)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2017-05-02 16:52:51 UTC (rev 216072)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2017-05-02 16:58:33 UTC (rev 216073)
@@ -1,3 +1,12 @@
+2017-05-02 Ben Kelly <[email protected]>
+
+ Set Response.blob() type correctly when body is a ReadableStream.
+ https://bugs.webkit.org/show_bug.cgi?id=171489
+
+ Reviewed by Youenn Fablet
+
+ * web-platform-tests/fetch/api/response/response-consume-expected.txt:
+
2017-05-01 Joseph Pecoraro <[email protected]>
Eliminate ?pipe=sub from Resource Timing Tests
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-expected.txt (216072 => 216073)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-expected.txt 2017-05-02 16:52:51 UTC (rev 216072)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-expected.txt 2017-05-02 16:58:33 UTC (rev 216073)
@@ -25,7 +25,7 @@
FAIL Consume response's body: from URLSearchParams to blob assert_equals: Blob body type should be computed from the response Content-Type expected "application/x-www-form-urlencoded;charset=utf-8" but got "application/x-www-form-urlencoded"
PASS Consume response's body: from URLSearchParams to text
PASS Consume response's body: from URLSearchParams to arrayBuffer
-FAIL Consume response's body: from stream to blob assert_equals: Blob body type should be computed from the response Content-Type expected "text/plain" but got ""
+PASS Consume response's body: from stream to blob
PASS Consume response's body: from stream to text
PASS Consume response's body: from stream to arrayBuffer
PASS Consume response's body: from stream to json
Modified: trunk/Source/WebCore/ChangeLog (216072 => 216073)
--- trunk/Source/WebCore/ChangeLog 2017-05-02 16:52:51 UTC (rev 216072)
+++ trunk/Source/WebCore/ChangeLog 2017-05-02 16:58:33 UTC (rev 216073)
@@ -1,3 +1,25 @@
+2017-05-02 Ben Kelly <[email protected]>
+
+ Set Response.blob() type correctly when body is a ReadableStream.
+ https://bugs.webkit.org/show_bug.cgi?id=171489
+
+ Reviewed by Youenn Fablet
+
+ The Fetch API specification requires setting the blob contentType
+ using the Content-Type header value, if present. Currently WebKit
+ only sets the type on the FetchBodyConsumer when FetchBody::blob()
+ is called. Unfortunately, this is never called if the body is
+ actually a ReadableStream.
+
+ This change allows WebKit to pass the "Consume response's body: from
+ stream to blob" case in the WPT response-consume.html test.
+
+ Test: http://w3c-test.org/fetch/api/response/response-consume.html
+
+ * Modules/fetch/FetchResponse.cpp:
+ (WebCore::FetchResponse::startConsumingStream): Modified to call
+ FetchBodyConsumer::setContentType() before processing the stream.
+
2017-05-02 Ryan Haddad <[email protected]>
Unreviewed, rolling out r216069.
Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp (216072 => 216073)
--- trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp 2017-05-02 16:52:51 UTC (rev 216072)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp 2017-05-02 16:58:33 UTC (rev 216073)
@@ -250,7 +250,10 @@
void FetchResponse::startConsumingStream(unsigned type)
{
m_isDisturbed = true;
- m_consumer.setType(static_cast<FetchBodyConsumer::Type>(type));
+ auto consumerType = static_cast<FetchBodyConsumer::Type>(type);
+ m_consumer.setType(consumerType);
+ if (consumerType == FetchBodyConsumer::Type::Blob)
+ m_consumer.setContentType(Blob::normalizedContentType(extractMIMETypeFromMediaType(m_contentType)));
}
void FetchResponse::consumeChunk(Ref<JSC::Uint8Array>&& chunk)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes