Title: [215814] trunk
Revision
215814
Author
[email protected]
Date
2017-04-26 11:14:41 -0700 (Wed, 26 Apr 2017)

Log Message

Response.blob() does not set the content-type based on the header value.
https://bugs.webkit.org/show_bug.cgi?id=170849

Patch by WebKit Contributor <[email protected]> on 2017-04-26
Reviewed by Alex Christensen.

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.  Previously the
FetchResponse class only called updateContentType() when first
created even though all the headers were not available.  Call
updateContentType() again after the headers are populated.

This change allows WebKit to pass the "Consume response's body: from
fetch 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::BodyLoader::didReceiveResponse): Modified to
call FetchBodyOwner::updateContentType() after filling m_headers.

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (215813 => 215814)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2017-04-26 18:11:27 UTC (rev 215813)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2017-04-26 18:14:41 UTC (rev 215814)
@@ -1,3 +1,12 @@
+2017-04-26  WebKit Contributor  <[email protected]>
+
+        Response.blob() does not set the content-type based on the header value.
+        https://bugs.webkit.org/show_bug.cgi?id=170849
+
+        Reviewed by Alex Christensen.
+
+        * web-platform-tests/fetch/api/response/response-consume-expected.txt:
+
 2017-04-25  Daniel Bates  <[email protected]>
 
         [Cocoa][Win] Enable of X-Content-Type-Options: nosniff header

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-expected.txt (215813 => 215814)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-expected.txt	2017-04-26 18:11:27 UTC (rev 215813)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-expected.txt	2017-04-26 18:14:41 UTC (rev 215814)
@@ -33,7 +33,7 @@
 FAIL Consume response's body: from stream without correct multipart type to formData (error case) assert_throws: function "function () { throw e }" threw "Not implemented" (undefined) expected object "TypeError" ("TypeError")
 FAIL Consume response's body: from stream with correct urlencoded type to formData promise_test: Unhandled rejection with value: "Not implemented"
 FAIL Consume response's body: from stream without correct urlencoded type to formData (error case) assert_throws: function "function () { throw e }" threw "Not implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Consume response's body: from fetch 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 fetch to blob 
 PASS Consume response's body: from fetch to text 
 PASS Consume response's body: from fetch to arrayBuffer 
 FAIL Consume response's body: from fetch without correct type to formData (error case) assert_throws: function "function () { throw e }" threw "Not implemented" (undefined) expected object "TypeError" ("TypeError")

Modified: trunk/Source/WebCore/ChangeLog (215813 => 215814)


--- trunk/Source/WebCore/ChangeLog	2017-04-26 18:11:27 UTC (rev 215813)
+++ trunk/Source/WebCore/ChangeLog	2017-04-26 18:14:41 UTC (rev 215814)
@@ -1,3 +1,25 @@
+2017-04-26  WebKit Contributor  <[email protected]>
+
+        Response.blob() does not set the content-type based on the header value.
+        https://bugs.webkit.org/show_bug.cgi?id=170849
+
+        Reviewed by Alex Christensen.
+
+        The Fetch API specification requires setting the blob contentType
+        using the Content-Type header value, if present.  Previously the
+        FetchResponse class only called updateContentType() when first
+        created even though all the headers were not available.  Call
+        updateContentType() again after the headers are populated.
+
+        This change allows WebKit to pass the "Consume response's body: from
+        fetch 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::BodyLoader::didReceiveResponse): Modified to
+        call FetchBodyOwner::updateContentType() after filling m_headers.
+
 2017-04-26  Andy Estes  <[email protected]>
 
         Try to fix the macOS Sierra build.

Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp (215813 => 215814)


--- trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp	2017-04-26 18:11:27 UTC (rev 215813)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp	2017-04-26 18:14:41 UTC (rev 215814)
@@ -173,6 +173,7 @@
 
     m_response.m_response = resourceResponse;
     m_response.m_headers->filterAndFill(resourceResponse.httpHeaderFields(), FetchHeaders::Guard::Response);
+    m_response.updateContentType();
 
     std::exchange(m_promise, std::nullopt)->resolve(m_response);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to