Changeset 195954 in webkit


Ignore:
Timestamp:
Feb 1, 2016 3:05:39 AM (8 years ago)
Author:
youenn.fablet@crf.canon.fr
Message:

[Fetch API] Implement Fetch API Request
https://bugs.webkit.org/show_bug.cgi?id=153437

LayoutTests/imported/w3c:

Reviewed by Darin Adler.

  • web-platform-tests/fetch/api/headers/headers-basic.html:
  • web-platform-tests/fetch/api/request/request-clone.sub-expected.txt: Added.
  • web-platform-tests/fetch/api/request/request-clone.sub.html: Added.
  • web-platform-tests/fetch/api/request/request-consume-expected.txt: Added.
  • web-platform-tests/fetch/api/request/request-consume.html: Added.
  • web-platform-tests/fetch/api/request/request-disturbed-expected.txt: Added.
  • web-platform-tests/fetch/api/request/request-disturbed.html: Added.
  • web-platform-tests/fetch/api/request/request-error-expected.txt: Added.
  • web-platform-tests/fetch/api/request/request-error.html: Added.
  • web-platform-tests/fetch/api/request/request-headers-expected.txt: Added.
  • web-platform-tests/fetch/api/request/request-headers.html: Added.
  • web-platform-tests/fetch/api/request/request-idl-expected.txt: Added.
  • web-platform-tests/fetch/api/request/request-idl.html: Added.
  • web-platform-tests/fetch/api/request/request-init-001.sub-expected.txt: Added.
  • web-platform-tests/fetch/api/request/request-init-001.sub.html: Added.
  • web-platform-tests/fetch/api/request/request-init-002-expected.txt: Added.
  • web-platform-tests/fetch/api/request/request-init-002.html: Added.
  • web-platform-tests/fetch/api/request/request-init-003.sub-expected.txt: Added.
  • web-platform-tests/fetch/api/request/request-init-003.sub.html: Added.
  • web-platform-tests/fetch/api/request/request-structure-expected.txt: Added.
  • web-platform-tests/fetch/api/request/request-structure.html: Added.
  • web-platform-tests/fetch/api/resources/authentication.py: Added.

(main):

  • web-platform-tests/fetch/api/resources/clean-stash.py: Added.

(main):

  • web-platform-tests/fetch/api/resources/inspect-headers.py: Added.

(main):

  • web-platform-tests/fetch/api/resources/method.py: Added.

(main):

  • web-platform-tests/fetch/api/resources/preflight.py: Added.

(main):

  • web-platform-tests/fetch/api/resources/redirect.py: Added.

(main):

  • web-platform-tests/fetch/api/resources/top.txt: Added.
  • web-platform-tests/fetch/api/resources/trickle.py: Added.

(main):

  • web-platform-tests/fetch/api/resources/utils.js: Added.

(catch):
(dirname):
(checkRequest):
(readTextStream):

Source/WebCore:

Added support for Fetch Request and Body.
Body is sharing functionality between Request and Response.
Conversion between various body types are not implemented yet.

Added a FetchOptions class. Options in this class are partially redundant with ResourceLoaderOptions.

Fixing bug in Headers constructor.
Making error reporting in case of modifying headers compliant with the spec.

Reviewed by Darin Adler.

Tests: imported/w3c/web-platform-tests/fetch/api/request/request-clone.sub.html

imported/w3c/web-platform-tests/fetch/api/request/request-consume.html
imported/w3c/web-platform-tests/fetch/api/request/request-disturbed.html
imported/w3c/web-platform-tests/fetch/api/request/request-error.html
imported/w3c/web-platform-tests/fetch/api/request/request-headers.html
imported/w3c/web-platform-tests/fetch/api/request/request-idl.html
imported/w3c/web-platform-tests/fetch/api/request/request-init-001.sub.html
imported/w3c/web-platform-tests/fetch/api/request/request-init-002.html
imported/w3c/web-platform-tests/fetch/api/request/request-init-003.sub.html
imported/w3c/web-platform-tests/fetch/api/request/request-structure.html

  • CMakeLists.txt:
  • DerivedSources.cpp:
  • DerivedSources.make:
  • Modules/fetch/FetchBody.cpp: Added.

(WebCore::FetchBody::initBody):
(WebCore::FetchBody::clear):
(WebCore::FetchBody::processIfEmptyOrDisturbed):
(WebCore::FetchBody::arrayBuffer):
(WebCore::FetchBody::formData):
(WebCore::FetchBody::blob):
(WebCore::FetchBody::text):
(WebCore::FetchBody::json):

  • Modules/fetch/FetchBody.h: Added.

(WebCore::FetchBody::~FetchBody):
(WebCore::FetchBody::isEmpty):
(WebCore::FetchBody::isDisturbed):
(WebCore::FetchBody::setDisturbed):
(WebCore::FetchBody::setMimeType):
(WebCore::FetchBody::mimeType):

  • Modules/fetch/FetchBody.idl: Added.
  • Modules/fetch/FetchHeaders.cpp:

(WebCore::canWriteHeader):
(WebCore::FetchHeaders::append):
(WebCore::FetchHeaders::remove):
(WebCore::FetchHeaders::set):
(WebCore::FetchHeaders::fill): Helper routine implementing https://fetch.spec.whatwg.org/#concept-headers-fill

  • Modules/fetch/FetchHeaders.h: Adding header getter/setter for FetchRequest.

(WebCore::FetchHeaders::fastGet):
(WebCore::FetchHeaders::fastSet):

  • Modules/fetch/FetchHeaders.js: Fixing bug in constructor (covered by modified headers-basc.html test).

(initializeFetchHeaders):

  • Modules/fetch/FetchOptions.h: Added.

(WebCore::FetchOptions::FetchOptions):
(WebCore::FetchOptions::type):
(WebCore::FetchOptions::destination):
(WebCore::FetchOptions::mode):
(WebCore::FetchOptions::credentials):
(WebCore::FetchOptions::cache):
(WebCore::FetchOptions::redirect):
(WebCore::FetchOptions::referrerPolicy):
(WebCore::FetchOptions::setType):
(WebCore::FetchOptions::setDestination):
(WebCore::FetchOptions::setMode):
(WebCore::FetchOptions::setCredentials):
(WebCore::FetchOptions::setCache):
(WebCore::FetchOptions::setRedirect):
(WebCore::FetchOptions::setReferrerPolicy):

  • Modules/fetch/FetchRequest.cpp: Added.

(WebCore::FetchRequest::create):
(WebCore::FetchRequest::FetchRequest):
(WebCore::FetchRequest::init):
(WebCore::FetchRequest::setReferrer):
(WebCore::FetchRequest::setReferrerPolicy):
(WebCore::FetchRequest::setMode):
(WebCore::FetchRequest::setCredentials):
(WebCore::FetchRequest::setCache):
(WebCore::FetchRequest::setRedirect):
(WebCore::FetchRequest::type):
(WebCore::FetchRequest::destination):
(WebCore::FetchRequest::referrerPolicy):
(WebCore::FetchRequest::referrer):
(WebCore::FetchRequest::mode):
(WebCore::FetchRequest::credentials):
(WebCore::FetchRequest::cache):
(WebCore::FetchRequest::redirect):
(WebCore::FetchRequest::setMethod):
(WebCore::FetchRequest::clone):

  • Modules/fetch/FetchRequest.h: Added.

(WebCore::FetchRequest::method):
(WebCore::FetchRequest::url):
(WebCore::FetchRequest::integrity):
(WebCore::FetchRequest::headers):

  • Modules/fetch/FetchRequest.idl: Added.
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/Dictionary.h:

(WebCore::Dictionary::execState):

  • bindings/js/JSDictionary.cpp:

(WebCore::JSDictionary::convertValue):

  • bindings/js/JSDictionary.h:

(WebCore::JSDictionary::get):

LayoutTests:

Reviewed by Darin Adler.

  • js/dom/global-constructors-attributes-dedicated-worker-expected.txt:
  • js/dom/global-constructors-attributes-expected.txt:
  • platform/efl/js/dom/global-constructors-attributes-dedicated-worker-expected.txt:
  • platform/efl/js/dom/global-constructors-attributes-expected.txt:
  • platform/gtk/js/dom/global-constructors-attributes-expected.txt:
  • platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt:
  • platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt:
  • platform/mac/js/dom/global-constructors-attributes-expected.txt:
  • platform/win/js/dom/global-constructors-attributes-expected.txt:
Location:
trunk
Files:
36 added
23 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r195953 r195954  
     12016-02-01  Youenn Fablet  <youenn.fablet@crf.canon.fr>
     2
     3        [Fetch API] Implement Fetch API Request
     4        https://bugs.webkit.org/show_bug.cgi?id=153437
     5
     6        Reviewed by Darin Adler.
     7
     8        * js/dom/global-constructors-attributes-dedicated-worker-expected.txt:
     9        * js/dom/global-constructors-attributes-expected.txt:
     10        * platform/efl/js/dom/global-constructors-attributes-dedicated-worker-expected.txt:
     11        * platform/efl/js/dom/global-constructors-attributes-expected.txt:
     12        * platform/gtk/js/dom/global-constructors-attributes-expected.txt:
     13        * platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt:
     14        * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt:
     15        * platform/mac/js/dom/global-constructors-attributes-expected.txt:
     16        * platform/win/js/dom/global-constructors-attributes-expected.txt:
     17
    1182016-01-31  Jeremy Jones  <jeremyj@apple.com>
    219
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r195953 r195954  
     12016-02-01  Youenn Fablet  <youenn.fablet@crf.canon.fr>
     2
     3        [Fetch API] Implement Fetch API Request
     4        https://bugs.webkit.org/show_bug.cgi?id=153437
     5
     6        Reviewed by Darin Adler.
     7
     8        * web-platform-tests/fetch/api/headers/headers-basic.html:
     9        * web-platform-tests/fetch/api/request/request-clone.sub-expected.txt: Added.
     10        * web-platform-tests/fetch/api/request/request-clone.sub.html: Added.
     11        * web-platform-tests/fetch/api/request/request-consume-expected.txt: Added.
     12        * web-platform-tests/fetch/api/request/request-consume.html: Added.
     13        * web-platform-tests/fetch/api/request/request-disturbed-expected.txt: Added.
     14        * web-platform-tests/fetch/api/request/request-disturbed.html: Added.
     15        * web-platform-tests/fetch/api/request/request-error-expected.txt: Added.
     16        * web-platform-tests/fetch/api/request/request-error.html: Added.
     17        * web-platform-tests/fetch/api/request/request-headers-expected.txt: Added.
     18        * web-platform-tests/fetch/api/request/request-headers.html: Added.
     19        * web-platform-tests/fetch/api/request/request-idl-expected.txt: Added.
     20        * web-platform-tests/fetch/api/request/request-idl.html: Added.
     21        * web-platform-tests/fetch/api/request/request-init-001.sub-expected.txt: Added.
     22        * web-platform-tests/fetch/api/request/request-init-001.sub.html: Added.
     23        * web-platform-tests/fetch/api/request/request-init-002-expected.txt: Added.
     24        * web-platform-tests/fetch/api/request/request-init-002.html: Added.
     25        * web-platform-tests/fetch/api/request/request-init-003.sub-expected.txt: Added.
     26        * web-platform-tests/fetch/api/request/request-init-003.sub.html: Added.
     27        * web-platform-tests/fetch/api/request/request-structure-expected.txt: Added.
     28        * web-platform-tests/fetch/api/request/request-structure.html: Added.
     29        * web-platform-tests/fetch/api/resources/authentication.py: Added.
     30        (main):
     31        * web-platform-tests/fetch/api/resources/clean-stash.py: Added.
     32        (main):
     33        * web-platform-tests/fetch/api/resources/inspect-headers.py: Added.
     34        (main):
     35        * web-platform-tests/fetch/api/resources/method.py: Added.
     36        (main):
     37        * web-platform-tests/fetch/api/resources/preflight.py: Added.
     38        (main):
     39        * web-platform-tests/fetch/api/resources/redirect.py: Added.
     40        (main):
     41        * web-platform-tests/fetch/api/resources/top.txt: Added.
     42        * web-platform-tests/fetch/api/resources/trickle.py: Added.
     43        (main):
     44        * web-platform-tests/fetch/api/resources/utils.js: Added.
     45        (catch):
     46        (dirname):
     47        (checkRequest):
     48        (readTextStream):
     49
    1502016-01-31  Jeremy Jones  <jeremyj@apple.com>
    251
  • trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic.html

    r195530 r195954  
    4949            "name: " + name + " has value: " + headerDict[name]);
    5050        }
     51        assert_equals(headers.get("length"), null, "init should be treated as a sequence, not as a dictionary");
    5152      }, "Create headers with sequence");
    5253
  • trunk/LayoutTests/js/dom/global-constructors-attributes-dedicated-worker-expected.txt

    r195530 r195954  
    6565PASS [Worker] Object.getOwnPropertyDescriptor(global, 'ReadableStream').enumerable is false
    6666PASS [Worker] Object.getOwnPropertyDescriptor(global, 'ReadableStream').configurable is true
     67PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Request').value is Request
     68PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Request').hasOwnProperty('get') is false
     69PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Request').hasOwnProperty('set') is false
     70PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Request').enumerable is false
     71PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Request').configurable is true
    6772PASS [Worker] Object.getOwnPropertyDescriptor(global, 'URL').value is URL
    6873PASS [Worker] Object.getOwnPropertyDescriptor(global, 'URL').hasOwnProperty('get') is false
  • trunk/LayoutTests/js/dom/global-constructors-attributes-expected.txt

    r195731 r195954  
    939939PASS Object.getOwnPropertyDescriptor(global, 'ProgressEvent').enumerable is false
    940940PASS Object.getOwnPropertyDescriptor(global, 'ProgressEvent').configurable is true
     941PASS Object.getOwnPropertyDescriptor(global, 'Request').value is Request
     942PASS Object.getOwnPropertyDescriptor(global, 'Request').hasOwnProperty('get') is false
     943PASS Object.getOwnPropertyDescriptor(global, 'Request').hasOwnProperty('set') is false
     944PASS Object.getOwnPropertyDescriptor(global, 'Request').enumerable is false
     945PASS Object.getOwnPropertyDescriptor(global, 'Request').configurable is true
    941946PASS Object.getOwnPropertyDescriptor(global, 'RGBColor').value is RGBColor
    942947PASS Object.getOwnPropertyDescriptor(global, 'RGBColor').hasOwnProperty('get') is false
  • trunk/LayoutTests/platform/efl/js/dom/global-constructors-attributes-dedicated-worker-expected.txt

    r195530 r195954  
    6565PASS [Worker] Object.getOwnPropertyDescriptor(global, 'ReadableStream').enumerable is false
    6666PASS [Worker] Object.getOwnPropertyDescriptor(global, 'ReadableStream').configurable is true
     67PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Request').value is Request
     68PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Request').hasOwnProperty('get') is false
     69PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Request').hasOwnProperty('set') is false
     70PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Request').enumerable is false
     71PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Request').configurable is true
    6772PASS [Worker] Object.getOwnPropertyDescriptor(global, 'URL').value is URL
    6873PASS [Worker] Object.getOwnPropertyDescriptor(global, 'URL').hasOwnProperty('get') is false
  • trunk/LayoutTests/platform/efl/js/dom/global-constructors-attributes-expected.txt

    r195731 r195954  
    999999PASS Object.getOwnPropertyDescriptor(global, 'ProgressEvent').enumerable is false
    10001000PASS Object.getOwnPropertyDescriptor(global, 'ProgressEvent').configurable is true
     1001PASS Object.getOwnPropertyDescriptor(global, 'Request').value is Request
     1002PASS Object.getOwnPropertyDescriptor(global, 'Request').hasOwnProperty('get') is false
     1003PASS Object.getOwnPropertyDescriptor(global, 'Request').hasOwnProperty('set') is false
     1004PASS Object.getOwnPropertyDescriptor(global, 'Request').enumerable is false
     1005PASS Object.getOwnPropertyDescriptor(global, 'Request').configurable is true
    10011006PASS Object.getOwnPropertyDescriptor(global, 'RGBColor').value is RGBColor
    10021007PASS Object.getOwnPropertyDescriptor(global, 'RGBColor').hasOwnProperty('get') is false
  • trunk/LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt

    r195731 r195954  
    10191019PASS Object.getOwnPropertyDescriptor(global, 'ProgressEvent').enumerable is false
    10201020PASS Object.getOwnPropertyDescriptor(global, 'ProgressEvent').configurable is true
     1021PASS Object.getOwnPropertyDescriptor(global, 'Request').value is Request
     1022PASS Object.getOwnPropertyDescriptor(global, 'Request').hasOwnProperty('get') is false
     1023PASS Object.getOwnPropertyDescriptor(global, 'Request').hasOwnProperty('set') is false
     1024PASS Object.getOwnPropertyDescriptor(global, 'Request').enumerable is false
     1025PASS Object.getOwnPropertyDescriptor(global, 'Request').configurable is true
    10211026PASS Object.getOwnPropertyDescriptor(global, 'RGBColor').value is RGBColor
    10221027PASS Object.getOwnPropertyDescriptor(global, 'RGBColor').hasOwnProperty('get') is false
  • trunk/LayoutTests/platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt

    r195731 r195954  
    999999PASS Object.getOwnPropertyDescriptor(global, 'ProgressEvent').enumerable is false
    10001000PASS Object.getOwnPropertyDescriptor(global, 'ProgressEvent').configurable is true
     1001PASS Object.getOwnPropertyDescriptor(global, 'Request').value is Request
     1002PASS Object.getOwnPropertyDescriptor(global, 'Request').hasOwnProperty('get') is false
     1003PASS Object.getOwnPropertyDescriptor(global, 'Request').hasOwnProperty('set') is false
     1004PASS Object.getOwnPropertyDescriptor(global, 'Request').enumerable is false
     1005PASS Object.getOwnPropertyDescriptor(global, 'Request').configurable is true
    10011006PASS Object.getOwnPropertyDescriptor(global, 'RGBColor').value is RGBColor
    10021007PASS Object.getOwnPropertyDescriptor(global, 'RGBColor').hasOwnProperty('get') is false
  • trunk/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt

    r195731 r195954  
    10741074PASS Object.getOwnPropertyDescriptor(global, 'Rect').enumerable is false
    10751075PASS Object.getOwnPropertyDescriptor(global, 'Rect').configurable is true
     1076PASS Object.getOwnPropertyDescriptor(global, 'Request').value is Request
     1077PASS Object.getOwnPropertyDescriptor(global, 'Request').hasOwnProperty('get') is false
     1078PASS Object.getOwnPropertyDescriptor(global, 'Request').hasOwnProperty('set') is false
     1079PASS Object.getOwnPropertyDescriptor(global, 'Request').enumerable is false
     1080PASS Object.getOwnPropertyDescriptor(global, 'Request').configurable is true
    10761081PASS Object.getOwnPropertyDescriptor(global, 'SQLException').value is SQLException
    10771082PASS Object.getOwnPropertyDescriptor(global, 'SQLException').hasOwnProperty('get') is false
  • trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt

    r195731 r195954  
    10241024PASS Object.getOwnPropertyDescriptor(global, 'ProgressEvent').enumerable is false
    10251025PASS Object.getOwnPropertyDescriptor(global, 'ProgressEvent').configurable is true
     1026PASS Object.getOwnPropertyDescriptor(global, 'Request').value is Request
     1027PASS Object.getOwnPropertyDescriptor(global, 'Request').hasOwnProperty('get') is false
     1028PASS Object.getOwnPropertyDescriptor(global, 'Request').hasOwnProperty('set') is false
     1029PASS Object.getOwnPropertyDescriptor(global, 'Request').enumerable is false
     1030PASS Object.getOwnPropertyDescriptor(global, 'Request').configurable is true
    10261031PASS Object.getOwnPropertyDescriptor(global, 'RGBColor').value is RGBColor
    10271032PASS Object.getOwnPropertyDescriptor(global, 'RGBColor').hasOwnProperty('get') is false
  • trunk/LayoutTests/platform/win/js/dom/global-constructors-attributes-expected.txt

    r195731 r195954  
    874874PASS Object.getOwnPropertyDescriptor(global, 'ProgressEvent').enumerable is false
    875875PASS Object.getOwnPropertyDescriptor(global, 'ProgressEvent').configurable is true
     876PASS Object.getOwnPropertyDescriptor(global, 'Request').value is Request
     877PASS Object.getOwnPropertyDescriptor(global, 'Request').hasOwnProperty('get') is false
     878PASS Object.getOwnPropertyDescriptor(global, 'Request').hasOwnProperty('set') is false
     879PASS Object.getOwnPropertyDescriptor(global, 'Request').enumerable is false
     880PASS Object.getOwnPropertyDescriptor(global, 'Request').configurable is true
    876881PASS Object.getOwnPropertyDescriptor(global, 'RGBColor').value is RGBColor
    877882PASS Object.getOwnPropertyDescriptor(global, 'RGBColor').hasOwnProperty('get') is false
  • trunk/Source/WebCore/CMakeLists.txt

    r195948 r195954  
    173173    Modules/battery/NavigatorBattery.idl
    174174
     175    Modules/fetch/FetchBody.idl
    175176    Modules/fetch/FetchHeaders.idl
     177    Modules/fetch/FetchRequest.idl
    176178
    177179    Modules/geolocation/Coordinates.idl
     
    816818    Modules/battery/NavigatorBattery.cpp
    817819
     820    Modules/fetch/FetchBody.cpp
    818821    Modules/fetch/FetchHeaders.cpp
     822    Modules/fetch/FetchRequest.cpp
    819823
    820824    Modules/geolocation/Coordinates.cpp
  • trunk/Source/WebCore/ChangeLog

    r195953 r195954  
     12016-02-01  Youenn Fablet  <youenn.fablet@crf.canon.fr>
     2
     3        [Fetch API] Implement Fetch API Request
     4        https://bugs.webkit.org/show_bug.cgi?id=153437
     5
     6        Added support for Fetch Request and Body.
     7        Body is sharing functionality between Request and Response.
     8        Conversion between various body types are not implemented yet.
     9
     10        Added a FetchOptions class. Options in this class are partially redundant with ResourceLoaderOptions.
     11
     12        Fixing bug in Headers constructor.
     13        Making error reporting in case of modifying headers compliant with the spec.
     14
     15        Reviewed by Darin Adler.
     16
     17        Tests: imported/w3c/web-platform-tests/fetch/api/request/request-clone.sub.html
     18               imported/w3c/web-platform-tests/fetch/api/request/request-consume.html
     19               imported/w3c/web-platform-tests/fetch/api/request/request-disturbed.html
     20               imported/w3c/web-platform-tests/fetch/api/request/request-error.html
     21               imported/w3c/web-platform-tests/fetch/api/request/request-headers.html
     22               imported/w3c/web-platform-tests/fetch/api/request/request-idl.html
     23               imported/w3c/web-platform-tests/fetch/api/request/request-init-001.sub.html
     24               imported/w3c/web-platform-tests/fetch/api/request/request-init-002.html
     25               imported/w3c/web-platform-tests/fetch/api/request/request-init-003.sub.html
     26               imported/w3c/web-platform-tests/fetch/api/request/request-structure.html
     27
     28        * CMakeLists.txt:
     29        * DerivedSources.cpp:
     30        * DerivedSources.make:
     31        * Modules/fetch/FetchBody.cpp: Added.
     32        (WebCore::FetchBody::initBody):
     33        (WebCore::FetchBody::clear):
     34        (WebCore::FetchBody::processIfEmptyOrDisturbed):
     35        (WebCore::FetchBody::arrayBuffer):
     36        (WebCore::FetchBody::formData):
     37        (WebCore::FetchBody::blob):
     38        (WebCore::FetchBody::text):
     39        (WebCore::FetchBody::json):
     40        * Modules/fetch/FetchBody.h: Added.
     41        (WebCore::FetchBody::~FetchBody):
     42        (WebCore::FetchBody::isEmpty):
     43        (WebCore::FetchBody::isDisturbed):
     44        (WebCore::FetchBody::setDisturbed):
     45        (WebCore::FetchBody::setMimeType):
     46        (WebCore::FetchBody::mimeType):
     47        * Modules/fetch/FetchBody.idl: Added.
     48        * Modules/fetch/FetchHeaders.cpp:
     49        (WebCore::canWriteHeader):
     50        (WebCore::FetchHeaders::append):
     51        (WebCore::FetchHeaders::remove):
     52        (WebCore::FetchHeaders::set):
     53        (WebCore::FetchHeaders::fill): Helper routine implementing https://fetch.spec.whatwg.org/#concept-headers-fill
     54        * Modules/fetch/FetchHeaders.h: Adding header getter/setter for FetchRequest.
     55        (WebCore::FetchHeaders::fastGet):
     56        (WebCore::FetchHeaders::fastSet):
     57        * Modules/fetch/FetchHeaders.js: Fixing bug in constructor (covered by modified headers-basc.html test).
     58        (initializeFetchHeaders):
     59        * Modules/fetch/FetchOptions.h: Added.
     60        (WebCore::FetchOptions::FetchOptions):
     61        (WebCore::FetchOptions::type):
     62        (WebCore::FetchOptions::destination):
     63        (WebCore::FetchOptions::mode):
     64        (WebCore::FetchOptions::credentials):
     65        (WebCore::FetchOptions::cache):
     66        (WebCore::FetchOptions::redirect):
     67        (WebCore::FetchOptions::referrerPolicy):
     68        (WebCore::FetchOptions::setType):
     69        (WebCore::FetchOptions::setDestination):
     70        (WebCore::FetchOptions::setMode):
     71        (WebCore::FetchOptions::setCredentials):
     72        (WebCore::FetchOptions::setCache):
     73        (WebCore::FetchOptions::setRedirect):
     74        (WebCore::FetchOptions::setReferrerPolicy):
     75        * Modules/fetch/FetchRequest.cpp: Added.
     76        (WebCore::FetchRequest::create):
     77        (WebCore::FetchRequest::FetchRequest):
     78        (WebCore::FetchRequest::init):
     79        (WebCore::FetchRequest::setReferrer):
     80        (WebCore::FetchRequest::setReferrerPolicy):
     81        (WebCore::FetchRequest::setMode):
     82        (WebCore::FetchRequest::setCredentials):
     83        (WebCore::FetchRequest::setCache):
     84        (WebCore::FetchRequest::setRedirect):
     85        (WebCore::FetchRequest::type):
     86        (WebCore::FetchRequest::destination):
     87        (WebCore::FetchRequest::referrerPolicy):
     88        (WebCore::FetchRequest::referrer):
     89        (WebCore::FetchRequest::mode):
     90        (WebCore::FetchRequest::credentials):
     91        (WebCore::FetchRequest::cache):
     92        (WebCore::FetchRequest::redirect):
     93        (WebCore::FetchRequest::setMethod):
     94        (WebCore::FetchRequest::clone):
     95        * Modules/fetch/FetchRequest.h: Added.
     96        (WebCore::FetchRequest::method):
     97        (WebCore::FetchRequest::url):
     98        (WebCore::FetchRequest::integrity):
     99        (WebCore::FetchRequest::headers):
     100        * Modules/fetch/FetchRequest.idl: Added.
     101        * WebCore.xcodeproj/project.pbxproj:
     102        * bindings/js/Dictionary.h:
     103        (WebCore::Dictionary::execState):
     104        * bindings/js/JSDictionary.cpp:
     105        (WebCore::JSDictionary::convertValue):
     106        * bindings/js/JSDictionary.h:
     107        (WebCore::JSDictionary::get):
     108
    11092016-01-31  Jeremy Jones  <jeremyj@apple.com>
    2110
  • trunk/Source/WebCore/DerivedSources.cpp

    r195627 r195954  
    155155#include "JSEventSource.cpp"
    156156#include "JSEventTarget.cpp"
     157#include "JSFetchBody.cpp"
    157158#include "JSFetchHeaders.cpp"
     159#include "JSFetchRequest.cpp"
    158160#include "JSFile.cpp"
    159161#include "JSFileError.cpp"
  • trunk/Source/WebCore/DerivedSources.make

    r195698 r195954  
    8080    $(WebCore)/Modules/encryptedmedia/MediaKeySession.idl \
    8181    $(WebCore)/Modules/encryptedmedia/MediaKeys.idl \
     82    $(WebCore)/Modules/fetch/FetchBody.idl \
    8283    $(WebCore)/Modules/fetch/FetchHeaders.idl \
     84    $(WebCore)/Modules/fetch/FetchRequest.idl \
    8385    $(WebCore)/Modules/gamepad/Gamepad.idl \
    8486    $(WebCore)/Modules/gamepad/GamepadButton.idl \
  • trunk/Source/WebCore/Modules/fetch/FetchBody.h

    r195953 r195954  
    2727 */
    2828
    29 #ifndef FetchHeaders_h
    30 #define FetchHeaders_h
     29#ifndef FetchBody_h
     30#define FetchBody_h
    3131
    3232#if ENABLE(FETCH_API)
    3333
    34 #include "HTTPHeaderMap.h"
     34#include "Blob.h"
     35#include "DOMFormData.h"
     36#include "JSDOMPromise.h"
     37
     38namespace JSC {
     39class ExecState;
     40class JSValue;
     41};
    3542
    3643namespace WebCore {
    3744
     45class Dictionary;
    3846typedef int ExceptionCode;
    3947
    40 class FetchHeaders : public RefCounted<FetchHeaders> {
     48class FetchBody {
    4149public:
    42     enum class Guard {
    43         None,
    44         Immutable,
    45         Request,
    46         RequestNoCors,
    47         Response
    48     };
     50    typedef DOMPromise<Vector<unsigned char>, ExceptionCode> ArrayBufferPromise;
     51    void arrayBuffer(ArrayBufferPromise&&);
    4952
    50     static Ref<FetchHeaders> create(Guard guard = Guard::None) { return adoptRef(*new FetchHeaders(guard)); }
     53    typedef DOMPromise<RefPtr<DOMFormData>, ExceptionCode> FormDataPromise;
     54    void formData(FormDataPromise&&);
    5155
    52     void append(const String& name, const String& value, ExceptionCode&);
    53     void remove(const String&, ExceptionCode&);
    54     String get(const String&, ExceptionCode&) const;
    55     bool has(const String&, ExceptionCode&) const;
    56     void set(const String& name, const String& value, ExceptionCode&);
     56    typedef DOMPromise<RefPtr<Blob>, ExceptionCode> BlobPromise;
     57    void blob(BlobPromise&&);
    5758
    58     void initializeWith(const FetchHeaders*, ExceptionCode&);
     59    typedef DOMPromise<JSC::JSValue, ExceptionCode> JSONPromise;
     60    void json(JSC::ExecState&, JSONPromise&&);
     61
     62    typedef DOMPromise<String, ExceptionCode> TextPromise;
     63    void text(TextPromise&&);
     64
     65    bool isDisturbed() const { return m_isDisturbed; }
     66    bool isEmpty() const { return m_type == Type::None; }
     67
     68    void setMimeType(const String& mimeType) { m_mimeType = mimeType; }
     69    String mimeType() const { return m_mimeType; }
     70
     71    static FetchBody fromJSValue(JSC::ExecState&, JSC::JSValue);
     72    static FetchBody fromRequestBody(FetchBody*);
    5973
    6074private:
    61     FetchHeaders(Guard guard) : m_guard(guard) { }
     75    template<typename T> bool processIfEmptyOrDisturbed(DOMPromise<T, ExceptionCode>&);
    6276
    63     Guard m_guard;
    64     HTTPHeaderMap m_headers;
     77    enum class Type { None, Text, Blob, FormData };
     78
     79    FetchBody(Ref<Blob>&&);
     80    FetchBody(Ref<DOMFormData>&&);
     81    FetchBody(String&&);
     82    FetchBody() { }
     83
     84    Type m_type = Type::None;
     85    String m_mimeType;
     86    bool m_isDisturbed = false;
     87
     88    // FIXME: Add support for BufferSource and URLSearchParams.
     89    RefPtr<Blob> m_blob;
     90    RefPtr<DOMFormData> m_formData;
     91    String m_text;
    6592};
    6693
     
    6996#endif // ENABLE(FETCH_API)
    7097
    71 #endif // FetchHeaders_h
     98#endif // FetchBody_h
  • trunk/Source/WebCore/Modules/fetch/FetchBody.idl

    r195953 r195954  
    2727 */
    2828
    29 #ifndef FetchHeaders_h
    30 #define FetchHeaders_h
    31 
    32 #if ENABLE(FETCH_API)
    33 
    34 #include "HTTPHeaderMap.h"
    35 
    36 namespace WebCore {
    37 
    38 typedef int ExceptionCode;
    39 
    40 class FetchHeaders : public RefCounted<FetchHeaders> {
    41 public:
    42     enum class Guard {
    43         None,
    44         Immutable,
    45         Request,
    46         RequestNoCors,
    47         Response
    48     };
    49 
    50     static Ref<FetchHeaders> create(Guard guard = Guard::None) { return adoptRef(*new FetchHeaders(guard)); }
    51 
    52     void append(const String& name, const String& value, ExceptionCode&);
    53     void remove(const String&, ExceptionCode&);
    54     String get(const String&, ExceptionCode&) const;
    55     bool has(const String&, ExceptionCode&) const;
    56     void set(const String& name, const String& value, ExceptionCode&);
    57 
    58     void initializeWith(const FetchHeaders*, ExceptionCode&);
    59 
    60 private:
    61     FetchHeaders(Guard guard) : m_guard(guard) { }
    62 
    63     Guard m_guard;
    64     HTTPHeaderMap m_headers;
     29[
     30    Conditional=FETCH_API,
     31    GlobalContext=DOMWindow&WorkerGlobalScope,
     32    InterfaceName=Body,
     33    NoInterfaceObject
     34]
     35interface FetchBody {
     36    [ImplementedAs=isDisturbed] readonly attribute boolean bodyUsed;
     37    [NewObject] Promise arrayBuffer();
     38    [NewObject] Promise blob();
     39    [NewObject] Promise formData();
     40    [CallWith=ScriptState, NewObject] Promise json();
     41    [NewObject] Promise text();
    6542};
    66 
    67 } // namespace WebCore
    68 
    69 #endif // ENABLE(FETCH_API)
    70 
    71 #endif // FetchHeaders_h
  • trunk/Source/WebCore/Modules/fetch/FetchHeaders.cpp

    r195530 r195954  
    102102}
    103103
    104 static bool canWriteHeader(const String& name, const String& value, FetchHeaders::Guard guard)
     104static bool canWriteHeader(const String& name, const String& value, FetchHeaders::Guard guard, ExceptionCode& ec)
    105105{
    106     if (!isValidHTTPToken(name) || !isValidHTTPHeaderValue(value))
     106    if (!isValidHTTPToken(name) || !isValidHTTPHeaderValue(value)) {
     107        ec = TypeError;
    107108        return false;
    108     if (guard == FetchHeaders::Guard::Immutable)
     109    }
     110    if (guard == FetchHeaders::Guard::Immutable) {
     111        ec = TypeError;
    109112        return false;
     113    }
    110114    if (guard == FetchHeaders::Guard::Request && isForbiddenHeaderName(name))
    111115        return false;
     
    120124{
    121125    String normalizedValue = stripLeadingAndTrailingHTTPSpaces(value);
    122     if (!canWriteHeader(name, normalizedValue, m_guard)) {
    123         ec = TypeError;
     126    if (!canWriteHeader(name, normalizedValue, m_guard, ec))
    124127        return;
    125     }
    126128    m_headers.add(name, normalizedValue);
    127129}
     
    129131void FetchHeaders::remove(const String& name, ExceptionCode& ec)
    130132{
    131     if (!canWriteHeader(name, String(), m_guard)) {
    132         ec = TypeError;
     133    if (!canWriteHeader(name, String(), m_guard, ec))
    133134        return;
    134     }
    135135    m_headers.remove(name);
    136136}
     
    157157{
    158158    String normalizedValue = stripLeadingAndTrailingHTTPSpaces(value);
    159     if (!canWriteHeader(name, normalizedValue, m_guard)) {
    160         ec = TypeError;
     159    if (!canWriteHeader(name, normalizedValue, m_guard, ec))
    161160        return;
     161    m_headers.set(name, normalizedValue);
     162}
     163
     164void FetchHeaders::fill(const FetchHeaders* headers)
     165{
     166    if (!headers)
     167        return;
     168
     169    ASSERT(m_guard != Guard::Immutable);
     170
     171    ExceptionCode ec;
     172    for (auto& header : headers->m_headers) {
     173        if (canWriteHeader(header.key, header.value, m_guard, ec)) {
     174            if (header.keyAsHTTPHeaderName)
     175                m_headers.add(header.keyAsHTTPHeaderName.value(), header.value);
     176            else
     177                m_headers.add(header.key, header.value);
     178        }
    162179    }
    163     m_headers.set(name, normalizedValue);
    164180}
    165181
  • trunk/Source/WebCore/Modules/fetch/FetchHeaders.h

    r195530 r195954  
    4949
    5050    static Ref<FetchHeaders> create(Guard guard = Guard::None) { return adoptRef(*new FetchHeaders(guard)); }
     51    static Ref<FetchHeaders> create(const FetchHeaders& headers) { return adoptRef(*new FetchHeaders(headers.m_guard, headers.m_headers)); }
    5152
    5253    void append(const String& name, const String& value, ExceptionCode&);
     
    5758
    5859    void initializeWith(const FetchHeaders*, ExceptionCode&);
     60    void fill(const FetchHeaders*);
     61
     62    String fastGet(HTTPHeaderName name) const { return m_headers.get(name); }
     63    void fastSet(HTTPHeaderName name, const String& value) { m_headers.set(name, value); }
    5964
    6065private:
    6166    FetchHeaders(Guard guard) : m_guard(guard) { }
     67    FetchHeaders(Guard guard, const HTTPHeaderMap& headers) : m_guard(guard), m_headers(headers) { }
    6268
    6369    Guard m_guard;
  • trunk/Source/WebCore/Modules/fetch/FetchHeaders.js

    r195530 r195954  
    4848            this.@appendFromJS(header[0], header[1]);
    4949        }
     50        return this;
    5051    }
    5152
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r195948 r195954  
    15481548                41F1D21F0EF35C2A00DA8753 /* ScriptCachedFrameData.h in Headers */ = {isa = PBXBuildFile; fileRef = 41F1D21D0EF35C2A00DA8753 /* ScriptCachedFrameData.h */; settings = {ATTRIBUTES = (Private, ); }; };
    15491549                41F1D2200EF35C2A00DA8753 /* ScriptCachedFrameData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41F1D21E0EF35C2A00DA8753 /* ScriptCachedFrameData.cpp */; };
     1550                41F54F8B1C50C50300338488 /* FetchBody.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41F54F7D1C50C4F600338488 /* FetchBody.cpp */; };
    15501551                41F54F8D1C50C50800338488 /* FetchHeaders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41F54F821C50C4F600338488 /* FetchHeaders.cpp */; };
     1552                41F54F8E1C50C50C00338488 /* FetchRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41F54F871C50C4F600338488 /* FetchRequest.cpp */; };
    15511553                41F584C7104652CB009CAA64 /* JSMessagePortCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 41F584C6104652CB009CAA64 /* JSMessagePortCustom.h */; };
    15521554                41FA303E1316C29C00C0BFC5 /* RenderMediaControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41FA303C1316C29C00C0BFC5 /* RenderMediaControls.cpp */; };
     
    27942796                7E474E1F12494DC900235364 /* SQLiteDatabaseTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E474E1C12494DC900235364 /* SQLiteDatabaseTracker.h */; settings = {ATTRIBUTES = (Private, ); }; };
    27952797                7E474E2012494DC900235364 /* SQLiteDatabaseTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E474E1D12494DC900235364 /* SQLiteDatabaseTracker.cpp */; };
     2798                7E4C96DC1AD4483500365A50 /* JSFetchRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E4C96D81AD4483500365A50 /* JSFetchRequest.cpp */; };
     2799                7E4C96DD1AD4483500365A50 /* JSFetchRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E4C96D91AD4483500365A50 /* JSFetchRequest.h */; };
    27962800                7E4DE10D198B10B60051CB02 /* DiskCacheMonitorCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7E4DE10C198B10B60051CB02 /* DiskCacheMonitorCocoa.mm */; };
    27972801                7E5D7A76161D3F8F00896C34 /* OESElementIndexUint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E5D7A73161D3F8F00896C34 /* OESElementIndexUint.cpp */; };
     
    28302834                7EE6847112D26E3800E79415 /* ResourceResponseCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EE6845E12D26E3800E79415 /* ResourceResponseCFNet.cpp */; };
    28312835                7EE6847512D26E7000E79415 /* ResourceLoaderCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EE6847412D26E7000E79415 /* ResourceLoaderCFNet.cpp */; };
     2836                7F4C96DC1AD4483500365A50 /* JSFetchBody.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7F4C96D81AD4483500365A50 /* JSFetchBody.cpp */; };
     2837                7F4C96DD1AD4483500365A50 /* JSFetchBody.h in Headers */ = {isa = PBXBuildFile; fileRef = 7F4C96D91AD4483500365A50 /* JSFetchBody.h */; };
    28322838                8102C5881325BB1100DDE67A /* StringCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8102C5871325BB1100DDE67A /* StringCallback.cpp */; };
    28332839                81AC5999131636E60009A7E0 /* DataTransferItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 81AC5997131636E60009A7E0 /* DataTransferItem.h */; };
     
    89608966                41F1D21D0EF35C2A00DA8753 /* ScriptCachedFrameData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptCachedFrameData.h; sourceTree = "<group>"; };
    89618967                41F1D21E0EF35C2A00DA8753 /* ScriptCachedFrameData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptCachedFrameData.cpp; sourceTree = "<group>"; };
     8968                41F54F7D1C50C4F600338488 /* FetchBody.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FetchBody.cpp; sourceTree = "<group>"; };
     8969                41F54F7E1C50C4F600338488 /* FetchBody.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchBody.h; sourceTree = "<group>"; };
     8970                41F54F7F1C50C4F600338488 /* FetchBody.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FetchBody.idl; sourceTree = "<group>"; };
    89628971                41F54F821C50C4F600338488 /* FetchHeaders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FetchHeaders.cpp; sourceTree = "<group>"; };
    89638972                41F54F831C50C4F600338488 /* FetchHeaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchHeaders.h; sourceTree = "<group>"; };
    89648973                41F54F841C50C4F600338488 /* FetchHeaders.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FetchHeaders.idl; sourceTree = "<group>"; };
    89658974                41F54F851C50C4F600338488 /* FetchHeaders.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = FetchHeaders.js; sourceTree = "<group>"; };
     8975                41F54F861C50C4F600338488 /* FetchOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchOptions.h; sourceTree = "<group>"; };
     8976                41F54F871C50C4F600338488 /* FetchRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FetchRequest.cpp; sourceTree = "<group>"; };
     8977                41F54F881C50C4F600338488 /* FetchRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchRequest.h; sourceTree = "<group>"; };
     8978                41F54F891C50C4F600338488 /* FetchRequest.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FetchRequest.idl; sourceTree = "<group>"; };
    89668979                41F584C6104652CB009CAA64 /* JSMessagePortCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMessagePortCustom.h; sourceTree = "<group>"; };
    89678980                41FA303C1316C29C00C0BFC5 /* RenderMediaControls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMediaControls.cpp; sourceTree = "<group>"; };
     
    1035910372                7E474E1C12494DC900235364 /* SQLiteDatabaseTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLiteDatabaseTracker.h; sourceTree = "<group>"; };
    1036010373                7E474E1D12494DC900235364 /* SQLiteDatabaseTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLiteDatabaseTracker.cpp; sourceTree = "<group>"; };
     10374                7E4C96D81AD4483500365A50 /* JSFetchRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFetchRequest.cpp; sourceTree = "<group>"; };
     10375                7E4C96D91AD4483500365A50 /* JSFetchRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFetchRequest.h; sourceTree = "<group>"; };
    1036110376                7E4DE10C198B10B60051CB02 /* DiskCacheMonitorCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DiskCacheMonitorCocoa.mm; sourceTree = "<group>"; };
    1036210377                7E5D7A73161D3F8F00896C34 /* OESElementIndexUint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OESElementIndexUint.cpp; sourceTree = "<group>"; };
     
    1039710412                7EE6845E12D26E3800E79415 /* ResourceResponseCFNet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceResponseCFNet.cpp; sourceTree = "<group>"; };
    1039810413                7EE6847412D26E7000E79415 /* ResourceLoaderCFNet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoaderCFNet.cpp; sourceTree = "<group>"; };
     10414                7F4C96D81AD4483500365A50 /* JSFetchBody.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFetchBody.cpp; sourceTree = "<group>"; };
     10415                7F4C96D91AD4483500365A50 /* JSFetchBody.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFetchBody.h; sourceTree = "<group>"; };
    1039910416                8102C5871325BB1100DDE67A /* StringCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringCallback.cpp; sourceTree = "<group>"; };
    1040010417                81AC5997131636E60009A7E0 /* DataTransferItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataTransferItem.h; sourceTree = "<group>"; };
     
    1662016637                        isa = PBXGroup;
    1662116638                        children = (
     16639                                41F54F7D1C50C4F600338488 /* FetchBody.cpp */,
     16640                                41F54F7E1C50C4F600338488 /* FetchBody.h */,
     16641                                41F54F7F1C50C4F600338488 /* FetchBody.idl */,
    1662216642                                41F54F821C50C4F600338488 /* FetchHeaders.cpp */,
    1662316643                                41F54F831C50C4F600338488 /* FetchHeaders.h */,
    1662416644                                41F54F841C50C4F600338488 /* FetchHeaders.idl */,
    1662516645                                41F54F851C50C4F600338488 /* FetchHeaders.js */,
     16646                                41F54F861C50C4F600338488 /* FetchOptions.h */,
     16647                                41F54F871C50C4F600338488 /* FetchRequest.cpp */,
     16648                                41F54F881C50C4F600338488 /* FetchRequest.h */,
     16649                                41F54F891C50C4F600338488 /* FetchRequest.idl */,
    1662616650                        );
    1662716651                        path = fetch;
     
    1663116655                        isa = PBXGroup;
    1663216656                        children = (
     16657                                7F4C96D81AD4483500365A50 /* JSFetchBody.cpp */,
     16658                                7F4C96D91AD4483500365A50 /* JSFetchBody.h */,
     16659                                7E4C96D81AD4483500365A50 /* JSFetchRequest.cpp */,
     16660                                7E4C96D91AD4483500365A50 /* JSFetchRequest.h */,
    1663316661                                7D4C96D81AD4483500365A50 /* JSFetchHeaders.cpp */,
    1663416662                                7D4C96D91AD4483500365A50 /* JSFetchHeaders.h */,
     
    2648426512                                B658FFA21522EF3A00DD5595 /* JSRadioNodeList.h in Headers */,
    2648526513                                65DF320209D1CC60000BE325 /* JSRange.h in Headers */,
     26514                                7F4C96DD1AD4483500365A50 /* JSFetchBody.h in Headers */,
     26515                                7E4C96DD1AD4483500365A50 /* JSFetchRequest.h in Headers */,
    2648626516                                7D4C96DD1AD4483500365A50 /* JSFetchHeaders.h in Headers */,
    2648726517                                7C4C96DD1AD4483500365A50 /* JSReadableStream.h in Headers */,
     
    2966529695                                516D7D711BB5F0BD00AF7C77 /* IDBConnectionToClient.cpp in Sources */,
    2966629696                                5198F7C01BC4856700E2CC5F /* IDBConnectionToServer.cpp in Sources */,
     29697                                41F54F8B1C50C50300338488 /* FetchBody.cpp in Sources */,
    2966729698                                5185FC7A1BB4C4E80012898F /* IDBCursor.cpp in Sources */,
    2966829699                                51F41A691BA73B5B002E053B /* IDBCursorBackend.cpp in Sources */,
     
    3007430105                                83E359A31BB1031D002CEB98 /* JSHTMLTimeElement.cpp in Sources */,
    3007530106                                A80E7B130A19D606007FB8C5 /* JSHTMLTitleElement.cpp in Sources */,
     30107                                41F54F8E1C50C50C00338488 /* FetchRequest.cpp in Sources */,
    3007630108                                070756D314239A4E00414161 /* JSHTMLTrackElement.cpp in Sources */,
    3007730109                                1A85B2100A1B258700D8C87C /* JSHTMLUListElement.cpp in Sources */,
     
    3019630228                                B658FFA11522EF3A00DD5595 /* JSRadioNodeList.cpp in Sources */,
    3019730229                                65DF320109D1CC60000BE325 /* JSRange.cpp in Sources */,
     30230                                7F4C96DC1AD4483500365A50 /* JSFetchBody.cpp in Sources */,
    3019830231                                7D4C96DC1AD4483500365A50 /* JSFetchHeaders.cpp in Sources */,
     30232                                7E4C96DC1AD4483500365A50 /* JSFetchRequest.cpp in Sources */,
    3019930233                                7C4C96DC1AD4483500365A50 /* JSReadableStream.cpp in Sources */,
    3020030234                                6C4C96DE1AD4483500365A50 /* JSReadableStreamController.cpp in Sources */,
  • trunk/Source/WebCore/bindings/js/Dictionary.h

    r195616 r195954  
    6767    bool getWithUndefinedOrNullCheck(const char* propertyName, String& value) const;
    6868
     69    JSC::ExecState* execState() const { return m_dictionary.execState(); }
     70
    6971private:
    7072    template <typename T>
  • trunk/Source/WebCore/bindings/js/JSDictionary.cpp

    r192464 r195954  
    4848#endif
    4949
     50#if ENABLE(FETCH_API)
     51#include "JSFetchHeaders.h"
     52#endif
     53
    5054#if ENABLE(MEDIA_STREAM)
    5155#include "JSMediaStream.h"
     
    228232#endif
    229233
     234#if ENABLE(FETCH_API)
     235void JSDictionary::convertValue(JSC::ExecState*, JSC::JSValue value, RefPtr<FetchHeaders>& result)
     236{
     237    result = JSFetchHeaders::toWrapped(value);
     238}
     239#endif
     240
    230241#if ENABLE(MEDIA_STREAM)
    231242void JSDictionary::convertValue(JSC::ExecState*, JSC::JSValue value, RefPtr<MediaStream>& result)
  • trunk/Source/WebCore/bindings/js/JSDictionary.h

    r192464 r195954  
    4848class EventTarget;
    4949class Gamepad;
     50class FetchHeaders;
    5051class MediaKeyError;
    5152class MediaStream;
     
    127128    static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<MediaKeyError>& result);
    128129#endif
     130#if ENABLE(FETCH_API)
     131    static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<FetchHeaders>& result);
     132#endif
    129133#if ENABLE(MEDIA_STREAM)
    130134    static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<MediaStream>& result);
     
    162166{
    163167    return tryGetPropertyAndResult(propertyName, &finalResult, IdentitySetter<Result>::identitySetter) == PropertyFound;
     168}
     169
     170template <>
     171inline bool JSDictionary::get(const char* propertyName, JSC::JSValue& finalResult) const
     172{
     173    return tryGetProperty(propertyName, finalResult) == PropertyFound;
    164174}
    165175
Note: See TracChangeset for help on using the changeset viewer.