Changeset 226162 in webkit


Ignore:
Timestamp:
Dec 19, 2017 5:15:58 PM (6 years ago)
Author:
Chris Dumez
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:

No new tests, rebaselined existing test.

  • Modules/fetch/FetchBody.cpp:

(WebCore::FetchBody::extract):

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/http/wpt/fetch/fetch-as-blob.js

    r216725 r226162  
    3030      .then(function(blob) {
    3131          assert_equals(blob.type, '');
    32           assert_equals(req.headers.get('Content-Type'), '');
     32          assert_equals(req.headers.get('Content-Type'), null);
    3333        });
    3434  }, 'MIME type for Blob');
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r226141 r226162  
     12017-12-19  Chris Dumez  <cdumez@apple.com>
     2
     3        [Fetch] Extracting a body of type Blob should not set Content-Type to the empty string
     4        https://bugs.webkit.org/show_bug.cgi?id=180991
     5
     6        Reviewed by Youenn Fablet.
     7
     8        Rebaseline WPT test now that it is passing.
     9
     10        * web-platform-tests/service-workers/service-worker/invalid-blobtype.https-expected.txt:
     11
    1122017-12-19  Chris Dumez  <cdumez@apple.com>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any-expected.txt

    r220817 r226162  
    88PASS Fetch with POST with FormData body
    99PASS Fetch with POST with URLSearchParams body
    10 FAIL Fetch with POST with Blob body assert_equals: Request should have header content-type: null expected (object) null but got (string) ""
     10FAIL 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"
    1111FAIL 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"
    1212FAIL 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"
  • trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any.worker-expected.txt

    r220817 r226162  
    88FAIL Fetch with POST with FormData body Can't find variable: FormData
    99PASS Fetch with POST with URLSearchParams body
    10 FAIL Fetch with POST with Blob body assert_equals: Request should have header content-type: null expected (object) null but got (string) ""
     10FAIL 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"
    1111FAIL 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"
    1212FAIL 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"
  • trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/invalid-blobtype.https-expected.txt

    r224218 r226162  
    11
     2PASS Verify the response of FetchEvent using XMLHttpRequest
    23
    3 FAIL Verify the response of FetchEvent using XMLHttpRequest assert_equals: expected "finish" but got "failure:Content-Type must be null."
    4 
  • trunk/LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any-expected.txt

    r222111 r226162  
    88PASS Fetch with POST with FormData body
    99PASS Fetch with POST with URLSearchParams body
    10 FAIL Fetch with POST with Blob body assert_equals: Request should have header content-type: null expected (object) null but got (string) ""
     10FAIL 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"
    1111FAIL 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"
    1212FAIL 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"
  • trunk/LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any.worker-expected.txt

    r222111 r226162  
    88FAIL Fetch with POST with FormData body Can't find variable: FormData
    99PASS Fetch with POST with URLSearchParams body
    10 FAIL Fetch with POST with Blob body assert_equals: Request should have header content-type: null expected (object) null but got (string) ""
     10FAIL 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"
    1111FAIL 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"
    1212FAIL 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"
  • trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any-expected.txt

    r222307 r226162  
    88PASS Fetch with POST with FormData body
    99PASS Fetch with POST with URLSearchParams body
    10 FAIL Fetch with POST with Blob body assert_equals: Request should have header content-type: null expected (object) null but got (string) ""
     10FAIL 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"
    1111FAIL 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"
    1212FAIL 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"
  • trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any.worker-expected.txt

    r222307 r226162  
    88FAIL Fetch with POST with FormData body Can't find variable: FormData
    99PASS Fetch with POST with URLSearchParams body
    10 FAIL Fetch with POST with Blob body assert_equals: Request should have header content-type: null expected (object) null but got (string) ""
     10FAIL 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"
    1111FAIL 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"
    1212FAIL 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"
  • trunk/Source/WebCore/ChangeLog

    r226161 r226162  
     12017-12-19  Chris Dumez  <cdumez@apple.com>
     2
     3        [Fetch] Extracting a body of type Blob should not set Content-Type to the empty string
     4        https://bugs.webkit.org/show_bug.cgi?id=180991
     5
     6        Reviewed by Youenn Fablet.
     7
     8        Extracting a body of type Blob should not set Content-Type to the empty string as per:
     9        - https://fetch.spec.whatwg.org/#concept-bodyinit-extract
     10
     11        No new tests, rebaselined existing test.
     12
     13        * Modules/fetch/FetchBody.cpp:
     14        (WebCore::FetchBody::extract):
     15
    1162017-12-19  Commit Queue  <commit-queue@webkit.org>
    217
  • trunk/Source/WebCore/Modules/fetch/FetchBody.cpp

    r225618 r226162  
    4545    return WTF::switchOn(value, [&](RefPtr<Blob>& value) mutable {
    4646        Ref<const Blob> blob = value.releaseNonNull();
    47         contentType = blob->type();
     47        if (!blob->type().isEmpty())
     48            contentType = blob->type();
    4849        return FetchBody(WTFMove(blob));
    4950    }, [&](RefPtr<DOMFormData>& value) mutable {
Note: See TracChangeset for help on using the changeset viewer.