Title: [250822] trunk
Revision
250822
Author
commit-qu...@webkit.org
Date
2019-10-08 05:51:36 -0700 (Tue, 08 Oct 2019)

Log Message

Fetch: data: URL HEAD request should result in empty response body
https://bugs.webkit.org/show_bug.cgi?id=175764

Patch by Rob Buis <rb...@igalia.com> on 2019-10-08
Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Update improved test results.

* web-platform-tests/fetch/api/basic/scheme-data.any.js:
* web-platform-tests/xhr/data-uri-expected.txt:

Source/WebCore:

Do not build the response body for HEAD requests for data urls:
https://fetch.spec.whatwg.org/#concept-main-fetch (Step 13)

Tests: imported/web-platform-tests/fetch/api/basic/scheme-data.any.js
       imported/web-platform-tests/xhr/data-uri.html

* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::loadDataURL):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (250821 => 250822)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2019-10-08 12:22:21 UTC (rev 250821)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2019-10-08 12:51:36 UTC (rev 250822)
@@ -1,3 +1,15 @@
+2019-10-08  Rob Buis  <rb...@igalia.com>
+
+        Fetch: data: URL HEAD request should result in empty response body
+        https://bugs.webkit.org/show_bug.cgi?id=175764
+
+        Reviewed by Youenn Fablet.
+
+        Update improved test results.
+
+        * web-platform-tests/fetch/api/basic/scheme-data.any.js:
+        * web-platform-tests/xhr/data-uri-expected.txt:
+
 2019-10-08  Antti Koivisto  <an...@apple.com>
 
         [CSS Shadow Parts] Implement style invalidation

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data.any.js (250821 => 250822)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data.any.js	2019-10-08 12:22:21 UTC (rev 250821)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data.any.js	2019-10-08 12:51:36 UTC (rev 250822)
@@ -29,7 +29,7 @@
                    "response's body",
                    "image/png");
 checkFetchResponse("data:,response%27s%20body", "response's body", "text/plain;charset=US-ASCII", null, "POST");
-checkFetchResponse("data:,response%27s%20body", "response's body", "text/plain;charset=US-ASCII", null, "HEAD");
+checkFetchResponse("data:,response%27s%20body", "", "text/plain;charset=US-ASCII", null, "HEAD");
 
 function checkKoUrl(url, method, desc) {
   var cut = (url.length >= 40) ? "[...]" : "";

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/data-uri-expected.txt (250821 => 250822)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/data-uri-expected.txt	2019-10-08 12:22:21 UTC (rev 250821)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/data-uri-expected.txt	2019-10-08 12:51:36 UTC (rev 250822)
@@ -7,6 +7,6 @@
 PASS XHR method POST with MIME type text/plain 
 PASS XHR method PUT with MIME type text/plain 
 PASS XHR method DELETE with MIME type text/plain 
-FAIL XHR method HEAD with MIME type text/plain assert_equals: expected "" but got "Hello, World!"
+PASS XHR method HEAD with MIME type text/plain 
 PASS XHR method UNICORN with MIME type text/plain 
 

Modified: trunk/Source/WebCore/ChangeLog (250821 => 250822)


--- trunk/Source/WebCore/ChangeLog	2019-10-08 12:22:21 UTC (rev 250821)
+++ trunk/Source/WebCore/ChangeLog	2019-10-08 12:51:36 UTC (rev 250822)
@@ -1,3 +1,19 @@
+2019-10-08  Rob Buis  <rb...@igalia.com>
+
+        Fetch: data: URL HEAD request should result in empty response body
+        https://bugs.webkit.org/show_bug.cgi?id=175764
+
+        Reviewed by Youenn Fablet.
+
+        Do not build the response body for HEAD requests for data urls:
+        https://fetch.spec.whatwg.org/#concept-main-fetch (Step 13)
+
+        Tests: imported/web-platform-tests/fetch/api/basic/scheme-data.any.js
+               imported/web-platform-tests/xhr/data-uri.html
+
+        * loader/ResourceLoader.cpp:
+        (WebCore::ResourceLoader::loadDataURL):
+
 2019-10-08  Antti Koivisto  <an...@apple.com>
 
         [CSS Shadow Parts] Implement style invalidation

Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (250821 => 250822)


--- trunk/Source/WebCore/loader/ResourceLoader.cpp	2019-10-08 12:22:21 UTC (rev 250821)
+++ trunk/Source/WebCore/loader/ResourceLoader.cpp	2019-10-08 12:51:36 UTC (rev 250822)
@@ -285,7 +285,7 @@
         dataResponse.setHTTPHeaderField(HTTPHeaderName::ContentType, result.contentType);
         dataResponse.setSource(ResourceResponse::Source::Network);
         this->didReceiveResponse(dataResponse, [this, protectedThis = WTFMove(protectedThis), dataSize, data = "" mutable {
-            if (!this->reachedTerminalState() && dataSize)
+            if (!this->reachedTerminalState() && dataSize && m_request.httpMethod() != "HEAD")
                 this->didReceiveBuffer(WTFMove(data), dataSize, DataPayloadWholeResource);
 
             if (!this->reachedTerminalState()) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to