[Fetch API] Implement fetch skeleton
authoryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Mar 2016 09:46:27 +0000 (09:46 +0000)
committeryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Mar 2016 09:46:27 +0000 (09:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=155111

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Importing basic fetch api tests.

* resources/ImportExpectations: Activating fetch/api/basic import.
* web-platform-tests/fetch/api/basic/accept-header-expected.txt: Added.
* web-platform-tests/fetch/api/basic/accept-header-worker-expected.txt: Added.
* web-platform-tests/fetch/api/basic/accept-header-worker.html: Added.
* web-platform-tests/fetch/api/basic/accept-header.html: Added.
* web-platform-tests/fetch/api/basic/accept-header.js: Added.
(promise_test):
* web-platform-tests/fetch/api/basic/integrity-expected.txt: Added.
* web-platform-tests/fetch/api/basic/integrity-worker-expected.txt: Added.
* web-platform-tests/fetch/api/basic/integrity-worker.html: Added.
* web-platform-tests/fetch/api/basic/integrity.html: Added.
* web-platform-tests/fetch/api/basic/integrity.js: Added.
(integrity):
* web-platform-tests/fetch/api/basic/mode-no-cors-expected.txt: Added.
* web-platform-tests/fetch/api/basic/mode-no-cors-worker-expected.txt: Added.
* web-platform-tests/fetch/api/basic/mode-no-cors-worker.html: Added.
* web-platform-tests/fetch/api/basic/mode-no-cors.html: Added.
* web-platform-tests/fetch/api/basic/mode-no-cors.js: Added.
(fetchNoCors):
* web-platform-tests/fetch/api/basic/mode-same-origin-expected.txt: Added.
* web-platform-tests/fetch/api/basic/mode-same-origin-worker-expected.txt: Added.
* web-platform-tests/fetch/api/basic/mode-same-origin-worker.html: Added.
* web-platform-tests/fetch/api/basic/mode-same-origin.html: Added.
* web-platform-tests/fetch/api/basic/mode-same-origin.js: Added.
(fetchSameOrigin):
* web-platform-tests/fetch/api/basic/request-forbidden-headers-expected.txt: Added.
* web-platform-tests/fetch/api/basic/request-forbidden-headers-worker-expected.txt: Added.
* web-platform-tests/fetch/api/basic/request-forbidden-headers-worker.html: Added.
* web-platform-tests/fetch/api/basic/request-forbidden-headers.html: Added.
* web-platform-tests/fetch/api/basic/request-forbidden-headers.js: Added.
(requestForbiddenHeaders):
* web-platform-tests/fetch/api/basic/request-headers-expected.txt: Added.
* web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt: Added.
* web-platform-tests/fetch/api/basic/request-headers-worker.html: Added.
* web-platform-tests/fetch/api/basic/request-headers.html: Added.
* web-platform-tests/fetch/api/basic/request-headers.js: Added.
(requestHeaders):
* web-platform-tests/fetch/api/basic/scheme-about-expected.txt: Added.
* web-platform-tests/fetch/api/basic/scheme-about-worker-expected.txt: Added.
* web-platform-tests/fetch/api/basic/scheme-about-worker.html: Added.
* web-platform-tests/fetch/api/basic/scheme-about.html: Added.
* web-platform-tests/fetch/api/basic/scheme-about.js: Added.
(checkFetchResponse):
(checkKoUrl):
* web-platform-tests/fetch/api/basic/scheme-blob-expected.txt: Added.
* web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt: Added.
* web-platform-tests/fetch/api/basic/scheme-blob-worker.html: Added.
* web-platform-tests/fetch/api/basic/scheme-blob.html: Added.
* web-platform-tests/fetch/api/basic/scheme-blob.js: Added.
(checkFetchResponse):
(checkKoUrl):
* web-platform-tests/fetch/api/basic/scheme-data-expected.txt: Added.
* web-platform-tests/fetch/api/basic/scheme-data-worker-expected.txt: Added.
* web-platform-tests/fetch/api/basic/scheme-data-worker.html: Added.
* web-platform-tests/fetch/api/basic/scheme-data.html: Added.
* web-platform-tests/fetch/api/basic/scheme-data.js: Added.
(checkFetchResponse):
(checkKoUrl):
* web-platform-tests/fetch/api/basic/scheme-others-expected.txt: Added.
* web-platform-tests/fetch/api/basic/scheme-others-worker-expected.txt: Added.
* web-platform-tests/fetch/api/basic/scheme-others-worker.html: Added.
* web-platform-tests/fetch/api/basic/scheme-others.html: Added.
* web-platform-tests/fetch/api/basic/scheme-others.js: Added.
(checkKoUrl):
* web-platform-tests/fetch/api/basic/stream-response-expected.txt: Added.
* web-platform-tests/fetch/api/basic/stream-response-worker-expected.txt: Added.
* web-platform-tests/fetch/api/basic/stream-response-worker.html: Added.
* web-platform-tests/fetch/api/basic/stream-response.html: Added.
* web-platform-tests/fetch/api/basic/stream-response.js: Added.
(streamBody):
(promise_test.):
(promise_test):
* web-platform-tests/fetch/api/basic/w3c-import.log: Added.

Source/WebCore:

Adding skeleton code to call fetch API from normal and worker scopes.
Fetch API implementation is limited to reject the promise.

Updating the binding generator to fix the case of overloaded promise-returning functions.
Made overloaded utility functions "static inline".

Tests: imported/w3c/web-platform-tests/fetch/api/basic/accept-header-worker.html
       imported/w3c/web-platform-tests/fetch/api/basic/accept-header.html
       imported/w3c/web-platform-tests/fetch/api/basic/integrity-worker.html
       imported/w3c/web-platform-tests/fetch/api/basic/integrity.html
       imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-worker.html
       imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.html
       imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin-worker.html
       imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin.html
       imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers-worker.html
       imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers.html
       imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker.html
       imported/w3c/web-platform-tests/fetch/api/basic/request-headers.html
       imported/w3c/web-platform-tests/fetch/api/basic/scheme-about-worker.html
       imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.html
       imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker.html
       imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.html
       imported/w3c/web-platform-tests/fetch/api/basic/scheme-data-worker.html
       imported/w3c/web-platform-tests/fetch/api/basic/scheme-data.html
       imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-worker.html
       imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.html
       imported/w3c/web-platform-tests/fetch/api/basic/stream-response-worker.html
       imported/w3c/web-platform-tests/fetch/api/basic/stream-response.html

* CMakeLists.txt:
* DerivedSources.make:
* Modules/fetch/DOMWindowFetch.cpp: Added.
(WebCore::DOMWindowFetch::fetch):
* Modules/fetch/DOMWindowFetch.h: Added.
* Modules/fetch/DOMWindowFetch.idl: Added.
* Modules/fetch/WorkerGlobalScopeFetch.cpp: Added.
(WebCore::WorkerGlobalScopeFetch::fetch):
* Modules/fetch/WorkerGlobalScopeFetch.h: Added.
* Modules/fetch/WorkerGlobalScopeFetch.idl: Added.
* WebCore.xcodeproj/project.pbxproj:
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation): Fixing the case of overloaded promise-returning functions.
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod1):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod2):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod3):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod4):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod5):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod6):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod7):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod8):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod9):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod10):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod11):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod12):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter1):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2):
(WebCore::jsTestObjConstructorFunctionOverloadedMethod11):
(WebCore::jsTestObjConstructorFunctionOverloadedMethod12):
(WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1):
(WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise):
(WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2):
(WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise):
(WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod): Deleted.
(WebCore::jsTestObjConstructorFunctionClassMethod2): Deleted.
(WebCore::jsTestObjPrototypeFunctionAny): Deleted.
(WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionPromise): Deleted.
(WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise): Deleted.
(WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise): Deleted.
* bindings/scripts/test/TestObj.idl:

LayoutTests:

* TestExpectations: Marking some tests as flaky.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197748 268f45cc-cd09-0410-ab3c-d52691b4dbfc

73 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/resources/ImportExpectations
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header-worker-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header-worker.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-worker-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-worker.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-worker-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-worker.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin-worker-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin-worker.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers-worker-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers-worker.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about-worker-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about-worker.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data-worker-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data-worker.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-worker-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-worker.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response-worker-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response-worker.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/w3c-import.log [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/Modules/fetch/DOMWindowFetch.cpp [new file with mode: 0644]
Source/WebCore/Modules/fetch/DOMWindowFetch.h [new file with mode: 0644]
Source/WebCore/Modules/fetch/DOMWindowFetch.idl [new file with mode: 0644]
Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.cpp [new file with mode: 0644]
Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.h [new file with mode: 0644]
Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.idl [new file with mode: 0644]
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/bindings/scripts/test/TestObj.idl

index cae89847ed1ccb3c261b52b84681863d990e1dd4..fe40c2a911f9c643a1a34a591f1fd39833ec8338 100644 (file)
@@ -1,3 +1,12 @@
+2016-03-08  Youenn Fablet  <youenn.fablet@crf.canon.fr>
+
+        [Fetch API] Implement fetch skeleton
+        https://bugs.webkit.org/show_bug.cgi?id=155111
+
+        Reviewed by Darin Adler.
+
+        * TestExpectations: Marking some tests as flaky.
+
 2016-03-08  Nikos Andronikos  <nikos.andronikos-webkit@cisra.canon.com.au>
 
         [SVG2] Implement marker orient='auto-start-reverse'
index f510245f0f85990ca504b2fcb72d73e14b5918a7..6a549131e32155a7135490bcb8f3a6b4fe873f36 100644 (file)
@@ -316,6 +316,9 @@ imported/w3c/web-platform-tests/XMLHttpRequest/send-redirect-bogus.htm [ Skip ]
 imported/w3c/web-platform-tests/XMLHttpRequest/send-redirect-to-cors.htm [ Skip ]
 imported/w3c/web-platform-tests/XMLHttpRequest/send-redirect-to-non-cors.htm [ Skip ]
 
+# Tests that are flaky as failing assertions print a new token generated for each test run.
+imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.html [ Failure ]
+imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker.html [ Failure ]
 
 # New W3C ref tests that are failing.
 webkit.org/b/148856 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video_initially_paused.html [ ImageOnlyFailure ]
index 8104e7f43b2213db679c21dc01775a6f94d99dbe..3df68c029f78f4b411a06455b57bf48f1d6cddb0 100644 (file)
@@ -1,3 +1,86 @@
+2016-03-08  Youenn Fablet  <youenn.fablet@crf.canon.fr>
+
+        [Fetch API] Implement fetch skeleton
+        https://bugs.webkit.org/show_bug.cgi?id=155111
+
+        Reviewed by Darin Adler.
+
+        Importing basic fetch api tests.
+
+        * resources/ImportExpectations: Activating fetch/api/basic import.
+        * web-platform-tests/fetch/api/basic/accept-header-expected.txt: Added.
+        * web-platform-tests/fetch/api/basic/accept-header-worker-expected.txt: Added.
+        * web-platform-tests/fetch/api/basic/accept-header-worker.html: Added.
+        * web-platform-tests/fetch/api/basic/accept-header.html: Added.
+        * web-platform-tests/fetch/api/basic/accept-header.js: Added.
+        (promise_test):
+        * web-platform-tests/fetch/api/basic/integrity-expected.txt: Added.
+        * web-platform-tests/fetch/api/basic/integrity-worker-expected.txt: Added.
+        * web-platform-tests/fetch/api/basic/integrity-worker.html: Added.
+        * web-platform-tests/fetch/api/basic/integrity.html: Added.
+        * web-platform-tests/fetch/api/basic/integrity.js: Added.
+        (integrity):
+        * web-platform-tests/fetch/api/basic/mode-no-cors-expected.txt: Added.
+        * web-platform-tests/fetch/api/basic/mode-no-cors-worker-expected.txt: Added.
+        * web-platform-tests/fetch/api/basic/mode-no-cors-worker.html: Added.
+        * web-platform-tests/fetch/api/basic/mode-no-cors.html: Added.
+        * web-platform-tests/fetch/api/basic/mode-no-cors.js: Added.
+        (fetchNoCors):
+        * web-platform-tests/fetch/api/basic/mode-same-origin-expected.txt: Added.
+        * web-platform-tests/fetch/api/basic/mode-same-origin-worker-expected.txt: Added.
+        * web-platform-tests/fetch/api/basic/mode-same-origin-worker.html: Added.
+        * web-platform-tests/fetch/api/basic/mode-same-origin.html: Added.
+        * web-platform-tests/fetch/api/basic/mode-same-origin.js: Added.
+        (fetchSameOrigin):
+        * web-platform-tests/fetch/api/basic/request-forbidden-headers-expected.txt: Added.
+        * web-platform-tests/fetch/api/basic/request-forbidden-headers-worker-expected.txt: Added.
+        * web-platform-tests/fetch/api/basic/request-forbidden-headers-worker.html: Added.
+        * web-platform-tests/fetch/api/basic/request-forbidden-headers.html: Added.
+        * web-platform-tests/fetch/api/basic/request-forbidden-headers.js: Added.
+        (requestForbiddenHeaders):
+        * web-platform-tests/fetch/api/basic/request-headers-expected.txt: Added.
+        * web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt: Added.
+        * web-platform-tests/fetch/api/basic/request-headers-worker.html: Added.
+        * web-platform-tests/fetch/api/basic/request-headers.html: Added.
+        * web-platform-tests/fetch/api/basic/request-headers.js: Added.
+        (requestHeaders):
+        * web-platform-tests/fetch/api/basic/scheme-about-expected.txt: Added.
+        * web-platform-tests/fetch/api/basic/scheme-about-worker-expected.txt: Added.
+        * web-platform-tests/fetch/api/basic/scheme-about-worker.html: Added.
+        * web-platform-tests/fetch/api/basic/scheme-about.html: Added.
+        * web-platform-tests/fetch/api/basic/scheme-about.js: Added.
+        (checkFetchResponse):
+        (checkKoUrl):
+        * web-platform-tests/fetch/api/basic/scheme-blob-expected.txt: Added.
+        * web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt: Added.
+        * web-platform-tests/fetch/api/basic/scheme-blob-worker.html: Added.
+        * web-platform-tests/fetch/api/basic/scheme-blob.html: Added.
+        * web-platform-tests/fetch/api/basic/scheme-blob.js: Added.
+        (checkFetchResponse):
+        (checkKoUrl):
+        * web-platform-tests/fetch/api/basic/scheme-data-expected.txt: Added.
+        * web-platform-tests/fetch/api/basic/scheme-data-worker-expected.txt: Added.
+        * web-platform-tests/fetch/api/basic/scheme-data-worker.html: Added.
+        * web-platform-tests/fetch/api/basic/scheme-data.html: Added.
+        * web-platform-tests/fetch/api/basic/scheme-data.js: Added.
+        (checkFetchResponse):
+        (checkKoUrl):
+        * web-platform-tests/fetch/api/basic/scheme-others-expected.txt: Added.
+        * web-platform-tests/fetch/api/basic/scheme-others-worker-expected.txt: Added.
+        * web-platform-tests/fetch/api/basic/scheme-others-worker.html: Added.
+        * web-platform-tests/fetch/api/basic/scheme-others.html: Added.
+        * web-platform-tests/fetch/api/basic/scheme-others.js: Added.
+        (checkKoUrl):
+        * web-platform-tests/fetch/api/basic/stream-response-expected.txt: Added.
+        * web-platform-tests/fetch/api/basic/stream-response-worker-expected.txt: Added.
+        * web-platform-tests/fetch/api/basic/stream-response-worker.html: Added.
+        * web-platform-tests/fetch/api/basic/stream-response.html: Added.
+        * web-platform-tests/fetch/api/basic/stream-response.js: Added.
+        (streamBody):
+        (promise_test.):
+        (promise_test):
+        * web-platform-tests/fetch/api/basic/w3c-import.log: Added.
+
 2016-03-07  Chris Dumez  <cdumez@apple.com>
 
         Align HTMLCanvasElement.width / height with the specification
index 3862169da93cc4790489db9b51c7c5894b7d36c5..274db13b5e71d59702486a6def412c336f180b16 100644 (file)
@@ -120,7 +120,6 @@ web-platform-tests/encoding [ Skip ]
 web-platform-tests/eventsource [ Skip ]
 web-platform-tests/ext-xhtml-pubid [ Skip ]
 #web-platform-tests/fetch [ Import ]
-web-platform-tests/fetch/api/basic [ Skip ]
 web-platform-tests/fetch/api/cors [ Skip ]
 web-platform-tests/fetch/api/credentials [ Skip ]
 web-platform-tests/fetch/api/policies [ Skip ]
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header-expected.txt
new file mode 100644 (file)
index 0000000..4cd5973
--- /dev/null
@@ -0,0 +1,3 @@
+
+FAIL Request through fetch should have 'accept' header with value '*/*' promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header-worker-expected.txt
new file mode 100644 (file)
index 0000000..4cd5973
--- /dev/null
@@ -0,0 +1,3 @@
+
+FAIL Request through fetch should have 'accept' header with value '*/*' promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header-worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header-worker.html
new file mode 100644 (file)
index 0000000..4d5b322
--- /dev/null
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch in worker: accept header</title>
+    <meta name="help" href="https://fetch.spec.whatwg.org/#fetching">
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <script>
+      fetch_tests_from_worker(new Worker("accept-header.js"));
+    </script>
+  </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header.html
new file mode 100644 (file)
index 0000000..cd9550f
--- /dev/null
@@ -0,0 +1,15 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch: accept header</title>
+    <meta name="help" href="https://fetch.spec.whatwg.org/#fetching">
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <script src="../resources/utils.js"></script>
+    <script src="accept-header.js"></script>
+  </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header.js
new file mode 100644 (file)
index 0000000..33226e8
--- /dev/null
@@ -0,0 +1,14 @@
+if (this.document === undefined) {
+  importScripts("/resources/testharness.js");
+  importScripts("../resources/utils.js");
+}
+
+promise_test(function() {
+  return fetch(RESOURCES_DIR + "inspect-headers.py?headers=Accept").then(function(response) {
+    assert_equals(response.status, 200, "HTTP status is 200");
+    assert_equals(response.type , "basic", "Response's type is basic");
+    assert_equals(response.headers.get("x-request-accept"), "*/*", "Request has accept header with value '*/*'");
+  });
+}, "Request through fetch should have 'accept' header with value '*/*'");
+
+done();
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-expected.txt
new file mode 100644 (file)
index 0000000..42be002
--- /dev/null
@@ -0,0 +1,15 @@
+
+FAIL Empty string integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL SHA-256 integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL SHA-384 integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL SHA-512 integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Invalid integrity assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Multiple integrities: valid stronger than invalid promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Multiple integrities: invalid stronger than valid assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Multiple integrities: invalid as strong as valid promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Multiple integrities: both are valid promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Multiple integrities: both are invalid assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL CORS empty integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL CORS SHA-512 integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL CORS invalid integrity assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-worker-expected.txt
new file mode 100644 (file)
index 0000000..42be002
--- /dev/null
@@ -0,0 +1,15 @@
+
+FAIL Empty string integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL SHA-256 integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL SHA-384 integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL SHA-512 integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Invalid integrity assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Multiple integrities: valid stronger than invalid promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Multiple integrities: invalid stronger than valid assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Multiple integrities: invalid as strong as valid promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Multiple integrities: both are valid promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Multiple integrities: both are invalid assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL CORS empty integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL CORS SHA-512 integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL CORS invalid integrity assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-worker.html
new file mode 100644 (file)
index 0000000..9240bc6
--- /dev/null
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch in worker: integrity handling</title>
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <script>
+      fetch_tests_from_worker(new Worker("integrity.js?pipe=sub"));
+    </script>
+  </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.html
new file mode 100644 (file)
index 0000000..150c9b7
--- /dev/null
@@ -0,0 +1,15 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch: integrity handling</title>
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <script src="../resources/utils.js"></script>
+    <script src="integrity.js?pipe=sub"></script>
+  </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.js
new file mode 100644 (file)
index 0000000..4e849f5
--- /dev/null
@@ -0,0 +1,45 @@
+if (this.document === undefined) {
+  importScripts("/resources/testharness.js");
+  importScripts("../resources/utils.js");
+}
+
+function integrity(desc, url, integrity, shouldPass) {
+   if (shouldPass) {
+    promise_test(function(test) {
+      return fetch(url, {'integrity': integrity}).then(function(resp) {
+        assert_equals(resp.status, 200, "Response's status is 200");
+      });
+    }, desc);
+  } else {
+    promise_test(function(test) {
+      return promise_rejects(test, new TypeError(), fetch(url, {'integrity': integrity}));
+    }, desc);
+  }
+}
+
+var topSha256 = "sha256-KHIDZcXnR2oBHk9DrAA+5fFiR6JjudYjqoXtMR1zvzk=";
+var topSha384 = "sha384-MgZYnnAzPM/MjhqfOIMfQK5qcFvGZsGLzx4Phd7/A8fHTqqLqXqKo8cNzY3xEPTL";
+var topSha512 = "sha512-D6yns0qxG0E7+TwkevZ4Jt5t7Iy3ugmAajG/dlf6Pado1JqTyneKXICDiqFIkLMRExgtvg8PlxbKTkYfRejSOg==";
+var invalidSha256 = "sha256-dKUcPOn/AlUjWIwcHeHNqYXPlvyGiq+2dWOdFcE+24I=";
+var invalidSha512 = "sha512-oUceBRNxPxnY60g/VtPCj2syT4wo4EZh2CgYdWy9veW8+OsReTXoh7dizMGZafvx9+QhMS39L/gIkxnPIn41Zg==";
+
+var url = "../resources/top.txt";
+var corsUrl = "http://www1.{{host}}:{{ports[http][0]}}" + dirname(location.pathname) + RESOURCES_DIR + "top.txt";
+/* Enable CORS*/
+corsUrl += "?pipe=header(Access-Control-Allow-Origin,*)";
+
+integrity("Empty string integrity", url, "", true);
+integrity("SHA-256 integrity", url, topSha256, true);
+integrity("SHA-384 integrity", url, topSha384, true);
+integrity("SHA-512 integrity", url, topSha512, true);
+integrity("Invalid integrity", url, invalidSha256, false);
+integrity("Multiple integrities: valid stronger than invalid", url, invalidSha256 + " " + topSha384, true);
+integrity("Multiple integrities: invalid stronger than valid", url, invalidSha512 + " " + topSha384, false);
+integrity("Multiple integrities: invalid as strong as valid", url, invalidSha512 + " " + topSha512, true);
+integrity("Multiple integrities: both are valid", url,  topSha384 + " " + topSha512, true);
+integrity("Multiple integrities: both are invalid", url, invalidSha256 + " " + invalidSha512, false);
+integrity("CORS empty integrity", corsUrl, "", true);
+integrity("CORS SHA-512 integrity", corsUrl, topSha512, true);
+integrity("CORS invalid integrity", corsUrl, invalidSha512, false);
+
+done();
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-expected.txt
new file mode 100644 (file)
index 0000000..4afcc5c
--- /dev/null
@@ -0,0 +1,6 @@
+
+FAIL Fetch ../resources/top.txt with no-cors mode promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch http://localhost:8800/fetch/api/resources/top.txt with no-cors mode promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch https://localhost:8443/fetch/api/resources/top.txt with no-cors mode promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch http://www.localhost:8800/fetch/api/resources/top.txt with no-cors mode promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-worker-expected.txt
new file mode 100644 (file)
index 0000000..4afcc5c
--- /dev/null
@@ -0,0 +1,6 @@
+
+FAIL Fetch ../resources/top.txt with no-cors mode promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch http://localhost:8800/fetch/api/resources/top.txt with no-cors mode promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch https://localhost:8443/fetch/api/resources/top.txt with no-cors mode promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch http://www.localhost:8800/fetch/api/resources/top.txt with no-cors mode promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-worker.html
new file mode 100644 (file)
index 0000000..87376a1
--- /dev/null
@@ -0,0 +1,17 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch in worker: no-cors mode and opaque filtering</title>
+    <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#concept-filtered-response-opaque">
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <script>
+      fetch_tests_from_worker(new Worker("mode-no-cors.js?pipe=sub"));
+    </script>
+  </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.html
new file mode 100644 (file)
index 0000000..7aee379
--- /dev/null
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch: no-cors mode and opaque filtering</title>
+    <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#concept-filtered-response-opaque">
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <script src="../resources/utils.js"></script>
+    <script src="mode-no-cors.js?pipe=sub"></script>
+  </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.js
new file mode 100644 (file)
index 0000000..2748365
--- /dev/null
@@ -0,0 +1,31 @@
+if (this.document === undefined) {
+  importScripts("/resources/testharness.js");
+  importScripts("../resources/utils.js");
+}
+
+function fetchNoCors(url, isOpaqueFiltered) {
+  var urlQuery = "?pipe=header(x-is-filtered,value)"
+  promise_test(function(test) {
+    if (isOpaqueFiltered)
+      return fetch(url + urlQuery, {"mode": "no-cors"}).then(function(resp) {
+        assert_equals(resp.status, 0, "Opaque filter: status is 0");
+        assert_equals(resp.statusText, "", "Opaque filter: statusText is \"\"");
+        assert_equals(resp.type , "opaque", "Opaque filter: response's type is opaque");
+        assert_equals(resp.headers.get("x-is-filtered"), null, "Header x-is-filtered is filtered");
+      });
+    else
+      return fetch(url + urlQuery, {"mode": "no-cors"}).then(function(resp) {
+        assert_equals(resp.status, 200, "HTTP status is 200");
+        assert_equals(resp.type , "basic", "Response's type is basic");
+        assert_equals(resp.headers.get("x-is-filtered"), "value", "Header x-is-filtered is not filtered");
+      });
+  }, "Fetch "+ url + " with no-cors mode");
+}
+
+fetchNoCors(RESOURCES_DIR + "top.txt", false);
+fetchNoCors("http://{{host}}:{{ports[http][0]}}/fetch/api/resources/top.txt", false);
+fetchNoCors("https://{{host}}:{{ports[https][0]}}/fetch/api/resources/top.txt", true);
+fetchNoCors("http://{{domains[www]}}:{{ports[http][0]}}/fetch/api/resources/top.txt", true);
+
+done();
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin-expected.txt
new file mode 100644 (file)
index 0000000..46907ec
--- /dev/null
@@ -0,0 +1,6 @@
+
+FAIL Fetch ../resources/top.txt with same-origin mode promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch http://localhost:8800/fetch/api/resources/top.txt with same-origin mode promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch https://localhost:8443/fetch/api/resources/top.txt with same-origin mode assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetch http://www.localhost:8800/fetch/api/resources/top.txt with same-origin mode assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin-worker-expected.txt
new file mode 100644 (file)
index 0000000..46907ec
--- /dev/null
@@ -0,0 +1,6 @@
+
+FAIL Fetch ../resources/top.txt with same-origin mode promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch http://localhost:8800/fetch/api/resources/top.txt with same-origin mode promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch https://localhost:8443/fetch/api/resources/top.txt with same-origin mode assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetch http://www.localhost:8800/fetch/api/resources/top.txt with same-origin mode assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin-worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin-worker.html
new file mode 100644 (file)
index 0000000..0c62472
--- /dev/null
@@ -0,0 +1,17 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch in worker: same-origin mode</title>
+    <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#basic-fetch">
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <script>
+      fetch_tests_from_worker(new Worker("mode-same-origin.js?pipe=sub"));
+    </script>
+  </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin.html
new file mode 100644 (file)
index 0000000..d94832a
--- /dev/null
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch: same-origin mode</title>
+    <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#basic-fetch">
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <script src="../resources/utils.js"></script>
+    <script src="mode-same-origin.js?pipe=sub"></script>
+  </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin.js
new file mode 100644 (file)
index 0000000..c00d96f
--- /dev/null
@@ -0,0 +1,24 @@
+if (this.document === undefined) {
+  importScripts("/resources/testharness.js");
+  importScripts("../resources/utils.js");
+}
+
+function fetchSameOrigin(url, shouldPass) {
+  promise_test(function(test) {
+    if (shouldPass)
+      return fetch(url , {"mode": "same-origin"}).then(function(resp) {
+        assert_equals(resp.status, 200, "HTTP status is 200");
+        assert_equals(resp.type, "basic", "response type is basic");
+      });
+    else
+      return promise_rejects(test, new TypeError, fetch(url, {mode: "same-origin"}));
+  }, "Fetch "+ url + " with same-origin mode");
+}
+
+fetchSameOrigin(RESOURCES_DIR + "top.txt", true);
+fetchSameOrigin("http://{{host}}:{{ports[http][0]}}/fetch/api/resources/top.txt", true);
+fetchSameOrigin("https://{{host}}:{{ports[https][0]}}/fetch/api/resources/top.txt", false);
+fetchSameOrigin("http://{{domains[www]}}:{{ports[http][0]}}/fetch/api/resources/top.txt", false);
+
+done();
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers-expected.txt
new file mode 100644 (file)
index 0000000..d5740d1
--- /dev/null
@@ -0,0 +1,26 @@
+
+FAIL Accept-Charset is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Accept-Encoding is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Access-Control-Request-Headers is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Access-Control-Request-Method is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Connection is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Content-Length is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Cookie is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Cookie2 is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Date is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL DNT is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Expect is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Host is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Keep-Alive is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Origin is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Referer is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL TE is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Trailer is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Transfer-Encoding is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Upgrade is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Via is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Proxy- is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Proxy-Test is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Sec- is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Sec-Test is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers-worker-expected.txt
new file mode 100644 (file)
index 0000000..d5740d1
--- /dev/null
@@ -0,0 +1,26 @@
+
+FAIL Accept-Charset is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Accept-Encoding is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Access-Control-Request-Headers is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Access-Control-Request-Method is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Connection is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Content-Length is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Cookie is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Cookie2 is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Date is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL DNT is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Expect is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Host is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Keep-Alive is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Origin is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Referer is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL TE is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Trailer is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Transfer-Encoding is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Upgrade is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Via is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Proxy- is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Proxy-Test is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Sec- is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Sec-Test is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers-worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers-worker.html
new file mode 100644 (file)
index 0000000..12e87f9
--- /dev/null
@@ -0,0 +1,17 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch in worker: forbidden request header management</title>
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#forbidden-header-name">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <script>
+      fetch_tests_from_worker(new Worker("request-forbidden-headers.js"));
+    </script>
+  </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers.html
new file mode 100644 (file)
index 0000000..56ce2a6
--- /dev/null
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch: forbidden request header management</title>
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#forbidden-header-name">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <script src="../resources/utils.js"></script>
+    <script src="request-forbidden-headers.js"></script>
+  </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers.js
new file mode 100644 (file)
index 0000000..72a8392
--- /dev/null
@@ -0,0 +1,48 @@
+if (this.document === undefined) {
+  importScripts("/resources/testharness.js");
+  importScripts("../resources/utils.js");
+}
+
+function requestForbiddenHeaders(desc, forbiddenHeaders) {
+  var url = RESOURCES_DIR + "inspect-headers.py";
+  var requestInit = {"headers": forbiddenHeaders}
+  var urlParameters = "?headers=" + Object.keys(forbiddenHeaders).join("|");
+
+  promise_test(function(test){
+    return fetch(url + urlParameters, requestInit).then(function(resp) {
+      assert_equals(resp.status, 200, "HTTP status is 200");
+      assert_equals(resp.type , "basic", "Response's type is basic");
+      for (var header in forbiddenHeaders)
+        assert_not_equals(resp.headers.get("x-request-" + header), forbiddenHeaders[header], header + " does not have the value we defined");
+    });
+  }, desc);
+}
+
+requestForbiddenHeaders("Accept-Charset is a forbidden request header", {"Accept-Charset": "utf-8"});
+requestForbiddenHeaders("Accept-Encoding is a forbidden request header", {"Accept-Encoding": ""});
+
+requestForbiddenHeaders("Access-Control-Request-Headers is a forbidden request header", {"Access-Control-Request-Headers": ""});
+requestForbiddenHeaders("Access-Control-Request-Method is a forbidden request header", {"Access-Control-Request-Method": ""});
+requestForbiddenHeaders("Connection is a forbidden request header", {"Connection": "close"});
+requestForbiddenHeaders("Content-Length is a forbidden request header", {"Content-Length": "42"});
+requestForbiddenHeaders("Cookie is a forbidden request header", {"Cookie": "cookie=none"});
+requestForbiddenHeaders("Cookie2 is a forbidden request header", {"Cookie2": "cookie2=none"});
+requestForbiddenHeaders("Date is a forbidden request header", {"Date": "Wed, 04 May 1988 22:22:22 GMT"});
+requestForbiddenHeaders("DNT is a forbidden request header", {"DNT": "4"});
+requestForbiddenHeaders("Expect is a forbidden request header", {"Expect": "100-continue"});
+requestForbiddenHeaders("Host is a forbidden request header", {"Host": "http://wrong-host.com"});
+requestForbiddenHeaders("Keep-Alive is a forbidden request header", {"Keep-Alive": "timeout=15"});
+requestForbiddenHeaders("Origin is a forbidden request header", {"Origin": "http://wrong-origin.com"});
+requestForbiddenHeaders("Referer is a forbidden request header", {"Referer": "http://wrong-referer.com"});
+requestForbiddenHeaders("TE is a forbidden request header", {"TE": "trailers"});
+requestForbiddenHeaders("Trailer is a forbidden request header", {"Trailer": "Accept"});
+requestForbiddenHeaders("Transfer-Encoding is a forbidden request header", {"Transfer-Encoding": "chunked"});
+requestForbiddenHeaders("Upgrade is a forbidden request header", {"Upgrade": "HTTP/2.0"});
+requestForbiddenHeaders("Via is a forbidden request header", {"Via": "1.1 nowhere.com"});
+requestForbiddenHeaders("Proxy- is a forbidden request header", {"Proxy-": "value"});
+requestForbiddenHeaders("Proxy-Test is a forbidden request header", {"Proxy-Test": "value"});
+requestForbiddenHeaders("Sec- is a forbidden request header", {"Sec-": "value"});
+requestForbiddenHeaders("Sec-Test is a forbidden request header", {"Sec-Test": "value"});
+
+done();
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-expected.txt
new file mode 100644 (file)
index 0000000..05e4580
--- /dev/null
@@ -0,0 +1,11 @@
+
+FAIL Fetch with GET promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch with HEAD promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch with HEAD with body promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch with PUT without body promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch with PUT with body promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch with POST without body promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch with POST with body promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch with Chicken promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch with Chicken with body promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt
new file mode 100644 (file)
index 0000000..05e4580
--- /dev/null
@@ -0,0 +1,11 @@
+
+FAIL Fetch with GET promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch with HEAD promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch with HEAD with body promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch with PUT without body promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch with PUT with body promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch with POST without body promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch with POST with body promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch with Chicken promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetch with Chicken with body promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker.html
new file mode 100644 (file)
index 0000000..85b4c4c
--- /dev/null
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch in worker: User agent add headers to request</title>
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-or-cache-fetch">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <script>
+      fetch_tests_from_worker(new Worker("request-headers.js"));
+    </script>
+  </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.html
new file mode 100644 (file)
index 0000000..5236d29
--- /dev/null
@@ -0,0 +1,15 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch: User agent add headers to request</title>
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-or-cache-fetch">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <script src="../resources/utils.js"></script>
+    <script src="request-headers.js"></script>
+  </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.js
new file mode 100644 (file)
index 0000000..ec14385
--- /dev/null
@@ -0,0 +1,35 @@
+if (this.document === undefined) {
+  importScripts("/resources/testharness.js");
+  importScripts("../resources/utils.js");
+}
+
+function requestHeaders(desc, url, method, body, expectedOrigin, expectedContentLength) {
+  var urlParameters = "?headers=origin|user-agent|accept-charset|content-length";
+  var requestInit = {"method": method}
+  if (body)
+    requestInit["body"] = body;
+  promise_test(function(test){
+    return fetch(url + urlParameters, requestInit).then(function(resp) {
+      assert_equals(resp.status, 200, "HTTP status is 200");
+      assert_equals(resp.type , "basic", "Response's type is basic");
+      assert_equals(resp.headers.get("x-request-origin") , expectedOrigin, "Request has header origin: " + expectedOrigin);
+      assert_equals(resp.headers.get("x-request-content-length") , expectedContentLength, "Request has header content-length: " + expectedContentLength);
+      assert_true(resp.headers.has("x-request-user-agent"), "Request has header user-agent");
+      assert_false(resp.headers.has("accept-charset"), "Request has header accept-charset");
+    });
+  }, desc);
+}
+
+var url = RESOURCES_DIR + "inspect-headers.py"
+
+requestHeaders("Fetch with GET", url, "GET", null, location.origin, null);
+requestHeaders("Fetch with HEAD", url, "HEAD", null, location.origin, "0");
+requestHeaders("Fetch with HEAD with body", url, "HEAD", "Request's body", location.origin, "14");
+requestHeaders("Fetch with PUT without body", url, "POST", null, location.origin, "0");
+requestHeaders("Fetch with PUT with body", url, "PUT", "Request's body", location.origin, "14");
+requestHeaders("Fetch with POST without body", url, "POST", null, location.origin, "0");
+requestHeaders("Fetch with POST with body", url, "POST", "Request's body", location.origin, "14");
+requestHeaders("Fetch with Chicken", url, "Chicken", null, location.origin, null);
+requestHeaders("Fetch with Chicken with body", url, "Chicken", "Request's body", location.origin, "14");
+
+done();
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about-expected.txt
new file mode 100644 (file)
index 0000000..67ed49d
--- /dev/null
@@ -0,0 +1,6 @@
+
+FAIL Fetching about:blank is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetching about:unicorn is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetching about:invalid.com is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching about:config is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about-worker-expected.txt
new file mode 100644 (file)
index 0000000..67ed49d
--- /dev/null
@@ -0,0 +1,6 @@
+
+FAIL Fetching about:blank is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetching about:unicorn is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetching about:invalid.com is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching about:config is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about-worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about-worker.html
new file mode 100644 (file)
index 0000000..9c9d9a0
--- /dev/null
@@ -0,0 +1,17 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch in worker: about scheme</title>
+    <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#basic-fetch">
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <script>
+      fetch_tests_from_worker(new Worker("scheme-about.js"));
+    </script>
+  </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.html
new file mode 100644 (file)
index 0000000..8b6df24
--- /dev/null
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch: about scheme</title>
+    <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#basic-fetch">
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <script src="../resources/utils.js"></script>
+    <script src="scheme-about.js"></script>
+  </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.js
new file mode 100644 (file)
index 0000000..5f3e7cf
--- /dev/null
@@ -0,0 +1,40 @@
+if (this.document === undefined) {
+  importScripts("/resources/testharness.js");
+  importScripts("../resources/utils.js");
+}
+
+var unicorn = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2361 1572" fill="hotpink"><path d="m1648 1570c-42-12 6-93 55-94 46 0 50-10 46-123-5-122-7-126-119-202-81-55-145-128-175-201-12-30-26-59-31-63s-58-4-119 0c-70 6-131 5-170-2-59-10-84-21-220-93-68-36-72-37-145-31-41 4-100 11-131 17-55 10-57 12-62 47-16 95 3 152 49 152 14 0 29 8 34 19 14 25 13 101-0 101-12 0-60-46-60-58 0-4-17-18-38-31l-38-23-2-115c-1-64 2-124 8-133s24-21 42-25c59-12 128-37 128-46 0-5-4-9-10-9-14 0-28-30-45-95-12-47-13-69-3-124 11-62 10-71-10-109-12-23-22-50-22-60s-7-27-15-37c-18-23-19-18-5 24 8 24 7 50-5 110-10 48-14 96-10 120 8 47-9 72-48 72-40 0-66-26-77-81-6-28-30-88-53-133-23-45-45-88-48-96-4-8-22-20-41-26-26-9-34-17-34-36 0-22 4-24 37-21l37 3-9-33c-12-43-6-47 31-20l30 22 26-20c14-11 39-38 55-61 39-53 63-62 139-49 46 8 64 8 75-2 8-7 15-8 15-4-0 15-14 30-34 37-37 14-6 19 44 7 49-12 53-11 90 15 28 19 48 26 69 23 37-6 29 10-16 28-19 8-32 19-28 24 4 6 15 5 30-2 18-8 35-7 71 5 27 9 58 16 71 16 32 0 29 17-7 35-16 9-30 17-30 20 0 2 22 2 49-2 44-5 52-3 96 31 27 20 54 34 62 32 25-10 14 4-16 19-16 8-39 15-50 15-29 0-26 16 20 87 45 68 96 101 189 123 149 35 239 59 268 71 27 12 36 11 67-4 21-10 41-29 47-45 23-59 39-78 80-101 60-32 141-27 175 12 23 28 25 34 43 178 15 118 36 182 72 224 28 32 35 35 90 35 75 0 125-21 167-68l33-37-17 40c-16 41-65 98-100 117-11 6-42 17-70 24l-50 12 62 1c48 0 72-5 116-28 50-25 55-26 45-8-17 33-98 115-136 139-29 18-51 22-113 22-71 1-80-2-115-30-21-17-86-28-99-128-7-56 0-176 0-176s18-102-6-175c-19-57-81-86-123-20-19 30-43 60-54 67-18 12-18 13 6 59 34 67 38 144 14 260l-20 95 24 35c13 20 40 51 59 70 40 38 41 50 29 252-6 92-9 107-25 111-10 3-19 12-19 20s-7 18-17 20c-32 10-87 15-105 10zm-1228-1255c0-18-2-19-16-8-12 10-13 15-3 21 18 11 18 11 18-13zm743 1151c-12-5-23-14-23-20 0-17 57-69 76-69 21 0 130-65 167-99 47-43 36-101-38-198-30-39-73-148-63-158 2-2 30-5 63-7l60-3 32 60c41 77 38 69 63 145 40 115 41 112-31 166-34 27-79 62-98 79-20 17-43 34-53 38-10 3-22 17-27 30-5 14-13 27-17 29-19 12-90 16-111 7zm-913-440c0-23 28-113 44-145 6-11 32-51 57-90 26-39 50-81 53-95 5-21 22-30 103-59 53-19 102-36 108-38 6-2 18 11 27 30l16 34-92 28c-105 32-126 47-161 122-16 34-35 58-50 63-32 13-40 42-22 85l15 36-37 25c-45 30-62 31-62 4zm-48-843c-41-18-25-52 19-39 21 6 23 10 14 28-9 17-15 19-33 11zm-74-25c-28-6-31-32-4-32 13 0 26 4 29 8 8 13-8 28-25 24zm-78-37c0-9 6-12 15-9 19 7 19 24 0 24-8 0-15-7-15-15zm-50-15c0-5 7-7 15-4 19 7 19 14 0 14-8 0-15-4-15-10z"/></svg>';
+
+function checkFetchResponse(url, data, mime, desc) {
+  if (!desc) {
+    var cut = (url.length >= 45) ? "[...]" : "";
+    desc = "Fetching " + url.substring(0, 45) + cut + " is OK"
+  }
+  promise_test(function(test) {
+    return fetch(url).then(function(resp) {
+     assert_equals(resp.status, 200, "HTTP status is 200");
+     assert_equals(resp.type, "basic", "response type is basic");
+     assert_equals(resp.headers.get("Content-Type"), mime, "Content-Type is " + resp.headers.get("Content-Type"));
+     return resp.text();
+    }).then(function(bodyAsText) {
+      assert_equals(bodyAsText, data, "Response's body is " + data);
+    })
+  }, desc);
+}
+
+checkFetchResponse("about:blank", "", "text/html;charset=utf-8");
+checkFetchResponse("about:unicorn", unicorn, "image/svg+xml");
+
+function checkKoUrl(url, desc) {
+  if (!desc)
+    desc = "Fetching " + url.substring(0, 45) + " is KO"
+  promise_test(function(test) {
+    var promise = fetch(url);
+    return promise_rejects(test, new TypeError(), promise);
+  }, desc);
+}
+
+checkKoUrl("about:invalid.com");
+checkKoUrl("about:config");
+
+done();
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-expected.txt
new file mode 100644 (file)
index 0000000..ceb0135
--- /dev/null
@@ -0,0 +1,5 @@
+
+FAIL Fetching blob:http://localhost:8800/4580501e-3c0f-4b03[...] is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetching [GET] blob:http://www.localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching [POST] blob:http://localhost:8800/ad829fe3-9045-4b29[...] is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt
new file mode 100644 (file)
index 0000000..dc0d2af
--- /dev/null
@@ -0,0 +1,5 @@
+
+FAIL Fetching blob:http://localhost:8800/8807dca8-91bf-4414[...] is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetching [GET] blob:http://www.localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching [POST] blob:http://localhost:8800/41805be3-d8cc-490f[...] is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker.html
new file mode 100644 (file)
index 0000000..961ecbd
--- /dev/null
@@ -0,0 +1,17 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch in worker: blob scheme</title>
+    <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#basic-fetch">
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <script>
+      fetch_tests_from_worker(new Worker("scheme-blob.js?pipe=sub"));
+    </script>
+  </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.html
new file mode 100644 (file)
index 0000000..7787c37
--- /dev/null
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch: blob scheme</title>
+    <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#basic-fetch">
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <script src="../resources/utils.js"></script>
+    <script src="scheme-blob.js?pipe=sub"></script>
+  </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.js
new file mode 100644 (file)
index 0000000..d9b804d
--- /dev/null
@@ -0,0 +1,41 @@
+if (this.document === undefined) {
+  importScripts("/resources/testharness.js");
+  importScripts("../resources/utils.js");
+}
+
+function checkFetchResponse(url, data, mime, size, desc) {
+  if (!desc)
+    var cut = (url.length >= 45) ? "[...]" : "";
+    desc = "Fetching " + url.substring(0, 45) + cut + " is OK"
+  promise_test(function(test) {
+    size = size.toString();
+    return fetch(url).then(function(resp) {
+      assert_equals(resp.status, 200, "HTTP status is 200");
+      assert_equals(resp.type, "basic", "response type is basic");
+      assert_equals(resp.headers.get("Content-Type"), mime, "Content-Type is " + resp.headers.get("Content-Type"));
+      assert_equals(resp.headers.get("Content-Length"), size, "Content-Length is " + resp.headers.get("Content-Length"));
+      return resp.text();
+    }).then(function(bodyAsText) {
+      assert_equals(bodyAsText, data, "Response's body is " + data);
+    })
+  }, desc);
+}
+
+var blob = new Blob(["Blob's data"], { "type" : "text/plain" });
+checkFetchResponse(URL.createObjectURL(blob), "Blob's data", "text/plain",  blob.size);
+
+function checkKoUrl(url, method, desc) {
+  if (!desc)
+    var cut = (url.length >= 45) ? "[...]" : "";
+    desc = "Fetching [" + method + "] " + url.substring(0, 45) + cut +  " is KO"
+  promise_test(function(test) {
+    var promise = fetch(url, {"method": method});
+    return promise_rejects(test, new TypeError(), promise);
+  }, desc);
+}
+
+var blob2 = new Blob(["Blob's data"], { "type" : "text/plain" });
+checkKoUrl("blob:http://{{domains[www]}}:{{ports[http][0]}}/", "GET");
+checkKoUrl(URL.createObjectURL(blob2), "POST");
+
+done();
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data-expected.txt
new file mode 100644 (file)
index 0000000..48f0aef
--- /dev/null
@@ -0,0 +1,8 @@
+
+FAIL Fetching data:,response%27s%20body is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetching data:text/plain;base64,cmVzcG9uc2UncyBib[...] is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetching data:image/png;base64,cmVzcG9uc2UncyBib2[...] is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetching [GET] data:notAdataUrl.com is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching [POST] data:,response%27s%20body is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching [HEAD] data:,response%27s%20body is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data-worker-expected.txt
new file mode 100644 (file)
index 0000000..48f0aef
--- /dev/null
@@ -0,0 +1,8 @@
+
+FAIL Fetching data:,response%27s%20body is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetching data:text/plain;base64,cmVzcG9uc2UncyBib[...] is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetching data:image/png;base64,cmVzcG9uc2UncyBib2[...] is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetching [GET] data:notAdataUrl.com is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching [POST] data:,response%27s%20body is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching [HEAD] data:,response%27s%20body is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data-worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data-worker.html
new file mode 100644 (file)
index 0000000..42fc3f4
--- /dev/null
@@ -0,0 +1,17 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch in worker: data scheme</title>
+    <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#basic-fetch">
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <script>
+      fetch_tests_from_worker(new Worker("scheme-data.js"));
+    </script>
+  </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data.html
new file mode 100644 (file)
index 0000000..0b41991
--- /dev/null
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch: data scheme</title>
+    <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#basic-fetch">
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <script src="../resources/utils.js"></script>
+    <script src="scheme-data.js"></script>
+  </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data.js
new file mode 100644 (file)
index 0000000..7754667
--- /dev/null
@@ -0,0 +1,39 @@
+if (this.document === undefined) {
+  importScripts("/resources/testharness.js");
+  importScripts("../resources/utils.js");
+}
+
+function checkFetchResponse(url, data, mime) {
+  var cut = (url.length >= 40) ? "[...]" : "";
+  desc = "Fetching " + url.substring(0, 40) + cut + " is OK"
+  promise_test(function(test) {
+    return fetch(url).then(function(resp) {
+      assert_equals(resp.status, 200, "HTTP status is 200");
+      assert_equals(resp.type, "basic", "response type is basic");
+      assert_equals(resp.headers.get("Content-Type"), mime, "Content-Type is " + resp.headers.get("Content-Type"));
+     return resp.text();
+    }).then(function(body) {
+        assert_equals(body, data, "Response's body is correct");
+    });
+  }, desc);
+}
+
+checkFetchResponse("data:,response%27s%20body", "response's body", "text/plain;charset=US-ASCII");
+checkFetchResponse("data:text/plain;base64,cmVzcG9uc2UncyBib2R5", "response's body", "text/plain");
+checkFetchResponse("data:image/png;base64,cmVzcG9uc2UncyBib2R5",
+                   "response's body",
+                   "image/png");
+
+function checkKoUrl(url, method, desc) {
+  var cut = (url.length >= 40) ? "[...]" : "";
+  desc = "Fetching [" + method + "] " + url.substring(0, 45) + cut + " is KO"
+  promise_test(function(test) {
+    return promise_rejects(test, new TypeError(), fetch(url, {"method": method}));
+  }, desc);
+}
+
+checkKoUrl("data:notAdataUrl.com", "GET");
+checkKoUrl("data:,response%27s%20body", "POST");
+checkKoUrl("data:,response%27s%20body", "HEAD");
+
+done();
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-expected.txt
new file mode 100644 (file)
index 0000000..c17442e
--- /dev/null
@@ -0,0 +1,18 @@
+
+FAIL Fetching aaa://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching cap://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching cid://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching dav://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching dict://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching dns://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching geo://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching im://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching imap://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching ipp://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching ldap://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching mailto://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching nfs://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching pop://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching rtsp://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching snmp://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-worker-expected.txt
new file mode 100644 (file)
index 0000000..c17442e
--- /dev/null
@@ -0,0 +1,18 @@
+
+FAIL Fetching aaa://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching cap://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching cid://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching dav://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching dict://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching dns://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching geo://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching im://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching imap://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching ipp://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching ldap://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching mailto://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching nfs://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching pop://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching rtsp://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching snmp://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-worker.html
new file mode 100644 (file)
index 0000000..397d925
--- /dev/null
@@ -0,0 +1,17 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch in worker: urls with unsupported schemes</title>
+    <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#basic-fetch">
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <script>
+      fetch_tests_from_worker(new Worker("scheme-others.js?pipe=sub"));
+    </script>
+  </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.html
new file mode 100644 (file)
index 0000000..dd37143
--- /dev/null
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch: urls with unsupported schemes</title>
+    <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#basic-fetch">
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <script src="../resources/utils.js"></script>
+    <script src="scheme-others.js?pipe=sub"></script>
+  </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.js
new file mode 100644 (file)
index 0000000..ce02ec1
--- /dev/null
@@ -0,0 +1,33 @@
+if (this.document === undefined) {
+  importScripts("/resources/testharness.js");
+  importScripts("../resources/utils.js");
+}
+
+function checkKoUrl(url, desc) {
+  if (!desc)
+    desc = "Fetching " + url.substring(0, 45) + " is KO"
+  promise_test(function(test) {
+    var promise = fetch(url);
+    return promise_rejects(test, new TypeError(), promise);
+  }, desc);
+}
+
+var urlWithoutScheme = "://{{host}}:{{ports[http][0]}}/";
+checkKoUrl("aaa" + urlWithoutScheme);
+checkKoUrl("cap" + urlWithoutScheme);
+checkKoUrl("cid" + urlWithoutScheme);
+checkKoUrl("dav" + urlWithoutScheme);
+checkKoUrl("dict" + urlWithoutScheme);
+checkKoUrl("dns" + urlWithoutScheme);
+checkKoUrl("geo" + urlWithoutScheme);
+checkKoUrl("im" + urlWithoutScheme);
+checkKoUrl("imap" + urlWithoutScheme);
+checkKoUrl("ipp" + urlWithoutScheme);
+checkKoUrl("ldap" + urlWithoutScheme);
+checkKoUrl("mailto" + urlWithoutScheme);
+checkKoUrl("nfs" + urlWithoutScheme);
+checkKoUrl("pop" + urlWithoutScheme);
+checkKoUrl("rtsp" + urlWithoutScheme);
+checkKoUrl("snmp" + urlWithoutScheme);
+
+done();
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response-expected.txt
new file mode 100644 (file)
index 0000000..118268f
--- /dev/null
@@ -0,0 +1,3 @@
+
+FAIL Stream response's body promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response-worker-expected.txt
new file mode 100644 (file)
index 0000000..118268f
--- /dev/null
@@ -0,0 +1,3 @@
+
+FAIL Stream response's body promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response-worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response-worker.html
new file mode 100644 (file)
index 0000000..0be1c0d
--- /dev/null
@@ -0,0 +1,17 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch in worker: retrieve response's body progressively</title>
+    <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#http-fetch">
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <script>
+      fetch_tests_from_worker(new Worker("stream-response.js"));
+    </script>
+  </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response.html
new file mode 100644 (file)
index 0000000..eb6b141
--- /dev/null
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch: retrieve response's body progressively</title>
+    <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#http-fetch">
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <script src="../resources/utils.js"></script>
+    <script src="stream-response.js"></script>
+  </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response.js
new file mode 100644 (file)
index 0000000..322b164
--- /dev/null
@@ -0,0 +1,33 @@
+if (this.document === undefined) {
+  importScripts("/resources/testharness.js");
+  importScripts("../resources/utils.js");
+}
+
+function streamBody(reader, test, count) {
+  return reader.read().then(function(data) {
+    if (!data.done && count < 2) {
+      count += 1;
+      return streamBody(reader, test, count);
+    } else {
+      test.step(function() {
+        assert_true(count >= 2, "Retrieve body progressively");
+      });
+    }
+  });
+}
+
+//simulate streaming:
+//count is large enough to let the UA deliver the body before it is completely retrieved
+promise_test(function(test) {
+  return fetch(RESOURCES_DIR + "trickle.py?ms=30&count=100").then(function(resp) {
+    var count = 0;
+    if (resp.body)
+      return streamBody(resp.body.getReader(), test, count);
+    else
+      test.step(function() {
+        assert_unreached( "Body does not exist in response");
+      });
+  });
+}, "Stream response's body");
+
+done();
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/w3c-import.log
new file mode 100644 (file)
index 0000000..4f08847
--- /dev/null
@@ -0,0 +1,50 @@
+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in Webkit.
+Instead, create a pull request on the W3C CSS or WPT github:
+       https://github.com/w3c/csswg-test
+       https://github.com/w3c/web-platform-tests
+
+Then run the Tools/Scripts/import-w3c-tests in Webkit to reimport
+
+Do NOT modify or remove this file
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header-worker.html
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header.html
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header.js
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-worker.html
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.html
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.js
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-worker.html
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.html
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.js
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin-worker.html
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin.html
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin.js
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers-worker.html
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers.html
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers.js
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker.html
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.html
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.js
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about-worker.html
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.html
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.js
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker.html
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.html
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.js
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data-worker.html
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data.html
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data.js
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-worker.html
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.html
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.js
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response-worker.html
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response.html
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response.js
index ffe293d4692571b42763569d52e804ea2a2d697b..e524e36d51519581640cffbbcc669871aec2f9f2 100644 (file)
@@ -165,10 +165,12 @@ set(WebCore_NON_SVG_IDL_FILES
     Modules/battery/BatteryManager.idl
     Modules/battery/NavigatorBattery.idl
 
+    Modules/fetch/DOMWindowFetch.idl
     Modules/fetch/FetchBody.idl
     Modules/fetch/FetchHeaders.idl
     Modules/fetch/FetchRequest.idl
     Modules/fetch/FetchResponse.idl
+    Modules/fetch/WorkerGlobalScopeFetch.idl
 
     Modules/geolocation/Coordinates.idl
     Modules/geolocation/Geolocation.idl
@@ -812,10 +814,12 @@ set(WebCore_SOURCES
     Modules/battery/BatteryStatus.cpp
     Modules/battery/NavigatorBattery.cpp
 
+    Modules/fetch/DOMWindowFetch.cpp
     Modules/fetch/FetchBody.cpp
     Modules/fetch/FetchHeaders.cpp
     Modules/fetch/FetchRequest.cpp
     Modules/fetch/FetchResponse.cpp
+    Modules/fetch/WorkerGlobalScopeFetch.cpp
 
     Modules/geolocation/Coordinates.cpp
     Modules/geolocation/GeoNotifier.cpp
index fe26c27efae328bf2f19f7b13944dcd00363fd31..c704a0d52085cf975dae04d0a0ebb9842bd29f17 100644 (file)
@@ -1,3 +1,82 @@
+2016-03-08  Youenn Fablet  <youenn.fablet@crf.canon.fr>
+
+        [Fetch API] Implement fetch skeleton
+        https://bugs.webkit.org/show_bug.cgi?id=155111
+
+        Reviewed by Darin Adler.
+
+        Adding skeleton code to call fetch API from normal and worker scopes.
+        Fetch API implementation is limited to reject the promise.
+
+        Updating the binding generator to fix the case of overloaded promise-returning functions.
+        Made overloaded utility functions "static inline".
+
+        Tests: imported/w3c/web-platform-tests/fetch/api/basic/accept-header-worker.html
+               imported/w3c/web-platform-tests/fetch/api/basic/accept-header.html
+               imported/w3c/web-platform-tests/fetch/api/basic/integrity-worker.html
+               imported/w3c/web-platform-tests/fetch/api/basic/integrity.html
+               imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-worker.html
+               imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.html
+               imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin-worker.html
+               imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin.html
+               imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers-worker.html
+               imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers.html
+               imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker.html
+               imported/w3c/web-platform-tests/fetch/api/basic/request-headers.html
+               imported/w3c/web-platform-tests/fetch/api/basic/scheme-about-worker.html
+               imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.html
+               imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker.html
+               imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.html
+               imported/w3c/web-platform-tests/fetch/api/basic/scheme-data-worker.html
+               imported/w3c/web-platform-tests/fetch/api/basic/scheme-data.html
+               imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-worker.html
+               imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.html
+               imported/w3c/web-platform-tests/fetch/api/basic/stream-response-worker.html
+               imported/w3c/web-platform-tests/fetch/api/basic/stream-response.html
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * Modules/fetch/DOMWindowFetch.cpp: Added.
+        (WebCore::DOMWindowFetch::fetch):
+        * Modules/fetch/DOMWindowFetch.h: Added.
+        * Modules/fetch/DOMWindowFetch.idl: Added.
+        * Modules/fetch/WorkerGlobalScopeFetch.cpp: Added.
+        (WebCore::WorkerGlobalScopeFetch::fetch):
+        * Modules/fetch/WorkerGlobalScopeFetch.h: Added.
+        * Modules/fetch/WorkerGlobalScopeFetch.idl: Added.
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateImplementation): Fixing the case of overloaded promise-returning functions.
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod1):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod3):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod4):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod5):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod6):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod7):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod8):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod9):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod10):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod11):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod12):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter1):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2):
+        (WebCore::jsTestObjConstructorFunctionOverloadedMethod11):
+        (WebCore::jsTestObjConstructorFunctionOverloadedMethod12):
+        (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1):
+        (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise):
+        (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2):
+        (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise):
+        (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod): Deleted.
+        (WebCore::jsTestObjConstructorFunctionClassMethod2): Deleted.
+        (WebCore::jsTestObjPrototypeFunctionAny): Deleted.
+        (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionPromise): Deleted.
+        (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise): Deleted.
+        (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise): Deleted.
+        * bindings/scripts/test/TestObj.idl:
+
 2016-03-08  Youenn Fablet  <youenn.fablet@crf.canon.fr>
 
         [Fetch API] Make FetchRequest and FetchResponse ActiveDOMObject
index 85dbb95347b63eb70d1a1cef28099e07b71d628c..0839bd240f8fad3ad81ada5cc4ac064293d06b6f 100644 (file)
@@ -80,10 +80,12 @@ NON_SVG_BINDING_IDLS = \
     $(WebCore)/Modules/encryptedmedia/MediaKeyNeededEvent.idl \
     $(WebCore)/Modules/encryptedmedia/MediaKeySession.idl \
     $(WebCore)/Modules/encryptedmedia/MediaKeys.idl \
+    $(WebCore)/Modules/fetch/DOMWindowFetch.idl \
     $(WebCore)/Modules/fetch/FetchBody.idl \
     $(WebCore)/Modules/fetch/FetchHeaders.idl \
     $(WebCore)/Modules/fetch/FetchRequest.idl \
     $(WebCore)/Modules/fetch/FetchResponse.idl \
+    $(WebCore)/Modules/fetch/WorkerGlobalScopeFetch.idl \
     $(WebCore)/Modules/gamepad/Gamepad.idl \
     $(WebCore)/Modules/gamepad/GamepadButton.idl \
     $(WebCore)/Modules/gamepad/GamepadEvent.idl \
diff --git a/Source/WebCore/Modules/fetch/DOMWindowFetch.cpp b/Source/WebCore/Modules/fetch/DOMWindowFetch.cpp
new file mode 100644 (file)
index 0000000..a4c83c3
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2016 Canon Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions
+ * are required to be met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Canon Inc. nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CANON INC. AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL CANON INC. AND ITS CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DOMWindowFetch.h"
+
+#if ENABLE(FETCH_API)
+
+namespace WebCore {
+
+void DOMWindowFetch::fetch(DOMWindow&, FetchRequest*, const Dictionary&, FetchPromise&& promise)
+{
+    promise.reject(ASCIILiteral("Fetch is not yet implemented"));
+}
+
+void DOMWindowFetch::fetch(DOMWindow&, const String&, const Dictionary&, FetchPromise&& promise)
+{
+    promise.reject(ASCIILiteral("Fetch is not yet implemented"));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(FETCH_API)
diff --git a/Source/WebCore/Modules/fetch/DOMWindowFetch.h b/Source/WebCore/Modules/fetch/DOMWindowFetch.h
new file mode 100644 (file)
index 0000000..9fb155e
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2016 Canon Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions
+ * are required to be met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Canon Inc. nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CANON INC. AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL CANON INC. AND ITS CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef DOMWindowFetch_h
+#define DOMWindowFetch_h
+
+#if ENABLE(FETCH_API)
+
+#include "JSDOMPromise.h"
+
+namespace WebCore {
+
+class Dictionary;
+class FetchRequest;
+class FetchResponse;
+
+class DOMWindowFetch {
+public:
+    using FetchPromise = DOMPromise<RefPtr<FetchResponse>, String>;
+    static void fetch(DOMWindow&, FetchRequest*, const Dictionary&, FetchPromise&&);
+    static void fetch(DOMWindow&, const String&, const Dictionary&, FetchPromise&&);
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(FETCH_API)
+
+#endif // DOMWindowFetch_h
diff --git a/Source/WebCore/Modules/fetch/DOMWindowFetch.idl b/Source/WebCore/Modules/fetch/DOMWindowFetch.idl
new file mode 100644 (file)
index 0000000..175b8ff
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2016 Canon Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions
+ * are required to be met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Canon Inc. nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CANON INC. AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL CANON INC. AND ITS CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    Conditional=FETCH_API,
+] partial interface DOMWindow {
+    Promise fetch(DOMString input, optional Dictionary init);
+    Promise fetch(FetchRequest input, optional Dictionary init);
+};
diff --git a/Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.cpp b/Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.cpp
new file mode 100644 (file)
index 0000000..97d5c08
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2016 Canon Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions
+ * are required to be met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Canon Inc. nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CANON INC. AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL CANON INC. AND ITS CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WorkerGlobalScopeFetch.h"
+
+#if ENABLE(FETCH_API)
+
+namespace WebCore {
+
+void WorkerGlobalScopeFetch::fetch(WorkerGlobalScope&, FetchRequest*, const Dictionary&, FetchPromise&& promise)
+{
+    promise.reject(ASCIILiteral("Fetch is not yet implemented"));
+}
+
+void WorkerGlobalScopeFetch::fetch(WorkerGlobalScope&, const String&, const Dictionary&, FetchPromise&& promise)
+{
+    promise.reject(ASCIILiteral("Fetch is not yet implemented"));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(FETCH_API)
diff --git a/Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.h b/Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.h
new file mode 100644 (file)
index 0000000..75080ec
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2016 Canon Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions
+ * are required to be met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Canon Inc. nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CANON INC. AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL CANON INC. AND ITS CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef WorkerGlobalScopeFetch_h
+#define WorkerGlobalScopeFetch_h
+
+#if ENABLE(FETCH_API)
+
+#include "JSDOMPromise.h"
+
+namespace WebCore {
+
+class Dictionary;
+class FetchRequest;
+class FetchResponse;
+class ScriptExecutionContext;
+class WorkerGlobalScope;
+
+class WorkerGlobalScopeFetch {
+public:
+    using FetchPromise = DOMPromise<RefPtr<FetchResponse>, String>;
+    static void fetch(WorkerGlobalScope&, FetchRequest*, const Dictionary&, FetchPromise&&);
+    static void fetch(WorkerGlobalScope&, const String&, const Dictionary&, FetchPromise&&);
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(FETCH_API)
+
+#endif // WorkerGlobalScopeFetch_h
diff --git a/Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.idl b/Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.idl
new file mode 100644 (file)
index 0000000..850b5c0
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2016 Canon Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions
+ * are required to be met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Canon Inc. nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CANON INC. AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL CANON INC. AND ITS CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    Conditional=FETCH_API,
+] partial interface WorkerGlobalScope {
+    Promise fetch(DOMString input, optional Dictionary init);
+    Promise fetch(FetchRequest input, optional Dictionary init);
+};
index 8622a4dd096627759f714c1d93e3bc3c62da0828..1681f2fe7a651a800e0fbd5f62c985648dffc6ed 100644 (file)
                41885B9411B6FDA6003383BB /* FormSubmission.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41885B9211B6FDA6003383BB /* FormSubmission.cpp */; };
                418A06D0133C04D500CD379C /* EventDispatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 418A06CE133C04D500CD379C /* EventDispatcher.h */; };
                418A06D1133C04D500CD379C /* EventDispatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 418A06CF133C04D500CD379C /* EventDispatcher.cpp */; };
+               418C39561C8DAC7F0051C8A3 /* DOMWindowFetch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 418C39521C8DAC7B0051C8A3 /* DOMWindowFetch.cpp */; };
+               418C395A1C8DD6990051C8A3 /* WorkerGlobalScopeFetch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 418C39571C8DD6960051C8A3 /* WorkerGlobalScopeFetch.cpp */; };
                418F88040FF957AE0080F045 /* JSAbstractWorker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 418F88020FF957AE0080F045 /* JSAbstractWorker.cpp */; };
                418F88050FF957AF0080F045 /* JSAbstractWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = 418F88030FF957AE0080F045 /* JSAbstractWorker.h */; };
                419BC2DE1685329900D64D6D /* VisitedLinkState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 419BC2DC1685329900D64D6D /* VisitedLinkState.cpp */; };
                41885B9211B6FDA6003383BB /* FormSubmission.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormSubmission.cpp; sourceTree = "<group>"; };
                418A06CE133C04D500CD379C /* EventDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventDispatcher.h; sourceTree = "<group>"; };
                418A06CF133C04D500CD379C /* EventDispatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventDispatcher.cpp; sourceTree = "<group>"; };
+               418C39521C8DAC7B0051C8A3 /* DOMWindowFetch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowFetch.cpp; sourceTree = "<group>"; };
+               418C39531C8DAC7B0051C8A3 /* DOMWindowFetch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWindowFetch.h; sourceTree = "<group>"; };
+               418C39541C8DAC7B0051C8A3 /* DOMWindowFetch.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMWindowFetch.idl; sourceTree = "<group>"; };
+               418C39571C8DD6960051C8A3 /* WorkerGlobalScopeFetch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkerGlobalScopeFetch.cpp; sourceTree = "<group>"; };
+               418C39581C8DD6960051C8A3 /* WorkerGlobalScopeFetch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerGlobalScopeFetch.h; sourceTree = "<group>"; };
+               418C39591C8DD6960051C8A3 /* WorkerGlobalScopeFetch.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WorkerGlobalScopeFetch.idl; sourceTree = "<group>"; };
                418F88020FF957AE0080F045 /* JSAbstractWorker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAbstractWorker.cpp; sourceTree = "<group>"; };
                418F88030FF957AE0080F045 /* JSAbstractWorker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAbstractWorker.h; sourceTree = "<group>"; };
                419BC2DC1685329900D64D6D /* VisitedLinkState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VisitedLinkState.cpp; sourceTree = "<group>"; };
                41F54F7C1C50C4F600338488 /* fetch */ = {
                        isa = PBXGroup;
                        children = (
+                               418C39521C8DAC7B0051C8A3 /* DOMWindowFetch.cpp */,
+                               418C39531C8DAC7B0051C8A3 /* DOMWindowFetch.h */,
+                               418C39541C8DAC7B0051C8A3 /* DOMWindowFetch.idl */,
                                41F54F7D1C50C4F600338488 /* FetchBody.cpp */,
                                41F54F7E1C50C4F600338488 /* FetchBody.h */,
                                41F54F7F1C50C4F600338488 /* FetchBody.idl */,
                                413015D61C7B570400091C6E /* FetchResponse.h */,
                                413015D71C7B570400091C6E /* FetchResponse.idl */,
                                413015D81C7B570400091C6E /* FetchResponse.js */,
+                               418C39571C8DD6960051C8A3 /* WorkerGlobalScopeFetch.cpp */,
+                               418C39581C8DD6960051C8A3 /* WorkerGlobalScopeFetch.h */,
+                               418C39591C8DD6960051C8A3 /* WorkerGlobalScopeFetch.idl */,
                        );
                        path = fetch;
                        sourceTree = "<group>";
                                5148453F1BB9D07E006A72ED /* IDBError.h in Headers */,
                                5185FC8B1BB4C4E80012898F /* IDBEventDispatcher.h in Headers */,
                                5185FC8D1BB4C4E80012898F /* IDBFactory.h in Headers */,
-                               51F41A721BA73B5B002E053B /* IDBFactoryBackendInterface.h in Headers */,
                                69A6CBAD1C6BE42C00B836E9 /* AccessibilitySVGElement.h in Headers */,
                                510310501BA8CC03003329C0 /* IDBFactoryImpl.h in Headers */,
                                5185FC8F1BB4C4E80012898F /* IDBGetResult.h in Headers */,
                                FD31607D12B026F700C1A359 /* AudioChannel.cpp in Sources */,
                                FD31600412B0267600C1A359 /* AudioContext.cpp in Sources */,
                                CD0EEE0E14743F39003EAFA2 /* AudioDestinationIOS.cpp in Sources */,
+                               418C39561C8DAC7F0051C8A3 /* DOMWindowFetch.cpp in Sources */,
                                FD3160BC12B0272A00C1A359 /* AudioDestinationMac.cpp in Sources */,
                                FD31600712B0267600C1A359 /* AudioDestinationNode.cpp in Sources */,
                                FD31608112B026F700C1A359 /* AudioDSPKernelProcessor.cpp in Sources */,
                                A871DE250A152AC800B12A68 /* HTMLHeadElement.cpp in Sources */,
                                A8EA7CAE0A192B9C00A8EF5F /* HTMLHeadingElement.cpp in Sources */,
                                A8EA7CB30A192B9C00A8EF5F /* HTMLHRElement.cpp in Sources */,
+                               418C395A1C8DD6990051C8A3 /* WorkerGlobalScopeFetch.cpp in Sources */,
                                A871DE260A152AC800B12A68 /* HTMLHtmlElement.cpp in Sources */,
                                A871DE240A152AC800B12A68 /* HTMLIFrameElement.cpp in Sources */,
                                A8EA7D310A19385500A8EF5F /* HTMLImageElement.cpp in Sources */,
index 0a9fd19dc8769e21e46a858ba67a5bc43cf16a08..c336b4e81a48ea52c19c1c62977ce86cffee17df 100644 (file)
@@ -2882,13 +2882,12 @@ sub GenerateImplementation
                 push(@implContent, "#if ${conditionalString}\n");
             }
 
-
+            my $functionReturn = "EncodedJSValue JSC_HOST_CALL";
             if (!$isCustom && $isOverloaded) {
                 # Append a number to an overloaded method's name to make it unique:
                 $functionName = $functionName . $function->{overloadIndex};
-                # Make this function static to avoid compiler warnings, since we
-                # don't generate a prototype for it in the header.
-                push(@implContent, "static ");
+                # Make this function static to avoid compiler warnings, since we don't generate a prototype for it in the header.
+                $functionReturn = "static inline EncodedJSValue";
             }
 
             my $functionImplementationName = $function->signature->extendedAttributes->{"ImplementedAs"} || $codeGenerator->WK_lcfirst($function->signature->name);
@@ -2896,17 +2895,18 @@ sub GenerateImplementation
             if (IsReturningPromise($function) && !$isCustom) {
                 AddToImplIncludes("JSDOMPromise.h");
 
-                push(@implContent, "static inline EncodedJSValue ${functionName}Promise(ExecState*, JSPromiseDeferred*);\n");
-                push(@implContent, "EncodedJSValue JSC_HOST_CALL ${functionName}(ExecState* state)\n");
-                push(@implContent, "{\n");
-
-                push(@implContent, "    return JSValue::encode(callPromiseFunction(*state, ${functionName}Promise));\n");
+                push(@implContent, <<END);
+static EncodedJSValue ${functionName}Promise(ExecState*, JSPromiseDeferred*);
+${functionReturn} ${functionName}(ExecState* state)
+{
+    return JSValue::encode(callPromiseFunction(*state, ${functionName}Promise));
+}
 
-                push(@implContent, "}\n");
-                push(@implContent, "\nstatic inline EncodedJSValue ${functionName}Promise(ExecState* state, JSPromiseDeferred* promiseDeferred)\n");
+static inline EncodedJSValue ${functionName}Promise(ExecState* state, JSPromiseDeferred* promiseDeferred)
+END
             }
             else {
-                push(@implContent, "EncodedJSValue JSC_HOST_CALL ${functionName}(ExecState* state)\n");
+                push(@implContent, "${functionReturn} ${functionName}(ExecState* state)\n");
             }
 
             push(@implContent, "{\n");
index b473a8333858802ef3e532ff437216de06527bb2..e0b217879662396ff538fa3468d119585716ab4d 100644 (file)
@@ -34,6 +34,7 @@
 #include "JSDOMStringList.h"
 #include "JSDocument.h"
 #include "JSEventListener.h"
+#include "JSFetchRequest.h"
 #include "JSKeyValueIterator.h"
 #include "JSNode.h"
 #include "JSSVGDocument.h"
@@ -186,6 +187,7 @@ JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseFunction(
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgument(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseFunctionWithException(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseOverloadedFunction(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNeedsLifecycleProcessingStack(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSymbolIterator(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionEntries(JSC::ExecState*);
@@ -715,6 +717,7 @@ static const HashTableValue JSTestObjPrototypeTableValues[] =
     { "testPromiseFunctionWithFloatArgument", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgument), (intptr_t) (1) } },
     { "testPromiseFunctionWithException", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionTestPromiseFunctionWithException), (intptr_t) (0) } },
     { "testPromiseFunctionWithOptionalIntArgument", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument), (intptr_t) (0) } },
+    { "testPromiseOverloadedFunction", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionTestPromiseOverloadedFunction), (intptr_t) (1) } },
     { "methodWithNeedsLifecycleProcessingStack", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNeedsLifecycleProcessingStack), (intptr_t) (0) } },
     { "entries", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionEntries), (intptr_t) (0) } },
     { "keys", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionKeys), (intptr_t) (0) } },
@@ -4128,7 +4131,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConditionalMethod3(ExecSt
 
 #endif
 
-static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(ExecState* state)
+static inline EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod1(ExecState* state)
 {
     JSValue thisValue = state->thisValue();
     auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
@@ -4148,7 +4151,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(
     return JSValue::encode(jsUndefined());
 }
 
-static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(ExecState* state)
+static inline EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod2(ExecState* state)
 {
     JSValue thisValue = state->thisValue();
     auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
@@ -4175,7 +4178,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(
     return JSValue::encode(jsUndefined());
 }
 
-static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod3(ExecState* state)
+static inline EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod3(ExecState* state)
 {
     JSValue thisValue = state->thisValue();
     auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
@@ -4192,7 +4195,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod3(
     return JSValue::encode(jsUndefined());
 }
 
-static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod4(ExecState* state)
+static inline EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod4(ExecState* state)
 {
     JSValue thisValue = state->thisValue();
     auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
@@ -4209,7 +4212,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod4(
     return JSValue::encode(jsUndefined());
 }
 
-static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod5(ExecState* state)
+static inline EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod5(ExecState* state)
 {
     JSValue thisValue = state->thisValue();
     auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
@@ -4226,7 +4229,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod5(
     return JSValue::encode(jsUndefined());
 }
 
-static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod6(ExecState* state)
+static inline EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod6(ExecState* state)
 {
     JSValue thisValue = state->thisValue();
     auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
@@ -4243,7 +4246,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod6(
     return JSValue::encode(jsUndefined());
 }
 
-static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod7(ExecState* state)
+static inline EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod7(ExecState* state)
 {
     JSValue thisValue = state->thisValue();
     auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
@@ -4260,7 +4263,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod7(
     return JSValue::encode(jsUndefined());
 }
 
-static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod8(ExecState* state)
+static inline EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod8(ExecState* state)
 {
     JSValue thisValue = state->thisValue();
     auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
@@ -4277,7 +4280,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod8(
     return JSValue::encode(jsUndefined());
 }
 
-static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod9(ExecState* state)
+static inline EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod9(ExecState* state)
 {
     JSValue thisValue = state->thisValue();
     auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
@@ -4294,7 +4297,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod9(
     return JSValue::encode(jsUndefined());
 }
 
-static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod10(ExecState* state)
+static inline EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod10(ExecState* state)
 {
     JSValue thisValue = state->thisValue();
     auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
@@ -4311,7 +4314,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod10
     return JSValue::encode(jsUndefined());
 }
 
-static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod11(ExecState* state)
+static inline EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod11(ExecState* state)
 {
     JSValue thisValue = state->thisValue();
     auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
@@ -4328,7 +4331,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod11
     return JSValue::encode(jsUndefined());
 }
 
-static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod12(ExecState* state)
+static inline EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod12(ExecState* state)
 {
     JSValue thisValue = state->thisValue();
     auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
@@ -4380,7 +4383,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(ExecStat
     return throwVMTypeError(state);
 }
 
-static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter1(ExecState* state)
+static inline EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter1(ExecState* state)
 {
     JSValue thisValue = state->thisValue();
     auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
@@ -4407,7 +4410,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethodWi
     return JSValue::encode(jsUndefined());
 }
 
-static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2(ExecState* state)
+static inline EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2(ExecState* state)
 {
     JSValue thisValue = state->thisValue();
     auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
@@ -4478,7 +4481,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionClassMethod2(ExecState*
 }
 
 #if ENABLE(Condition1)
-static EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionOverloadedMethod11(ExecState* state)
+static inline EncodedJSValue jsTestObjConstructorFunctionOverloadedMethod11(ExecState* state)
 {
     if (UNLIKELY(state->argumentCount() < 1))
         return throwVMError(state, createNotEnoughArgumentsError(state));
@@ -4492,7 +4495,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionOverloadedMethod
 #endif
 
 #if ENABLE(Condition1)
-static EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionOverloadedMethod12(ExecState* state)
+static inline EncodedJSValue jsTestObjConstructorFunctionOverloadedMethod12(ExecState* state)
 {
     if (UNLIKELY(state->argumentCount() < 1))
         return throwVMError(state, createNotEnoughArgumentsError(state));
@@ -4931,7 +4934,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAny(ExecState* state)
     return JSValue::encode(jsUndefined());
 }
 
-static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionPromise(ExecState*, JSPromiseDeferred*);
+static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionPromise(ExecState*, JSPromiseDeferred*);
 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseFunction(ExecState* state)
 {
     return JSValue::encode(callPromiseFunction(*state, jsTestObjPrototypeFunctionTestPromiseFunctionPromise));
@@ -4949,7 +4952,7 @@ static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionPromis
     return JSValue::encode(jsUndefined());
 }
 
-static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise(ExecState*, JSPromiseDeferred*);
+static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise(ExecState*, JSPromiseDeferred*);
 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgument(ExecState* state)
 {
     return JSValue::encode(callPromiseFunction(*state, jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise));
@@ -4976,7 +4979,7 @@ static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithFl
     return JSValue::encode(jsUndefined());
 }
 
-static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise(ExecState*, JSPromiseDeferred*);
+static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise(ExecState*, JSPromiseDeferred*);
 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseFunctionWithException(ExecState* state)
 {
     return JSValue::encode(callPromiseFunction(*state, jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise));
@@ -4996,7 +4999,7 @@ static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithEx
     return JSValue::encode(jsUndefined());
 }
 
-static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise(ExecState*, JSPromiseDeferred*);
+static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise(ExecState*, JSPromiseDeferred*);
 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument(ExecState* state)
 {
     return JSValue::encode(callPromiseFunction(*state, jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise));
@@ -5024,6 +5027,69 @@ static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithOp
     return JSValue::encode(jsUndefined());
 }
 
+static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise(ExecState*, JSPromiseDeferred*);
+static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1(ExecState* state)
+{
+    return JSValue::encode(callPromiseFunction(*state, jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise));
+}
+
+static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise(ExecState* state, JSPromiseDeferred* promiseDeferred)
+{
+    JSValue thisValue = state->thisValue();
+    auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+    if (UNLIKELY(!castedThis))
+        return throwThisTypeError(*state, "TestObj", "testPromiseOverloadedFunction");
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+    auto& impl = castedThis->wrapped();
+    if (UNLIKELY(state->argumentCount() < 1))
+        return throwVMError(state, createNotEnoughArgumentsError(state));
+    float a = state->argument(0).toFloat(state);
+    if (UNLIKELY(state->hadException()))
+        return JSValue::encode(jsUndefined());
+    if (!std::isfinite(a)) {
+        setDOMException(state, TypeError);
+        return JSValue::encode(jsUndefined());
+    }
+    impl.testPromiseOverloadedFunction(a, DeferredWrapper(state, castedThis->globalObject(), promiseDeferred));
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise(ExecState*, JSPromiseDeferred*);
+static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2(ExecState* state)
+{
+    return JSValue::encode(callPromiseFunction(*state, jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise));
+}
+
+static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise(ExecState* state, JSPromiseDeferred* promiseDeferred)
+{
+    JSValue thisValue = state->thisValue();
+    auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+    if (UNLIKELY(!castedThis))
+        return throwThisTypeError(*state, "TestObj", "testPromiseOverloadedFunction");
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+    auto& impl = castedThis->wrapped();
+    if (UNLIKELY(state->argumentCount() < 1))
+        return throwVMError(state, createNotEnoughArgumentsError(state));
+    FetchRequest* request = JSFetchRequest::toWrapped(state->argument(0));
+    if (UNLIKELY(state->hadException()))
+        return JSValue::encode(jsUndefined());
+    impl.testPromiseOverloadedFunction(request, DeferredWrapper(state, castedThis->globalObject(), promiseDeferred));
+    return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseOverloadedFunction(ExecState* state)
+{
+    size_t argsCount = std::min<size_t>(1, state->argumentCount());
+    if (argsCount == 1)
+        return jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1(state);
+    JSValue arg0(state->argument(0));
+    if ((argsCount == 1 && ((arg0.isObject() && asObject(arg0)->inherits(JSFetchRequest::info())))))
+        return jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2(state);
+    if (argsCount < 1)
+        return throwVMError(state, createNotEnoughArgumentsError(state));
+    return throwVMTypeError(state);
+}
+
 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNeedsLifecycleProcessingStack(ExecState* state)
 {
 #if ENABLE(CUSTOM_ELEMENTS)
index 27dafd13fb3aeb15c58dcdf3b1975b01b6d602bd..a61261d5c9903a729f688c66a89926be8b6b72b3 100644 (file)
@@ -328,6 +328,8 @@ enum _optional { "", "OptionalValue1", "OptionalValue2", "OptionalValue3" };
     Promise testPromiseFunctionWithFloatArgument(float a);
     [RaisesException] Promise testPromiseFunctionWithException();
     Promise testPromiseFunctionWithOptionalIntArgument(optional long a);
+    Promise testPromiseOverloadedFunction(float a);
+    Promise testPromiseOverloadedFunction(FetchRequest request);
 
     // PutForwards
     [PutForwards=name] readonly attribute TestNode putForwardsAttribute;