Title: [226162] trunk
Revision
226162
Author
[email protected]
Date
2017-12-19 17:15:58 -0800 (Tue, 19 Dec 2017)

Log Message

[Fetch] Extracting a body of type Blob should not set Content-Type to the empty string
https://bugs.webkit.org/show_bug.cgi?id=180991

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Rebaseline WPT test now that it is passing.

* web-platform-tests/service-workers/service-worker/invalid-blobtype.https-expected.txt:

Source/WebCore:

Extracting a body of type Blob should not set Content-Type to the empty string as per:
- https://fetch.spec.whatwg.org/#concept-bodyinit-extract

No new tests, rebaselined existing test.

* Modules/fetch/FetchBody.cpp:
(WebCore::FetchBody::extract):

Modified Paths

Diff

Modified: trunk/LayoutTests/http/wpt/fetch/fetch-as-blob.js (226161 => 226162)


--- trunk/LayoutTests/http/wpt/fetch/fetch-as-blob.js	2017-12-20 01:10:11 UTC (rev 226161)
+++ trunk/LayoutTests/http/wpt/fetch/fetch-as-blob.js	2017-12-20 01:15:58 UTC (rev 226162)
@@ -29,7 +29,7 @@
     return req.blob()
       .then(function(blob) {
           assert_equals(blob.type, '');
-          assert_equals(req.headers.get('Content-Type'), '');
+          assert_equals(req.headers.get('Content-Type'), null);
         });
   }, 'MIME type for Blob');
 

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (226161 => 226162)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2017-12-20 01:10:11 UTC (rev 226161)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2017-12-20 01:15:58 UTC (rev 226162)
@@ -1,5 +1,16 @@
 2017-12-19  Chris Dumez  <[email protected]>
 
+        [Fetch] Extracting a body of type Blob should not set Content-Type to the empty string
+        https://bugs.webkit.org/show_bug.cgi?id=180991
+
+        Reviewed by Youenn Fablet.
+
+        Rebaseline WPT test now that it is passing.
+
+        * web-platform-tests/service-workers/service-worker/invalid-blobtype.https-expected.txt:
+
+2017-12-19  Chris Dumez  <[email protected]>
+
         scopeURL should start with the provided scriptURL
         https://bugs.webkit.org/show_bug.cgi?id=180983
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any-expected.txt (226161 => 226162)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any-expected.txt	2017-12-20 01:10:11 UTC (rev 226161)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any-expected.txt	2017-12-20 01:15:58 UTC (rev 226162)
@@ -7,7 +7,7 @@
 PASS Fetch with POST with text body 
 PASS Fetch with POST with FormData body 
 PASS Fetch with POST with URLSearchParams body 
-FAIL Fetch with POST with Blob body assert_equals: Request should have header content-type: null expected (object) null but got (string) ""
+FAIL Fetch with POST with Blob body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"
 FAIL Fetch with POST with ArrayBuffer body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"
 FAIL Fetch with POST with Uint8Array body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"
 FAIL Fetch with POST with Int8Array body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any.worker-expected.txt (226161 => 226162)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any.worker-expected.txt	2017-12-20 01:10:11 UTC (rev 226161)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any.worker-expected.txt	2017-12-20 01:15:58 UTC (rev 226162)
@@ -7,7 +7,7 @@
 PASS Fetch with POST with text body 
 FAIL Fetch with POST with FormData body Can't find variable: FormData
 PASS Fetch with POST with URLSearchParams body 
-FAIL Fetch with POST with Blob body assert_equals: Request should have header content-type: null expected (object) null but got (string) ""
+FAIL Fetch with POST with Blob body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"
 FAIL Fetch with POST with ArrayBuffer body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"
 FAIL Fetch with POST with Uint8Array body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"
 FAIL Fetch with POST with Int8Array body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/invalid-blobtype.https-expected.txt (226161 => 226162)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/invalid-blobtype.https-expected.txt	2017-12-20 01:10:11 UTC (rev 226161)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/invalid-blobtype.https-expected.txt	2017-12-20 01:15:58 UTC (rev 226162)
@@ -1,4 +1,3 @@
 
+PASS Verify the response of FetchEvent using XMLHttpRequest 
 
-FAIL Verify the response of FetchEvent using XMLHttpRequest assert_equals: expected "finish" but got "failure:Content-Type must be null."
-

Modified: trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any-expected.txt (226161 => 226162)


--- trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any-expected.txt	2017-12-20 01:10:11 UTC (rev 226161)
+++ trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any-expected.txt	2017-12-20 01:15:58 UTC (rev 226162)
@@ -7,7 +7,7 @@
 PASS Fetch with POST with text body 
 PASS Fetch with POST with FormData body 
 PASS Fetch with POST with URLSearchParams body 
-FAIL Fetch with POST with Blob body assert_equals: Request should have header content-type: null expected (object) null but got (string) ""
+FAIL Fetch with POST with Blob body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"
 FAIL Fetch with POST with ArrayBuffer body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"
 FAIL Fetch with POST with Uint8Array body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"
 FAIL Fetch with POST with Int8Array body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"

Modified: trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any.worker-expected.txt (226161 => 226162)


--- trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any.worker-expected.txt	2017-12-20 01:10:11 UTC (rev 226161)
+++ trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any.worker-expected.txt	2017-12-20 01:15:58 UTC (rev 226162)
@@ -7,7 +7,7 @@
 PASS Fetch with POST with text body 
 FAIL Fetch with POST with FormData body Can't find variable: FormData
 PASS Fetch with POST with URLSearchParams body 
-FAIL Fetch with POST with Blob body assert_equals: Request should have header content-type: null expected (object) null but got (string) ""
+FAIL Fetch with POST with Blob body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"
 FAIL Fetch with POST with ArrayBuffer body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"
 FAIL Fetch with POST with Uint8Array body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"
 FAIL Fetch with POST with Int8Array body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"

Modified: trunk/LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any-expected.txt (226161 => 226162)


--- trunk/LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any-expected.txt	2017-12-20 01:10:11 UTC (rev 226161)
+++ trunk/LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any-expected.txt	2017-12-20 01:15:58 UTC (rev 226162)
@@ -7,7 +7,7 @@
 PASS Fetch with POST with text body 
 PASS Fetch with POST with FormData body 
 PASS Fetch with POST with URLSearchParams body 
-FAIL Fetch with POST with Blob body assert_equals: Request should have header content-type: null expected (object) null but got (string) ""
+FAIL Fetch with POST with Blob body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"
 FAIL Fetch with POST with ArrayBuffer body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"
 FAIL Fetch with POST with Uint8Array body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"
 FAIL Fetch with POST with Int8Array body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"

Modified: trunk/LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any.worker-expected.txt (226161 => 226162)


--- trunk/LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any.worker-expected.txt	2017-12-20 01:10:11 UTC (rev 226161)
+++ trunk/LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any.worker-expected.txt	2017-12-20 01:15:58 UTC (rev 226162)
@@ -7,7 +7,7 @@
 PASS Fetch with POST with text body 
 FAIL Fetch with POST with FormData body Can't find variable: FormData
 PASS Fetch with POST with URLSearchParams body 
-FAIL Fetch with POST with Blob body assert_equals: Request should have header content-type: null expected (object) null but got (string) ""
+FAIL Fetch with POST with Blob body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"
 FAIL Fetch with POST with ArrayBuffer body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"
 FAIL Fetch with POST with Uint8Array body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"
 FAIL Fetch with POST with Int8Array body assert_equals: Request should have header content-type: null expected (object) null but got (string) "application/x-www-form-urlencoded"

Modified: trunk/Source/WebCore/ChangeLog (226161 => 226162)


--- trunk/Source/WebCore/ChangeLog	2017-12-20 01:10:11 UTC (rev 226161)
+++ trunk/Source/WebCore/ChangeLog	2017-12-20 01:15:58 UTC (rev 226162)
@@ -1,3 +1,18 @@
+2017-12-19  Chris Dumez  <[email protected]>
+
+        [Fetch] Extracting a body of type Blob should not set Content-Type to the empty string
+        https://bugs.webkit.org/show_bug.cgi?id=180991
+
+        Reviewed by Youenn Fablet.
+
+        Extracting a body of type Blob should not set Content-Type to the empty string as per:
+        - https://fetch.spec.whatwg.org/#concept-bodyinit-extract
+
+        No new tests, rebaselined existing test.
+
+        * Modules/fetch/FetchBody.cpp:
+        (WebCore::FetchBody::extract):
+
 2017-12-19  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r226094.

Modified: trunk/Source/WebCore/Modules/fetch/FetchBody.cpp (226161 => 226162)


--- trunk/Source/WebCore/Modules/fetch/FetchBody.cpp	2017-12-20 01:10:11 UTC (rev 226161)
+++ trunk/Source/WebCore/Modules/fetch/FetchBody.cpp	2017-12-20 01:15:58 UTC (rev 226162)
@@ -44,7 +44,8 @@
 {
     return WTF::switchOn(value, [&](RefPtr<Blob>& value) mutable {
         Ref<const Blob> blob = value.releaseNonNull();
-        contentType = blob->type();
+        if (!blob->type().isEmpty())
+            contentType = blob->type();
         return FetchBody(WTFMove(blob));
     }, [&](RefPtr<DOMFormData>& value) mutable {
         Ref<DOMFormData> domFormData = value.releaseNonNull();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to