aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2016-02-01 09:19:46 +0100
committerMs2ger <ms2ger@gmail.com>2016-02-01 17:25:22 +0100
commit73bc5cf1b80992a2920c169dcdd66f06e2386adf (patch)
tree0820b05524e7d34197110c5365dafd8cec818c81
parent6b1a08c051f3be4b7bc7e6200053dfa530ecd106 (diff)
downloadservo-73bc5cf1b80992a2920c169dcdd66f06e2386adf.tar.gz
servo-73bc5cf1b80992a2920c169dcdd66f06e2386adf.zip
Update web-platform-tests to revision 7f2f85a88f434798e9d643427b34b05fab8278c6
-rw-r--r--tests/wpt/metadata/MANIFEST.json442
-rw-r--r--tests/wpt/metadata/html/semantics/embedded-content/the-area-element/area-coords.html.ini98
-rw-r--r--tests/wpt/metadata/html/semantics/embedded-content/the-area-element/area-processing.html.ini44
-rw-r--r--tests/wpt/metadata/html/semantics/embedded-content/the-area-element/area-shape.html.ini47
-rw-r--r--tests/wpt/metadata/html/semantics/embedded-content/the-embed-element/embed-document.html.ini5
-rw-r--r--tests/wpt/metadata/mozilla-sync2
-rw-r--r--tests/wpt/metadata/url/url-constructor.html.ini6
-rw-r--r--tests/wpt/web-platform-tests/XMLHttpRequest/formdata-blob.htm2
-rw-r--r--tests/wpt/web-platform-tests/battery-status/OWNERS3
-rw-r--r--tests/wpt/web-platform-tests/cssom-view/scrollingElement.html97
-rw-r--r--tests/wpt/web-platform-tests/dom/nodes/DOMImplementation-createDocument.html10
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/accept-header-worker.html16
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/accept-header.html15
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/accept-header.js14
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/integrity-worker.html16
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/integrity.html15
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/integrity.js45
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/mode-no-cors-worker.html17
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/mode-no-cors.html16
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/mode-no-cors.js31
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/mode-same-origin-worker.html17
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/mode-same-origin.html16
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/mode-same-origin.js24
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/request-forbidden-headers-worker.html17
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/request-forbidden-headers.html16
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/request-forbidden-headers.js48
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/request-headers-worker.html16
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/request-headers.html15
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/request-headers.js35
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/scheme-about-worker.html17
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/scheme-about.html16
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/scheme-about.js40
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/scheme-blob-worker.html17
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/scheme-blob.html16
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/scheme-blob.js41
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/scheme-data-worker.html17
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/scheme-data.html16
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/scheme-data.js39
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/scheme-others-worker.html17
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/scheme-others.html16
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/scheme-others.js33
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/stream-response-worker.html17
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/stream-response.html16
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/stream-response.js37
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-basic-worker.html19
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-basic.html18
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-basic.js45
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-cookies-worker.html18
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-cookies.html17
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-cookies.js58
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-filtering-worker.html18
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-filtering.html17
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-filtering.js66
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-multiple-origins-worker.html19
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-multiple-origins.html18
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-multiple-origins.js32
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-no-preflight-worker.html20
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-no-preflight.html20
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-no-preflight.js50
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-origin-worker.html19
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-origin.html19
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-origin.js61
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-redirect-worker.html18
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-redirect.html18
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-redirect.js40
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-referrer-worker.html18
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-referrer.html18
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-referrer.js39
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-status-worker.html18
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-status.html17
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-status.js41
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-worker.html20
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight.html20
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight.js82
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect-credentials-worker.html16
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect-credentials.html15
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect-credentials.js47
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect-worker.html17
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect.html17
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect.js44
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/credentials/authentication-basic-worker.html16
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/credentials/authentication-basic.html15
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/credentials/authentication-basic.js21
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/credentials/cookies-worker.html18
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/credentials/cookies.html17
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/credentials/cookies.js51
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/headers/headers-basic.html111
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/headers/headers-casing.html64
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/headers/headers-combine.html60
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/headers/headers-errors.html66
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/headers/headers-idl.html36
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/headers/headers-normalize.html47
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/headers/headers-structure.html31
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/policies/csp-blocked-worker.html16
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/policies/csp-blocked.html15
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/policies/csp-blocked.html.headers1
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/policies/csp-blocked.js13
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/policies/csp-blocked.js.headers1
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/policies/referrer-no-referrer-worker.html17
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/policies/referrer-no-referrer.html15
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/policies/referrer-no-referrer.html.headers1
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/policies/referrer-no-referrer.js19
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/policies/referrer-no-referrer.js.headers1
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/policies/referrer-origin-worker.html17
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/policies/referrer-origin.html16
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/policies/referrer-origin.html.headers1
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/policies/referrer-origin.js22
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/policies/referrer-origin.js.headers1
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/policies/referrer-unsafe-url-worker.html17
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/policies/referrer-unsafe-url.html16
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/policies/referrer-unsafe-url.html.headers1
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/policies/referrer-unsafe-url.js17
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/policies/referrer-unsafe-url.js.headers1
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/redirect/redirect-count-worker.html16
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/redirect/redirect-count.html16
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/redirect/redirect-count.js42
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/redirect/redirect-location-worker.html16
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/redirect/redirect-location.html15
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/redirect/redirect-location.js50
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/redirect/redirect-method-worker.html16
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/redirect/redirect-method.html15
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/redirect/redirect-method.js46
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/redirect/redirect-mode-worker.html17
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/redirect/redirect-mode.html16
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/redirect/redirect-mode.js40
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/request/request-clone.sub.html48
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/request/request-consume.html89
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/request/request-disturbed.html55
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/request/request-error.html104
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/request/request-idl.html85
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/request/request-init-001.sub.html92
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/request/request-init-002.html62
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/request/request-init-003.sub.html84
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/request/request-structure.html132
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/resources/authentication.py15
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/resources/clean-stash.py6
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/resources/inspect-headers.py22
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/resources/method.py11
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/resources/preflight.py56
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/resources/redirect.py48
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/resources/top.txt1
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/resources/trickle.py12
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/resources/utils.js68
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/response/response-clone.html66
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/response/response-consume.html81
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/response/response-error.html39
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/response/response-idl.html69
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/response/response-init-001.html63
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/response/response-init-002.html62
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/response/response-static-error.html25
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/response/response-static-redirect.html45
-rw-r--r--tests/wpt/web-platform-tests/html/OWNERS7
-rw-r--r--tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/area-coords.html47
-rw-r--r--tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/area-processing.html32
-rw-r--r--tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/area-shape.html33
-rw-r--r--tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/area_nohref.xhtml18
-rw-r--r--tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/support/hit-test.js42
-rw-r--r--tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/test-area.xhtml9
-rw-r--r--tests/wpt/web-platform-tests/html/semantics/embedded-content/the-embed-element/embed-document.html15
-rw-r--r--tests/wpt/web-platform-tests/html/semantics/embedded-content/the-embed-element/embed-iframe.html7
-rw-r--r--tests/wpt/web-platform-tests/html/semantics/forms/the-input-element/checkbox.html36
-rw-r--r--tests/wpt/web-platform-tests/navigation-timing/test_navigation_type_reload.html6
-rw-r--r--tests/wpt/web-platform-tests/notifications/interfaces.html2
-rw-r--r--tests/wpt/web-platform-tests/old-tests/submission/Microsoft/sandbox/iframe_sandbox_002.htm12
-rw-r--r--tests/wpt/web-platform-tests/old-tests/submission/Microsoft/sandbox/sandbox_002.htm25
-rw-r--r--tests/wpt/web-platform-tests/selectors/attribute-selectors/attribute-case/syntax.html2
-rw-r--r--tests/wpt/web-platform-tests/shadow-dom/styles/shadow-cascade-order.html404
-rw-r--r--tests/wpt/web-platform-tests/svg/interfaces.html7
-rw-r--r--tests/wpt/web-platform-tests/url/urltestdata.json8
-rw-r--r--tests/wpt/web-platform-tests/user-timing/test_user_timing_mark.html2
-rw-r--r--tests/wpt/web-platform-tests/user-timing/test_user_timing_measure.html4
-rw-r--r--tests/wpt/web-platform-tests/user-timing/test_user_timing_measure_navigation_timing.html4
-rw-r--r--tests/wpt/web-platform-tests/web-animations/animatable/animate.html126
-rw-r--r--tests/wpt/web-platform-tests/web-animations/testcommon.js2
-rw-r--r--tests/wpt/web-platform-tests/webgl/OWNERS1
-rw-r--r--tests/wpt/web-platform-tests/webvtt/OWNERS4
-rw-r--r--tests/wpt/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/001.html26
-rw-r--r--tests/wpt/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/001.worker.js7
-rw-r--r--tests/wpt/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/002.html32
-rw-r--r--tests/wpt/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/002.worker.js11
180 files changed, 5807 insertions, 169 deletions
diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json
index 90ef7985c25..9dda2cb2e02 100644
--- a/tests/wpt/metadata/MANIFEST.json
+++ b/tests/wpt/metadata/MANIFEST.json
@@ -13584,6 +13584,10 @@
"url": "/cssom-view/elementsFromPoint.html"
},
{
+ "path": "cssom-view/scrollingElement.html",
+ "url": "/cssom-view/scrollingElement.html"
+ },
+ {
"path": "custom-elements/concepts/custom-elements-type-naming.html",
"url": "/custom-elements/concepts/custom-elements-type-naming.html"
},
@@ -15120,6 +15124,366 @@
"url": "/ext-xhtml-pubid/the-xhtml-syntax/parsing-xhtml-documents/xhtml-pubid-1.html"
},
{
+ "path": "fetch/api/basic/accept-header-worker.html",
+ "url": "/fetch/api/basic/accept-header-worker.html"
+ },
+ {
+ "path": "fetch/api/basic/accept-header.html",
+ "url": "/fetch/api/basic/accept-header.html"
+ },
+ {
+ "path": "fetch/api/basic/integrity-worker.html",
+ "url": "/fetch/api/basic/integrity-worker.html"
+ },
+ {
+ "path": "fetch/api/basic/integrity.html",
+ "url": "/fetch/api/basic/integrity.html"
+ },
+ {
+ "path": "fetch/api/basic/mode-no-cors-worker.html",
+ "url": "/fetch/api/basic/mode-no-cors-worker.html"
+ },
+ {
+ "path": "fetch/api/basic/mode-no-cors.html",
+ "url": "/fetch/api/basic/mode-no-cors.html"
+ },
+ {
+ "path": "fetch/api/basic/mode-same-origin-worker.html",
+ "url": "/fetch/api/basic/mode-same-origin-worker.html"
+ },
+ {
+ "path": "fetch/api/basic/mode-same-origin.html",
+ "url": "/fetch/api/basic/mode-same-origin.html"
+ },
+ {
+ "path": "fetch/api/basic/request-forbidden-headers-worker.html",
+ "url": "/fetch/api/basic/request-forbidden-headers-worker.html"
+ },
+ {
+ "path": "fetch/api/basic/request-forbidden-headers.html",
+ "url": "/fetch/api/basic/request-forbidden-headers.html"
+ },
+ {
+ "path": "fetch/api/basic/request-headers-worker.html",
+ "url": "/fetch/api/basic/request-headers-worker.html"
+ },
+ {
+ "path": "fetch/api/basic/request-headers.html",
+ "url": "/fetch/api/basic/request-headers.html"
+ },
+ {
+ "path": "fetch/api/basic/scheme-about-worker.html",
+ "url": "/fetch/api/basic/scheme-about-worker.html"
+ },
+ {
+ "path": "fetch/api/basic/scheme-about.html",
+ "url": "/fetch/api/basic/scheme-about.html"
+ },
+ {
+ "path": "fetch/api/basic/scheme-blob-worker.html",
+ "url": "/fetch/api/basic/scheme-blob-worker.html"
+ },
+ {
+ "path": "fetch/api/basic/scheme-blob.html",
+ "url": "/fetch/api/basic/scheme-blob.html"
+ },
+ {
+ "path": "fetch/api/basic/scheme-data-worker.html",
+ "url": "/fetch/api/basic/scheme-data-worker.html"
+ },
+ {
+ "path": "fetch/api/basic/scheme-data.html",
+ "url": "/fetch/api/basic/scheme-data.html"
+ },
+ {
+ "path": "fetch/api/basic/scheme-others-worker.html",
+ "url": "/fetch/api/basic/scheme-others-worker.html"
+ },
+ {
+ "path": "fetch/api/basic/scheme-others.html",
+ "url": "/fetch/api/basic/scheme-others.html"
+ },
+ {
+ "path": "fetch/api/basic/stream-response-worker.html",
+ "url": "/fetch/api/basic/stream-response-worker.html"
+ },
+ {
+ "path": "fetch/api/basic/stream-response.html",
+ "url": "/fetch/api/basic/stream-response.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-basic-worker.html",
+ "url": "/fetch/api/cors/cors-basic-worker.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-basic.html",
+ "url": "/fetch/api/cors/cors-basic.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-cookies-worker.html",
+ "url": "/fetch/api/cors/cors-cookies-worker.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-cookies.html",
+ "url": "/fetch/api/cors/cors-cookies.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-filtering-worker.html",
+ "url": "/fetch/api/cors/cors-filtering-worker.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-filtering.html",
+ "url": "/fetch/api/cors/cors-filtering.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-multiple-origins-worker.html",
+ "url": "/fetch/api/cors/cors-multiple-origins-worker.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-multiple-origins.html",
+ "url": "/fetch/api/cors/cors-multiple-origins.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-no-preflight-worker.html",
+ "url": "/fetch/api/cors/cors-no-preflight-worker.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-no-preflight.html",
+ "url": "/fetch/api/cors/cors-no-preflight.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-origin-worker.html",
+ "url": "/fetch/api/cors/cors-origin-worker.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-origin.html",
+ "url": "/fetch/api/cors/cors-origin.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-preflight-redirect-worker.html",
+ "url": "/fetch/api/cors/cors-preflight-redirect-worker.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-preflight-redirect.html",
+ "url": "/fetch/api/cors/cors-preflight-redirect.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-preflight-referrer-worker.html",
+ "url": "/fetch/api/cors/cors-preflight-referrer-worker.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-preflight-referrer.html",
+ "url": "/fetch/api/cors/cors-preflight-referrer.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-preflight-status-worker.html",
+ "url": "/fetch/api/cors/cors-preflight-status-worker.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-preflight-status.html",
+ "url": "/fetch/api/cors/cors-preflight-status.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-preflight-worker.html",
+ "url": "/fetch/api/cors/cors-preflight-worker.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-preflight.html",
+ "url": "/fetch/api/cors/cors-preflight.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-redirect-credentials-worker.html",
+ "url": "/fetch/api/cors/cors-redirect-credentials-worker.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-redirect-credentials.html",
+ "url": "/fetch/api/cors/cors-redirect-credentials.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-redirect-worker.html",
+ "url": "/fetch/api/cors/cors-redirect-worker.html"
+ },
+ {
+ "path": "fetch/api/cors/cors-redirect.html",
+ "url": "/fetch/api/cors/cors-redirect.html"
+ },
+ {
+ "path": "fetch/api/credentials/authentication-basic-worker.html",
+ "url": "/fetch/api/credentials/authentication-basic-worker.html"
+ },
+ {
+ "path": "fetch/api/credentials/authentication-basic.html",
+ "url": "/fetch/api/credentials/authentication-basic.html"
+ },
+ {
+ "path": "fetch/api/credentials/cookies-worker.html",
+ "url": "/fetch/api/credentials/cookies-worker.html"
+ },
+ {
+ "path": "fetch/api/credentials/cookies.html",
+ "url": "/fetch/api/credentials/cookies.html"
+ },
+ {
+ "path": "fetch/api/headers/headers-basic.html",
+ "url": "/fetch/api/headers/headers-basic.html"
+ },
+ {
+ "path": "fetch/api/headers/headers-casing.html",
+ "url": "/fetch/api/headers/headers-casing.html"
+ },
+ {
+ "path": "fetch/api/headers/headers-combine.html",
+ "url": "/fetch/api/headers/headers-combine.html"
+ },
+ {
+ "path": "fetch/api/headers/headers-errors.html",
+ "url": "/fetch/api/headers/headers-errors.html"
+ },
+ {
+ "path": "fetch/api/headers/headers-idl.html",
+ "url": "/fetch/api/headers/headers-idl.html"
+ },
+ {
+ "path": "fetch/api/headers/headers-normalize.html",
+ "url": "/fetch/api/headers/headers-normalize.html"
+ },
+ {
+ "path": "fetch/api/headers/headers-structure.html",
+ "url": "/fetch/api/headers/headers-structure.html"
+ },
+ {
+ "path": "fetch/api/policies/csp-blocked-worker.html",
+ "url": "/fetch/api/policies/csp-blocked-worker.html"
+ },
+ {
+ "path": "fetch/api/policies/csp-blocked.html",
+ "url": "/fetch/api/policies/csp-blocked.html"
+ },
+ {
+ "path": "fetch/api/policies/referrer-no-referrer-worker.html",
+ "url": "/fetch/api/policies/referrer-no-referrer-worker.html"
+ },
+ {
+ "path": "fetch/api/policies/referrer-no-referrer.html",
+ "url": "/fetch/api/policies/referrer-no-referrer.html"
+ },
+ {
+ "path": "fetch/api/policies/referrer-origin-worker.html",
+ "url": "/fetch/api/policies/referrer-origin-worker.html"
+ },
+ {
+ "path": "fetch/api/policies/referrer-origin.html",
+ "url": "/fetch/api/policies/referrer-origin.html"
+ },
+ {
+ "path": "fetch/api/policies/referrer-unsafe-url-worker.html",
+ "url": "/fetch/api/policies/referrer-unsafe-url-worker.html"
+ },
+ {
+ "path": "fetch/api/policies/referrer-unsafe-url.html",
+ "url": "/fetch/api/policies/referrer-unsafe-url.html"
+ },
+ {
+ "path": "fetch/api/redirect/redirect-count-worker.html",
+ "url": "/fetch/api/redirect/redirect-count-worker.html"
+ },
+ {
+ "path": "fetch/api/redirect/redirect-count.html",
+ "url": "/fetch/api/redirect/redirect-count.html"
+ },
+ {
+ "path": "fetch/api/redirect/redirect-location-worker.html",
+ "url": "/fetch/api/redirect/redirect-location-worker.html"
+ },
+ {
+ "path": "fetch/api/redirect/redirect-location.html",
+ "url": "/fetch/api/redirect/redirect-location.html"
+ },
+ {
+ "path": "fetch/api/redirect/redirect-method-worker.html",
+ "url": "/fetch/api/redirect/redirect-method-worker.html"
+ },
+ {
+ "path": "fetch/api/redirect/redirect-method.html",
+ "url": "/fetch/api/redirect/redirect-method.html"
+ },
+ {
+ "path": "fetch/api/redirect/redirect-mode-worker.html",
+ "url": "/fetch/api/redirect/redirect-mode-worker.html"
+ },
+ {
+ "path": "fetch/api/redirect/redirect-mode.html",
+ "url": "/fetch/api/redirect/redirect-mode.html"
+ },
+ {
+ "path": "fetch/api/request/request-clone.sub.html",
+ "url": "/fetch/api/request/request-clone.sub.html"
+ },
+ {
+ "path": "fetch/api/request/request-consume.html",
+ "url": "/fetch/api/request/request-consume.html"
+ },
+ {
+ "path": "fetch/api/request/request-disturbed.html",
+ "url": "/fetch/api/request/request-disturbed.html"
+ },
+ {
+ "path": "fetch/api/request/request-error.html",
+ "url": "/fetch/api/request/request-error.html"
+ },
+ {
+ "path": "fetch/api/request/request-idl.html",
+ "url": "/fetch/api/request/request-idl.html"
+ },
+ {
+ "path": "fetch/api/request/request-init-001.sub.html",
+ "url": "/fetch/api/request/request-init-001.sub.html"
+ },
+ {
+ "path": "fetch/api/request/request-init-002.html",
+ "url": "/fetch/api/request/request-init-002.html"
+ },
+ {
+ "path": "fetch/api/request/request-init-003.sub.html",
+ "url": "/fetch/api/request/request-init-003.sub.html"
+ },
+ {
+ "path": "fetch/api/request/request-structure.html",
+ "url": "/fetch/api/request/request-structure.html"
+ },
+ {
+ "path": "fetch/api/response/response-clone.html",
+ "url": "/fetch/api/response/response-clone.html"
+ },
+ {
+ "path": "fetch/api/response/response-consume.html",
+ "url": "/fetch/api/response/response-consume.html"
+ },
+ {
+ "path": "fetch/api/response/response-error.html",
+ "url": "/fetch/api/response/response-error.html"
+ },
+ {
+ "path": "fetch/api/response/response-idl.html",
+ "url": "/fetch/api/response/response-idl.html"
+ },
+ {
+ "path": "fetch/api/response/response-init-001.html",
+ "url": "/fetch/api/response/response-init-001.html"
+ },
+ {
+ "path": "fetch/api/response/response-init-002.html",
+ "url": "/fetch/api/response/response-init-002.html"
+ },
+ {
+ "path": "fetch/api/response/response-static-error.html",
+ "url": "/fetch/api/response/response-static-error.html"
+ },
+ {
+ "path": "fetch/api/response/response-static-redirect.html",
+ "url": "/fetch/api/response/response-static-redirect.html"
+ },
+ {
"path": "fetch/nosniff/image.html",
"url": "/fetch/nosniff/image.html"
},
@@ -17616,6 +17980,18 @@
"url": "/html/semantics/embedded-content/media-elements/volume_nonfinite.html"
},
{
+ "path": "html/semantics/embedded-content/the-area-element/area-coords.html",
+ "url": "/html/semantics/embedded-content/the-area-element/area-coords.html"
+ },
+ {
+ "path": "html/semantics/embedded-content/the-area-element/area-processing.html",
+ "url": "/html/semantics/embedded-content/the-area-element/area-processing.html"
+ },
+ {
+ "path": "html/semantics/embedded-content/the-area-element/area-shape.html",
+ "url": "/html/semantics/embedded-content/the-area-element/area-shape.html"
+ },
+ {
"path": "html/semantics/embedded-content/the-area-element/area-stringifier.html",
"url": "/html/semantics/embedded-content/the-area-element/area-stringifier.html"
},
@@ -18056,6 +18432,10 @@
"url": "/html/semantics/embedded-content/the-embed-element/embed-dimension.html"
},
{
+ "path": "html/semantics/embedded-content/the-embed-element/embed-document.html",
+ "url": "/html/semantics/embedded-content/the-embed-element/embed-document.html"
+ },
+ {
"path": "html/semantics/embedded-content/the-iframe-element/iframe_javascript_url_01.htm",
"url": "/html/semantics/embedded-content/the-iframe-element/iframe_javascript_url_01.htm"
},
@@ -19136,6 +19516,10 @@
"url": "/html/webappapis/scripting/events/event-handler-javascript.html"
},
{
+ "path": "html/webappapis/scripting/events/event-handler-onresize.html",
+ "url": "/html/webappapis/scripting/events/event-handler-onresize.html"
+ },
+ {
"path": "html/webappapis/scripting/events/event-handler-spec-example.html",
"url": "/html/webappapis/scripting/events/event-handler-spec-example.html"
},
@@ -20860,10 +21244,6 @@
"url": "/old-tests/submission/Microsoft/sandbox/sandbox_001.htm"
},
{
- "path": "old-tests/submission/Microsoft/sandbox/sandbox_002.htm",
- "url": "/old-tests/submission/Microsoft/sandbox/sandbox_002.htm"
- },
- {
"path": "old-tests/submission/Microsoft/sandbox/sandbox_005.htm",
"url": "/old-tests/submission/Microsoft/sandbox/sandbox_005.htm"
},
@@ -26352,6 +26732,10 @@
"url": "/shadow-dom/ShadowRoot-interface.html"
},
{
+ "path": "shadow-dom/styles/shadow-cascade-order.html",
+ "url": "/shadow-dom/styles/shadow-cascade-order.html"
+ },
+ {
"path": "shadow-dom/untriaged/elements-and-dom-objects/extensions-to-element-interface/attributes/test-001.html",
"url": "/shadow-dom/untriaged/elements-and-dom-objects/extensions-to-element-interface/attributes/test-001.html"
},
@@ -27008,6 +27392,10 @@
"url": "/vibration/silent-ignore.html"
},
{
+ "path": "web-animations/animatable/animate.html",
+ "url": "/web-animations/animatable/animate.html"
+ },
+ {
"path": "web-animations/animation-node/animation-node-after.html",
"url": "/web-animations/animation-node/animation-node-after.html"
},
@@ -30272,6 +30660,10 @@
"url": "/websockets/Create-Secure-verify-url-set-non-default-port.htm"
},
{
+ "path": "websockets/Create-asciiSep-protocol-string.htm",
+ "url": "/websockets/Create-asciiSep-protocol-string.htm"
+ },
+ {
"path": "websockets/Create-invalid-urls.htm",
"url": "/websockets/Create-invalid-urls.htm"
},
@@ -30288,6 +30680,10 @@
"url": "/websockets/Create-protocol-with-space.htm"
},
{
+ "path": "websockets/Create-protocols-repeated-case-insensitive.htm",
+ "url": "/websockets/Create-protocols-repeated-case-insensitive.htm"
+ },
+ {
"path": "websockets/Create-protocols-repeated.htm",
"url": "/websockets/Create-protocols-repeated.htm"
},
@@ -31572,12 +31968,12 @@
"url": "/workers/interfaces/WorkerUtils/WindowTimers/004.html"
},
{
- "path": "workers/interfaces/WorkerUtils/importScripts/001.html",
- "url": "/workers/interfaces/WorkerUtils/importScripts/001.html"
+ "path": "workers/interfaces/WorkerUtils/importScripts/001.worker.js",
+ "url": "/workers/interfaces/WorkerUtils/importScripts/001.worker"
},
{
- "path": "workers/interfaces/WorkerUtils/importScripts/002.html",
- "url": "/workers/interfaces/WorkerUtils/importScripts/002.html"
+ "path": "workers/interfaces/WorkerUtils/importScripts/002.worker.js",
+ "url": "/workers/interfaces/WorkerUtils/importScripts/002.worker"
},
{
"path": "workers/interfaces/WorkerUtils/importScripts/003.html",
@@ -33002,6 +33398,11 @@
"url": "/media-source/mediasource-redundant-seek.html"
},
{
+ "path": "old-tests/submission/Microsoft/sandbox/sandbox_002.htm",
+ "timeout": "long",
+ "url": "/old-tests/submission/Microsoft/sandbox/sandbox_002.htm"
+ },
+ {
"path": "quirks-mode/hashless-hex-color.html",
"timeout": "long",
"url": "/quirks-mode/hashless-hex-color.html"
@@ -33316,28 +33717,7 @@
},
"local_changes": {
"deleted": [],
- "items": {
- "testharness": {
- "html/webappapis/scripting/events/event-handler-onresize.html": [
- {
- "path": "html/webappapis/scripting/events/event-handler-onresize.html",
- "url": "/html/webappapis/scripting/events/event-handler-onresize.html"
- }
- ],
- "websockets/Create-asciiSep-protocol-string.htm": [
- {
- "path": "websockets/Create-asciiSep-protocol-string.htm",
- "url": "/websockets/Create-asciiSep-protocol-string.htm"
- }
- ],
- "websockets/Create-protocols-repeated-case-insensitive.htm": [
- {
- "path": "websockets/Create-protocols-repeated-case-insensitive.htm",
- "url": "/websockets/Create-protocols-repeated-case-insensitive.htm"
- }
- ]
- }
- },
+ "items": {},
"reftest_nodes": {}
},
"reftest_nodes": {
@@ -39450,7 +39830,7 @@
}
]
},
- "rev": "0d9238c8062f05a55898a0cb60dc0c353794d87a",
+ "rev": "7f2f85a88f434798e9d643427b34b05fab8278c6",
"url_base": "/",
"version": 2
}
diff --git a/tests/wpt/metadata/html/semantics/embedded-content/the-area-element/area-coords.html.ini b/tests/wpt/metadata/html/semantics/embedded-content/the-area-element/area-coords.html.ini
new file mode 100644
index 00000000000..dc77c8a8c2c
--- /dev/null
+++ b/tests/wpt/metadata/html/semantics/embedded-content/the-area-element/area-coords.html.ini
@@ -0,0 +1,98 @@
+[area-coords.html]
+ type: testharness
+ [COMMA: "2,2,10,10" (rect)]
+ expected: FAIL
+
+ [SEMICOLON: "2;2;10;10" (rect)]
+ expected: FAIL
+
+ [SPACE: "2 2 10 10" (rect)]
+ expected: FAIL
+
+ [TAB: "2\\t2\\t10\\t10" (rect)]
+ expected: FAIL
+
+ [FORM FEED: "2\\f2\\f10\\f10" (rect)]
+ expected: FAIL
+
+ [LINE FEED: "2\\n2\\n10\\n10" (rect)]
+ expected: FAIL
+
+ [CARRIGAGE RETURN: "2\\r2\\r10\\r10" (rect)]
+ expected: FAIL
+
+ [LINE TABULATION: "2\\v2\\v10\\v10" (rect)]
+ expected: FAIL
+
+ [LINE NEXT: "2…2…10…10" (rect)]
+ expected: FAIL
+
+ [EN QUAD: "2 2 10 10" (rect)]
+ expected: FAIL
+
+ [abc between numbers: "2a2b20c20,2,10,10" (rect)]
+ expected: FAIL
+
+ [COLON between numbers: "2:2:20:20,2,10,10" (rect)]
+ expected: FAIL
+
+ [U+0000 between numbers: "2\\02\\020\\020,2,10,10" (rect)]
+ expected: FAIL
+
+ [leading COMMA: ",2,2,10,10" (rect)]
+ expected: FAIL
+
+ [leading SPACE: " 2,2,10,10" (rect)]
+ expected: FAIL
+
+ [leading SEMICOLON: ";2,2,10,10" (rect)]
+ expected: FAIL
+
+ [trailing COMMA: "2,2,10," (rect)]
+ expected: FAIL
+
+ [trailing SPACE: "2,2,10 " (rect)]
+ expected: FAIL
+
+ [trailing SEMICOLON: "2,2,10;" (rect)]
+ expected: FAIL
+
+ [PERCENT: "2%,2%,10%,10%" (rect)]
+ expected: FAIL
+
+ [CSS units: "2in,2in,10cm,10cm" (rect)]
+ expected: FAIL
+
+ [float: "1.4,1.4,10,10" (rect)]
+ expected: FAIL
+
+ [number starting with PERIOD: ".4,.4,10,10" (rect)]
+ expected: FAIL
+
+ [sci-not: "2,2,1e1,1e1" (rect)]
+ expected: FAIL
+
+ [leading/trailing garbage: "='2,2,10,10' " (rect)]
+ expected: FAIL
+
+ [non-ascii garbage: "“2,2,10,10\\"" (rect)]
+ expected: FAIL
+
+ [URL garbage with number: "2,2,10ls/spain/holidays/regions/10/Canary+Islands/Canary+Islands.html" (rect)]
+ expected: FAIL
+
+ [consecutive COMMAs: "2,,10,10" (rect)]
+ expected: FAIL
+
+ [consecutive SPACEs: "2 10,10" (rect)]
+ expected: FAIL
+
+ [consecutive SEMICOLONs: "2;;10,10" (rect)]
+ expected: FAIL
+
+ [several consecutive separators: ",,2;,;2,;,10 \\t\\r\\n10;;" (rect)]
+ expected: FAIL
+
+ [one too many numbers, trailing COMMA: "100,100,120,100,100,120,300," (poly)]
+ expected: FAIL
+
diff --git a/tests/wpt/metadata/html/semantics/embedded-content/the-area-element/area-processing.html.ini b/tests/wpt/metadata/html/semantics/embedded-content/the-area-element/area-processing.html.ini
new file mode 100644
index 00000000000..f7fcf0738f8
--- /dev/null
+++ b/tests/wpt/metadata/html/semantics/embedded-content/the-area-element/area-processing.html.ini
@@ -0,0 +1,44 @@
+[area-processing.html]
+ type: testharness
+ [too few numbers: "2,2,10" (rect)]
+ expected: FAIL
+
+ [negative: "-10,-10,10,10" (rect)]
+ expected: FAIL
+
+ [empty string: "" (rect)]
+ expected: FAIL
+
+ [omitted coords: null (rect)]
+ expected: FAIL
+
+ [first > third: "10,2,2,10" (rect)]
+ expected: FAIL
+
+ [second > fourth: "2,10,10,2" (rect)]
+ expected: FAIL
+
+ [first > third, second > fourth: "10,10,2,2" (rect)]
+ expected: FAIL
+
+ [negative: "-10,-10,-10,-10" (default)]
+ expected: FAIL
+
+ [too few numbers: "20,40" (circle)]
+ expected: FAIL
+
+ [negative radius: "20,40,-10" (circle)]
+ expected: FAIL
+
+ [zero radius: "20,40,0" (circle)]
+ expected: FAIL
+
+ [too few numbers: "100,100,120,100,100" (poly)]
+ expected: FAIL
+
+ [one too many numbers: "100,100,120,100,100,120,300" (poly)]
+ expected: FAIL
+
+ [even-odd rule: "100,100,200,100,100,200,150,50,200,200" (poly)]
+ expected: FAIL
+
diff --git a/tests/wpt/metadata/html/semantics/embedded-content/the-area-element/area-shape.html.ini b/tests/wpt/metadata/html/semantics/embedded-content/the-area-element/area-shape.html.ini
new file mode 100644
index 00000000000..2fb3bc244c7
--- /dev/null
+++ b/tests/wpt/metadata/html/semantics/embedded-content/the-area-element/area-shape.html.ini
@@ -0,0 +1,47 @@
+[area-shape.html]
+ type: testharness
+ [missing value default: "2,2,10,10" (null)]
+ expected: FAIL
+
+ [missing value default: "20,40,10" (null)]
+ expected: FAIL
+
+ [missing value default: null (null)]
+ expected: FAIL
+
+ [invalid value default: "2,2,10,10" (foobar invalid)]
+ expected: FAIL
+
+ [invalid value default: "2,2,10,10" ()]
+ expected: FAIL
+
+ [empty string: "" (default)]
+ expected: FAIL
+
+ [omitted coords: null (DEFAULT)]
+ expected: FAIL
+
+ [simple: "20,40,10" (circle)]
+ expected: FAIL
+
+ [simple: "20,40,10" (circ)]
+ expected: FAIL
+
+ [simple: "20,40,10" (CIRCLE)]
+ expected: FAIL
+
+ [simple: "20,40,10" (CIRC)]
+ expected: FAIL
+
+ [LATIN CAPITAL LETTER I WITH DOT ABOVE: "20,40,10" (CİRCLE)]
+ expected: FAIL
+
+ [LATIN SMALL LETTER DOTLESS I: "20,40,10" (cırcle)]
+ expected: FAIL
+
+ [simple: "100,100,120,100,100,120" (poly)]
+ expected: FAIL
+
+ [simple: "100,100,120,100,100,120" (polygon)]
+ expected: FAIL
+
diff --git a/tests/wpt/metadata/html/semantics/embedded-content/the-embed-element/embed-document.html.ini b/tests/wpt/metadata/html/semantics/embedded-content/the-embed-element/embed-document.html.ini
new file mode 100644
index 00000000000..4e5ed387dd3
--- /dev/null
+++ b/tests/wpt/metadata/html/semantics/embedded-content/the-embed-element/embed-document.html.ini
@@ -0,0 +1,5 @@
+[embed-document.html]
+ type: testharness
+ [Test document type embedding]
+ expected: FAIL
+
diff --git a/tests/wpt/metadata/mozilla-sync b/tests/wpt/metadata/mozilla-sync
index 7037532a549..920426dca89 100644
--- a/tests/wpt/metadata/mozilla-sync
+++ b/tests/wpt/metadata/mozilla-sync
@@ -1 +1 @@
-8a1d0a8f3e4206c98f35a4bba98fc26237c1f906 \ No newline at end of file
+6b1a08c051f3be4b7bc7e6200053dfa530ecd106 \ No newline at end of file
diff --git a/tests/wpt/metadata/url/url-constructor.html.ini b/tests/wpt/metadata/url/url-constructor.html.ini
index 628625cc185..45e0ee25d43 100644
--- a/tests/wpt/metadata/url/url-constructor.html.ini
+++ b/tests/wpt/metadata/url/url-constructor.html.ini
@@ -198,3 +198,9 @@
[Parsing: <file:a> against <http://www.example.com/test>]
expected: FAIL
+ [Parsing: <http://example.com/foo/%2e%2> against <about:blank>]
+ expected: FAIL
+
+ [Parsing: <http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar> against <about:blank>]
+ expected: FAIL
+
diff --git a/tests/wpt/web-platform-tests/XMLHttpRequest/formdata-blob.htm b/tests/wpt/web-platform-tests/XMLHttpRequest/formdata-blob.htm
index 5efef7b615b..4e9fbb29204 100644
--- a/tests/wpt/web-platform-tests/XMLHttpRequest/formdata-blob.htm
+++ b/tests/wpt/web-platform-tests/XMLHttpRequest/formdata-blob.htm
@@ -33,7 +33,7 @@
return fd;
}
- do_test("formdata with blob", create_formdata(['key', new Blob(['value'], {type: 'text/x-value'})]), '\nkey=blob:text/x-value:5,');
+ do_test("formdata with blob", create_formdata(['key', new Blob(['value'], {type: 'text/x-value'})]), 'key=value,\n');
do_test("formdata with named blob", create_formdata(['key', new Blob(['value'], {type: 'text/x-value'}), 'blob.txt']), '\nkey=blob.txt:text/x-value:5,');
// If 3rd argument is given and 2nd is not a Blob, formdata.append() should throw
var test = async_test('formdata.append() should throw if value is string and file name is given'); // needs to be async just because the others above are
diff --git a/tests/wpt/web-platform-tests/battery-status/OWNERS b/tests/wpt/web-platform-tests/battery-status/OWNERS
new file mode 100644
index 00000000000..eb86aa06933
--- /dev/null
+++ b/tests/wpt/web-platform-tests/battery-status/OWNERS
@@ -0,0 +1,3 @@
+@anssiko
+@dontcallmedom
+@zqzhang
diff --git a/tests/wpt/web-platform-tests/cssom-view/scrollingElement.html b/tests/wpt/web-platform-tests/cssom-view/scrollingElement.html
new file mode 100644
index 00000000000..57ca450220d
--- /dev/null
+++ b/tests/wpt/web-platform-tests/cssom-view/scrollingElement.html
@@ -0,0 +1,97 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>cssom-view - scrollingElement</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<iframe id="quirksframe"></iframe>
+<iframe id="nonquirksframe"></iframe>
+<div id="log"></div>
+<script>
+
+var quirksFrame;
+var nonQuirksFrame;
+
+function loadTestFrames(callback) {
+ quirksFrame = document.getElementById("quirksframe");
+ quirksFrame.onload = function() {
+ nonQuirksFrame = document.getElementById("nonquirksframe");
+ nonQuirksFrame.onload = callback;
+ nonQuirksFrame.src =
+ URL.createObjectURL(new Blob(["<!doctype html>"], { type: "text/html" }));
+ }
+ quirksFrame.src =
+ URL.createObjectURL(new Blob([""], { type: "text/html" }));
+}
+
+var test = async_test("Tests for scrollingElement");
+loadTestFrames(function() {
+ test.step(function() {
+ var quirksDoc = quirksFrame.contentDocument;
+ var nonQuirksDoc = nonQuirksFrame.contentDocument;
+
+ // Initial checks that we have the expected kinds of documents.
+ assert_equals(quirksDoc.compatMode, "BackCompat", "Should be in quirks mode.");
+ assert_equals(nonQuirksDoc.compatMode, "CSS1Compat", "Should be in standards mode.");
+
+ assert_not_equals(quirksDoc.body, null, "Should have a body element");
+ assert_not_equals(nonQuirksDoc.body, null, "Should have a body element");
+
+ // Tests for quirks mode document.
+ assert_equals(quirksDoc.scrollingElement, quirksDoc.body,
+ "scrollingElement in quirks mode should default to body element.");
+
+ quirksDoc.documentElement.style.overflow = "scroll";
+ quirksDoc.body.style.overflow = "scroll";
+ assert_equals(quirksDoc.scrollingElement, null,
+ "scrollingElement in quirks mode should be null if overflow of body and root element isn't visible.");
+ quirksDoc.documentElement.style.overflow = "visible";
+ assert_equals(quirksDoc.scrollingElement, quirksDoc.body);
+ quirksDoc.documentElement.style.overflow = "scroll";
+ quirksDoc.body.style.overflow = "visible";
+ assert_equals(quirksDoc.scrollingElement, quirksDoc.body);
+ quirksDoc.documentElement.style.overflow = "visible";
+ assert_equals(quirksDoc.scrollingElement, quirksDoc.body);
+
+ quirksDoc.body.style.display = "none";
+ assert_equals(quirksDoc.scrollingElement, quirksDoc.body)
+ quirksDoc.body.style.display = "block";
+ assert_equals(quirksDoc.scrollingElement, quirksDoc.body);
+
+ quirksDoc.documentElement.appendChild(quirksDoc.createElement("body"));
+ assert_equals(quirksDoc.scrollingElement, quirksDoc.body);
+ assert_equals(quirksDoc.scrollingElement, quirksDoc.getElementsByTagName("body")[0]);
+ quirksDoc.documentElement.removeChild(quirksDoc.documentElement.lastChild);
+ assert_equals(quirksDoc.scrollingElement, quirksDoc.body);
+
+ quirksDoc.documentElement.removeChild(quirksDoc.body);
+ assert_equals(quirksDoc.scrollingElement, null);
+ quirksDoc.documentElement.appendChild(quirksDoc.createElementNS("foobarNS", "body"));
+ assert_equals(quirksDoc.scrollingElement, null);
+
+ quirksDoc.removeChild(quirksDoc.documentElement);
+ assert_equals(quirksDoc.scrollingElement, null);
+
+ quirksDoc.appendChild(quirksDoc.createElementNS("foobarNS", "html"));
+ quirksDoc.documentElement.appendChild(quirksDoc.createElement("body"));
+ assert_equals(quirksDoc.scrollingElement, null);
+
+ quirksDoc.removeChild(quirksDoc.documentElement);
+ quirksDoc.appendChild(quirksDoc.createElement("body"));
+ assert_equals(quirksDoc.scrollingElement, null);
+
+ // Tests for standards mode document.
+ assert_equals(nonQuirksDoc.scrollingElement, nonQuirksDoc.documentElement,
+ "scrollingElement in standards mode should be the document element.");
+ nonQuirksDoc.documentElement.style.overflow = "scroll";
+ nonQuirksDoc.body.style.overflow = "scroll";
+ assert_equals(nonQuirksDoc.scrollingElement, nonQuirksDoc.documentElement);
+
+ nonQuirksDoc.removeChild(nonQuirksDoc.documentElement);
+ assert_equals(nonQuirksDoc.scrollingElement, null);
+ nonQuirksDoc.appendChild(nonQuirksDoc.createElement("foobar"));
+ assert_equals(nonQuirksDoc.scrollingElement.localName, "foobar");
+
+ });
+ test.done();
+});
+</script>
diff --git a/tests/wpt/web-platform-tests/dom/nodes/DOMImplementation-createDocument.html b/tests/wpt/web-platform-tests/dom/nodes/DOMImplementation-createDocument.html
index a929436561c..31a31c8a2a2 100644
--- a/tests/wpt/web-platform-tests/dom/nodes/DOMImplementation-createDocument.html
+++ b/tests/wpt/web-platform-tests/dom/nodes/DOMImplementation-createDocument.html
@@ -120,4 +120,14 @@ test(function() {
}
})
})
+
+test(function() {
+ assert_throws(new TypeError(), function() {
+ document.implementation.createDocument()
+ }, "createDocument() should throw")
+
+ assert_throws(new TypeError(), function() {
+ document.implementation.createDocument('')
+ }, "createDocument('') should throw")
+}, "createDocument with missing arguments");
</script>
diff --git a/tests/wpt/web-platform-tests/fetch/api/basic/accept-header-worker.html b/tests/wpt/web-platform-tests/fetch/api/basic/accept-header-worker.html
new file mode 100644
index 00000000000..4d5b3220580
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/accept-header-worker.html
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/accept-header.html b/tests/wpt/web-platform-tests/fetch/api/basic/accept-header.html
new file mode 100644
index 00000000000..cd9550fb2cc
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/accept-header.html
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/accept-header.js b/tests/wpt/web-platform-tests/fetch/api/basic/accept-header.js
new file mode 100644
index 00000000000..33226e8562a
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/accept-header.js
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/integrity-worker.html b/tests/wpt/web-platform-tests/fetch/api/basic/integrity-worker.html
new file mode 100644
index 00000000000..9240bc6325a
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/integrity-worker.html
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/integrity.html b/tests/wpt/web-platform-tests/fetch/api/basic/integrity.html
new file mode 100644
index 00000000000..150c9b71d54
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/integrity.html
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/integrity.js b/tests/wpt/web-platform-tests/fetch/api/basic/integrity.js
new file mode 100644
index 00000000000..4e849f564e1
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/integrity.js
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/mode-no-cors-worker.html b/tests/wpt/web-platform-tests/fetch/api/basic/mode-no-cors-worker.html
new file mode 100644
index 00000000000..87376a130f8
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/mode-no-cors-worker.html
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/mode-no-cors.html b/tests/wpt/web-platform-tests/fetch/api/basic/mode-no-cors.html
new file mode 100644
index 00000000000..7aee3790933
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/mode-no-cors.html
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/mode-no-cors.js b/tests/wpt/web-platform-tests/fetch/api/basic/mode-no-cors.js
new file mode 100644
index 00000000000..27483654f74
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/mode-no-cors.js
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/mode-same-origin-worker.html b/tests/wpt/web-platform-tests/fetch/api/basic/mode-same-origin-worker.html
new file mode 100644
index 00000000000..0c62472aaf1
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/mode-same-origin-worker.html
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/mode-same-origin.html b/tests/wpt/web-platform-tests/fetch/api/basic/mode-same-origin.html
new file mode 100644
index 00000000000..d94832a2aa0
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/mode-same-origin.html
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/mode-same-origin.js b/tests/wpt/web-platform-tests/fetch/api/basic/mode-same-origin.js
new file mode 100644
index 00000000000..c00d96fad32
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/mode-same-origin.js
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/request-forbidden-headers-worker.html b/tests/wpt/web-platform-tests/fetch/api/basic/request-forbidden-headers-worker.html
new file mode 100644
index 00000000000..12e87f9e4c6
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/request-forbidden-headers-worker.html
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/request-forbidden-headers.html b/tests/wpt/web-platform-tests/fetch/api/basic/request-forbidden-headers.html
new file mode 100644
index 00000000000..56ce2a65b11
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/request-forbidden-headers.html
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/request-forbidden-headers.js b/tests/wpt/web-platform-tests/fetch/api/basic/request-forbidden-headers.js
new file mode 100644
index 00000000000..72a8392a54f
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/request-forbidden-headers.js
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/request-headers-worker.html b/tests/wpt/web-platform-tests/fetch/api/basic/request-headers-worker.html
new file mode 100644
index 00000000000..85b4c4c7084
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/request-headers-worker.html
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/request-headers.html b/tests/wpt/web-platform-tests/fetch/api/basic/request-headers.html
new file mode 100644
index 00000000000..5236d29b107
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/request-headers.html
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/request-headers.js b/tests/wpt/web-platform-tests/fetch/api/basic/request-headers.js
new file mode 100644
index 00000000000..ec14385b606
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/request-headers.js
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/scheme-about-worker.html b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-about-worker.html
new file mode 100644
index 00000000000..9c9d9a038a9
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-about-worker.html
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/scheme-about.html b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-about.html
new file mode 100644
index 00000000000..8b6df24682f
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-about.html
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/scheme-about.js b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-about.js
new file mode 100644
index 00000000000..5f3e7cfd5c5
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-about.js
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/scheme-blob-worker.html b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-blob-worker.html
new file mode 100644
index 00000000000..961ecbd525b
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-blob-worker.html
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/scheme-blob.html b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-blob.html
new file mode 100644
index 00000000000..7787c3710f6
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-blob.html
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/scheme-blob.js b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-blob.js
new file mode 100644
index 00000000000..d9b804d4e58
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-blob.js
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/scheme-data-worker.html b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-data-worker.html
new file mode 100644
index 00000000000..42fc3f4a9c0
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-data-worker.html
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/scheme-data.html b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-data.html
new file mode 100644
index 00000000000..0b41991c9fc
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-data.html
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/scheme-data.js b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-data.js
new file mode 100644
index 00000000000..775466799cd
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-data.js
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/scheme-others-worker.html b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-others-worker.html
new file mode 100644
index 00000000000..397d9257b1b
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-others-worker.html
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/scheme-others.html b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-others.html
new file mode 100644
index 00000000000..dd37143b0f1
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-others.html
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/scheme-others.js b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-others.js
new file mode 100644
index 00000000000..ce02ec1340a
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/scheme-others.js
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/stream-response-worker.html b/tests/wpt/web-platform-tests/fetch/api/basic/stream-response-worker.html
new file mode 100644
index 00000000000..0be1c0d13f1
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/stream-response-worker.html
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/stream-response.html b/tests/wpt/web-platform-tests/fetch/api/basic/stream-response.html
new file mode 100644
index 00000000000..eb6b1415a1f
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/stream-response.html
@@ -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/tests/wpt/web-platform-tests/fetch/api/basic/stream-response.js b/tests/wpt/web-platform-tests/fetch/api/basic/stream-response.js
new file mode 100644
index 00000000000..ea370bc7cdf
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/stream-response.js
@@ -0,0 +1,37 @@
+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");
+ test.done();
+ return;
+ });
+ }
+ });
+}
+
+//simulate streaming:
+//count is large enough to let the UA deliver the body before it is completely retrieved
+async_test(function(test) {
+ 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");
+ test.done();
+ return;
+ });
+ });
+}, "Stream response's body");
+
+done();
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-basic-worker.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-basic-worker.html
new file mode 100644
index 00000000000..97e173c1522
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-basic-worker.html
@@ -0,0 +1,19 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch in worker: basic CORS</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-cors-protocol">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#concept-filtered-response-cors">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#concept-cors-check">
+ <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("cors-basic.js?pipe=sub"));
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-basic.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-basic.html
new file mode 100644
index 00000000000..4aa38f75b85
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-basic.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch: basic CORS</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-cors-protocol">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#concept-filtered-response-cors">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#concept-cors-check">
+ <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="cors-basic.js?pipe=sub"></script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-basic.js b/tests/wpt/web-platform-tests/fetch/api/cors/cors-basic.js
new file mode 100644
index 00000000000..3fe4644db14
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-basic.js
@@ -0,0 +1,45 @@
+if (this.document === undefined) {
+ importScripts("/resources/testharness.js");
+ importScripts("../resources/utils.js");
+}
+
+function cors(desc, scheme, subdomain, port) {
+ if (!port)
+ port = location.port;
+ if (subdomain)
+ subdomain = subdomain + ".";
+ else
+ subdomain = "";
+
+ var url = scheme + "://" + subdomain + "{{host}}" + ":" + port + dirname(location.pathname);
+ var urlParameters = "?pipe=header(Access-Control-Allow-Origin,*)";
+
+ promise_test(function(test) {
+ return fetch(url + RESOURCES_DIR + "top.txt" + urlParameters, {"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");
+ });
+ }, desc + " [no-cors mode]");
+
+ promise_test(function(test) {
+ var testedPromise = fetch(url + RESOURCES_DIR + "top.txt", {"mode": "cors"} ).then(function(resp) {
+ return promise_rejects(test, new TypeError(), testedPromise);
+ });
+ }, desc + " [server forbid CORS]");
+
+ promise_test(function(test) {
+ return fetch(url + RESOURCES_DIR + "top.txt" + urlParameters, {"mode": "cors"} ).then(function(resp) {
+ assert_equals(resp.status, 200, "Fetch's response's status is 200");
+ assert_equals(resp.type , "cors", "CORS response's type is cors");
+ });
+ }, desc + " [cors mode]");
+}
+
+cors("Cross domain basic usage", "http", "www1");
+cors("Same domain different port", "http", undefined, "{{ports[http][1]}}");
+cors("Cross domain different port", "http", "www1", "{{ports[http][1]}}");
+cors("Cross domain different protocol", "https", "www1", "{{ports[https][0]}}");
+cors("Same domain different protocol different port", "https", undefined, "{{ports[https][0]}}");
+
+done();
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-cookies-worker.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-cookies-worker.html
new file mode 100644
index 00000000000..fd79aad8f05
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-cookies-worker.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch in worker: cookies management for cors requests</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">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-fetch">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script>
+ fetch_tests_from_worker(new Worker("cors-cookies.js?pipe=sub"));
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-cookies.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-cookies.html
new file mode 100644
index 00000000000..8fb6a7c0cd7
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-cookies.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch: cookies management for cors requests</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">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-fetch">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script src="../resources/utils.js"></script>
+ <script src="cors-cookies.js?pipe=sub"></script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-cookies.js b/tests/wpt/web-platform-tests/fetch/api/cors/cors-cookies.js
new file mode 100644
index 00000000000..d79dc84860d
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-cookies.js
@@ -0,0 +1,58 @@
+if (this.document === undefined) {
+ importScripts("/resources/testharness.js");
+ importScripts("../resources/utils.js");
+}
+
+function corsCookies(desc, domain1, domain2, credentialsMode, cookies) {
+ var urlSetCookie = "http://" + domain1 + ":{{ports[http][0]}}" + dirname(location.pathname) + RESOURCES_DIR + "top.txt";
+ var urlCheckCookies = "http://" + domain2 + ":{{ports[http][0]}}" + dirname(location.pathname) + RESOURCES_DIR + "inspect-headers.py?cors&headers=cookie";
+ //enable cors with credentials
+ var urlParameters = "?pipe=header(Access-Control-Allow-Origin," + location.origin + ")";
+ urlParameters += "|header(Access-Control-Allow-Credentials,true)";
+
+ var urlCleanParameters = "?pipe=header(Access-Control-Allow-Origin," + location.origin + ")";
+ urlCleanParameters += "|header(Access-Control-Allow-Credentials,true)";
+ if (cookies) {
+ urlParameters += "|header(Set-Cookie,";
+ urlParameters += cookies.join(",True)|header(Set-Cookie,") + ",True)";
+ urlCleanParameters += "|header(Set-Cookie,";
+ urlCleanParameters += cookies.join("%3B%20max-age=0,True)|header(Set-Cookie,") + "%3B%20max-age=0,True)";
+ }
+
+ var requestInit = {"credentials": credentialsMode, "mode": "cors"};
+
+ promise_test(function(test){
+ return fetch(urlSetCookie + urlParameters, requestInit).then(function(resp) {
+ assert_equals(resp.status, 200, "HTTP status is 200");
+ //check cookies sent
+ return fetch(urlCheckCookies, requestInit);
+ }).then(function(resp) {
+ assert_equals(resp.status, 200, "HTTP status is 200");
+ assert_false(resp.headers.has("Cookie") , "Cookie header is not exposed in response");
+ if (credentialsMode === "include" && domain1 === domain2) {
+ assert_equals(resp.headers.get("x-request-cookie") , cookies.join("; "), "Request includes cookie(s)");
+ }
+ else {
+ assert_false(resp.headers.has("x-request-cookie") , "Request should have no cookie");
+ }
+ //clean cookies
+ return fetch(urlSetCookie + urlCleanParameters, {"credentials": "include"});
+ }).catch(function(e) {
+ fetch(urlSetCookie + urlCleanParameters, {"credentials": "include"});
+ throw e;
+ });
+ }, desc);
+}
+
+var local = "{{host}}";
+var remote = "www.{{host}}";
+var remote1 = "www1.{{host}}";
+
+corsCookies("Include mode: 1 cookie", remote, remote, "include", ["a=1"]);
+corsCookies("Include mode: local cookies are not sent with remote request", local, remote, "include", ["c=3"]);
+corsCookies("Include mode: remote cookies are not sent with local request", remote, local, "include", ["d=4"]);
+corsCookies("Include mode: remote cookies are not sent with other remote request", remote, remote1, "include", ["e=5"]);
+corsCookies("Same-origin mode: cookies are discarded in cors request", remote, remote, "same-origin", ["f=6"]);
+corsCookies("Omit mode: no cookie sent", local, local, "omit", ["g=7"]);
+
+done();
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-filtering-worker.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-filtering-worker.html
new file mode 100644
index 00000000000..f15566fc509
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-filtering-worker.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch in worker: filtered headers in CORS response</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-cors-protocol">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#concept-filtered-response-cors">
+ <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("cors-filtering.js?pipe=sub"));
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-filtering.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-filtering.html
new file mode 100644
index 00000000000..b7500ad16d4
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-filtering.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch: filtered headers in CORS response</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-cors-protocol">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#concept-filtered-response-cors">
+ <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="cors-filtering.js?pipe=sub"></script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-filtering.js b/tests/wpt/web-platform-tests/fetch/api/cors/cors-filtering.js
new file mode 100644
index 00000000000..aa21070f394
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-filtering.js
@@ -0,0 +1,66 @@
+if (this.document === undefined) {
+ importScripts("/resources/testharness.js");
+ importScripts("../resources/utils.js");
+}
+
+function corsFilter(corsUrl, headerName, headerValue, isFiltered) {
+ var url = corsUrl + "?pipe=header(" + headerName + "," + encodeURIComponent(headerValue) +")|header(Access-Control-Allow-Origin,*)";
+ promise_test(function(test) {
+ return fetch(url).then(function(resp) {
+ assert_equals(resp.status, 200, "Fetch success with code 200");
+ assert_equals(resp.type , "cors", "CORS fetch's response has cors type");
+ if (!isFiltered) {
+ assert_equals(resp.headers.get(headerName), headerValue,
+ headerName + " header should be included in response with value: " + headerValue);
+ } else {
+ assert_false(resp.headers.has(headerName), "UA should exclude " + headerName + " header from response");
+ }
+ test.done();
+ });
+ }, "CORS filter on " + headerName + " header");
+}
+
+function corsExposeFilter(corsUrl, headerName, headerValue, isForbidden) {
+ var url = corsUrl + "?pipe=header(" + headerName + "," + encodeURIComponent(headerValue) +")|" +
+ "header(Access-Control-Allow-Origin,*)" +
+ "header(Access-Control-Expose-Headers," + headerName + ")";
+
+ promise_test(function(test) {
+ return fetch(url).then(function(resp) {
+ assert_equals(resp.status, 200, "Fetch success with code 200");
+ assert_equals(resp.type , "cors", "CORS fetch's response has cors type");
+ if (!isForbidden) {
+ assert_equals(resp.headers.get(headerName), headerValue,
+ headerName + " header should be included in response with value: " + headerValue);
+ } else {
+ assert_false(resp.headers.has(headerName), "UA should exclude " + headerName + " header from response");
+ }
+ test.done();
+ });
+ }, "CORS filter on " + headerName + " header, header is exposed");
+}
+
+var url = "http://www1.{{host}}:{{ports[http][1]}}" + dirname(location.pathname) + RESOURCES_DIR + "top.txt";
+
+corsFilter(url, "Cache-Control", "no-cache", false);
+corsFilter(url, "Content-Language", "fr", false);
+corsFilter(url, "Content-Type", "text/html", false);
+corsFilter(url, "Expires","04 May 1988 22:22:22 GMT" , false);
+corsFilter(url, "Last-Modified", "04 May 1988 22:22:22 GMT", false);
+corsFilter(url, "Pragma", "no-cache", false);
+
+corsFilter(url, "Age", "27", true);
+corsFilter(url, "Server", "wptServe" , true);
+corsFilter(url, "Warning", "Mind the gap" , true);
+corsFilter(url, "Content-Length", "0" , true);
+corsFilter(url, "Set-Cookie", "name=value" , true);
+corsFilter(url, "Set-Cookie2", "name=value" , true);
+
+corsExposeFilter(url, "Age", "27", false);
+corsExposeFilter(url, "Server", "wptServe" , false);
+corsExposeFilter(url, "Warning", "Mind the gap" , false);
+corsExposeFilter(url, "Content-Length", "0" , false);
+corsExposeFilter(url, "Set-Cookie", "name=value" , true);
+corsExposeFilter(url, "Set-Cookie2", "name=value" , true);
+
+done();
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-multiple-origins-worker.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-multiple-origins-worker.html
new file mode 100644
index 00000000000..a8e50573278
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-multiple-origins-worker.html
@@ -0,0 +1,19 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch in worker: check multiple Access-Control-Allow-Origin 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/#http-cors-protocol">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#cors-check">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script>
+ fetch_tests_from_worker(new Worker("cors-multiple-origins.js?pipe=sub"));
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-multiple-origins.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-multiple-origins.html
new file mode 100644
index 00000000000..9b12b05064b
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-multiple-origins.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch: check multiple Access-Control-Allow-Origin 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/#http-cors-protocol">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#cors-check">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script src="../resources/utils.js"></script>
+ <script src="cors-multiple-origins.js?pipe=sub"></script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-multiple-origins.js b/tests/wpt/web-platform-tests/fetch/api/cors/cors-multiple-origins.js
new file mode 100644
index 00000000000..35c404b7770
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-multiple-origins.js
@@ -0,0 +1,32 @@
+if (this.document === undefined) {
+ importScripts("/resources/testharness.js");
+ importScripts("../resources/utils.js");
+}
+
+function corsMultipleOrigins(desc, originList, shouldPass) {
+ var urlParameters = "?origin=" + encodeURIComponent(originList.join(", "));
+ var url = "http://www1.{{host}}:{{ports[http][0]}}" + dirname(location.pathname) + RESOURCES_DIR + "preflight.py";
+
+ if (shouldPass) {
+ promise_test(function(test) {
+ return fetch(url + urlParameters).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 + urlParameters));
+ }, desc);
+ }
+}
+/* Actual origin */
+var origin = "http://{{host}}:{{ports[http][0]}}";
+
+corsMultipleOrigins("3 origins allowed, match the 3rd (" + origin + ")", ["\"\"", "http://example.com", origin], true);
+corsMultipleOrigins("3 origins allowed, match the 3rd (\"*\")", ["\"\"", "http://example.com", "*"], true);
+corsMultipleOrigins("3 origins allowed, match twice (" + origin + ")", ["\"\"", origin, origin], true);
+corsMultipleOrigins("3 origins allowed, match twice (\"*\")", ["*", "http://example.com", "*"], true);
+corsMultipleOrigins("3 origins allowed, match twice (\"*\" and " + origin + ")", ["*", "http://example.com", origin], true);
+corsMultipleOrigins("3 origins allowed, no match", ["", "http://example.com", "https://example2.com"], false);
+
+done();
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-no-preflight-worker.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-no-preflight-worker.html
new file mode 100644
index 00000000000..c6402ada093
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-no-preflight-worker.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch in worker: CORS request with simple methods and headers</title>
+ <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-cors-protocol">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#simple-method">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#simple-header">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script>
+ fetch_tests_from_worker(new Worker("cors-no-preflight.js?pipe=sub"));
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-no-preflight.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-no-preflight.html
new file mode 100644
index 00000000000..3ff5c97eac6
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-no-preflight.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch: CORS request with simple methods and headers</title>
+ <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-cors-protocol">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#simple-method">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#simple-header">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script src="/common/utils.js"></script>
+ <script src="../resources/utils.js"></script>
+ <script src="cors-no-preflight.js?pipe=sub"></script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-no-preflight.js b/tests/wpt/web-platform-tests/fetch/api/cors/cors-no-preflight.js
new file mode 100644
index 00000000000..8d932cc38bc
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-no-preflight.js
@@ -0,0 +1,50 @@
+if (this.document === undefined) {
+ importScripts("/resources/testharness.js");
+ importScripts("/common/utils.js");
+ importScripts("../resources/utils.js");
+}
+
+function corsNoPreflight(desc, scheme, subdomain, port, method, headerName, headerValue) {
+ if (!port)
+ port = location.port;
+ if (subdomain)
+ subdomain = subdomain + ".";
+ else
+ subdomain = "";
+
+ var uuid_token = token();
+ var url = scheme + "://" + subdomain + "{{host}}" + ":" + port + dirname(location.pathname) + RESOURCES_DIR + "preflight.py";
+ var urlParameters = "?token=" + uuid_token + "&max_age=0";
+ var requestInit = {"mode": "cors", "method": method, "headers":{}};
+ if (headerName)
+ requestInit["headers"][headerName] = headerValue;
+
+ promise_test(function(test) {
+ fetch(RESOURCES_DIR + "clean-stash.py?token=" + uuid_token).then(function(resp) {
+ assert_equals(resp.status, 200, "Clean stash response's status is 200");
+ return fetch(url + urlParameters, requestInit).then(function(resp) {
+ assert_equals(resp.status, 200, "Response's status is 200");
+ assert_equals(resp.headers.get("x-did-preflight"), "0", "No preflight request has been made");
+ });
+ });
+ }, desc);
+}
+var port2 = "{{ports[http][1]}}";
+var httpsPort = "{{ports[https][0]}}";
+
+corsNoPreflight("Cross domain basic usage [GET]", "http", "www1", undefined, "GET");
+corsNoPreflight("Same domain different port [GET]", "http", undefined, port2, "GET");
+corsNoPreflight("Cross domain different port [GET]", "http", "www1", port2, "GET");
+corsNoPreflight("Cross domain different protocol [GET]", "https", "www1", httpsPort, "GET");
+corsNoPreflight("Same domain different protocol different port [GET]", "https", undefined, httpsPort, "GET");
+corsNoPreflight("Cross domain [POST]", "http", "www1", undefined, "POST");
+corsNoPreflight("Cross domain [HEAD]", "http", "www1", undefined, "HEAD");
+corsNoPreflight("Cross domain [GET] [Accept: */*]", "http", "www1", undefined, "GET" , "Accept", "*/*");
+corsNoPreflight("Cross domain [GET] [Accept-Language: fr]", "http", "www1", undefined, "GET" , "Accept-Language", "fr");
+corsNoPreflight("Cross domain [GET] [Content-Language: fr]", "http", "www1", undefined, "GET" , "Content-Language", "fr");
+corsNoPreflight("Cross domain [GET] [Content-Type: application/x-www-form-urlencoded]", "http", "www1", undefined, "GET" , "Content-Type", "application/x-www-form-urlencoded");
+corsNoPreflight("Cross domain [GET] [Content-Type: multipart/form-data]", "http", "www1", undefined, "GET" , "Content-Type", "multipart/form-data");
+corsNoPreflight("Cross domain [GET] [Content-Type: text/plain]", "http", "www1", undefined, "GET" , "Content-Type", "text/plain");
+corsNoPreflight("Cross domain [GET] [Content-Type: text/plain;charset=utf-8]", "http", "www1", undefined, "GET" , "Content-Type", "text/plain;charset=utf-8");
+
+done();
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-origin-worker.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-origin-worker.html
new file mode 100644
index 00000000000..f6145e6e3e1
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-origin-worker.html
@@ -0,0 +1,19 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch in worker: check Access-Control-Allow-Origin 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/#http-cors-protocol">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#cors-check">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script>
+ fetch_tests_from_worker(new Worker("cors-origin.js?pipe=sub"));
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-origin.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-origin.html
new file mode 100644
index 00000000000..de7a0552acc
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-origin.html
@@ -0,0 +1,19 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch: check Access-Control-Allow-Origin 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/#http-cors-protocol">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#cors-check">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script src="/common/utils.js"></script>
+ <script src="../resources/utils.js"></script>
+ <script src="cors-origin.js?pipe=sub"></script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-origin.js b/tests/wpt/web-platform-tests/fetch/api/cors/cors-origin.js
new file mode 100644
index 00000000000..36052742a5f
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-origin.js
@@ -0,0 +1,61 @@
+if (this.document === undefined) {
+ importScripts("/resources/testharness.js");
+ importScripts("../resources/utils.js");
+ importScripts("/common/utils.js");
+}
+
+/* If origin is undefined, it is set to fetched url's origin*/
+function corsOrigin(desc, scheme, subdomain, port, method, origin, shouldPass) {
+ if (!port)
+ port = location.port;
+ if (subdomain)
+ subdomain = subdomain + ".";
+ else
+ subdomain = "";
+ if (!origin)
+ origin = scheme + "://" + subdomain + "{{host}}" + ":" + port;
+
+ var uuid_token = token();
+ var urlParameters = "?token=" + uuid_token + "&max_age=0&origin=" + encodeURIComponent(origin) + "&allow_methods=" + method;
+ var url = scheme + "://" + subdomain + "{{host}}" + ":" + port + dirname(location.pathname) + RESOURCES_DIR + "preflight.py";
+ var requestInit = {"mode": "cors", "method": method};
+
+ promise_test(function(test) {
+ fetch(RESOURCES_DIR + "clean-stash.py?token=" + uuid_token).then(function(resp) {
+ assert_equals(resp.status, 200, "Clean stash response's status is 200");
+ if (shouldPass) {
+ return fetch(url + urlParameters, requestInit).then(function(resp) {
+ assert_equals(resp.status, 200, "Response's status is 200");
+ });
+ } else {
+ return promise_rejects(test, new TypeError(), fetch(url + urlParameters, requestInit));
+ }
+ });
+ }, desc);
+
+}
+var port = "{{ports[http][0]}}";
+var port2 = "{{ports[http][1]}}";
+var httpsPort = "{{ports[https][0]}}";
+/* Actual origin */
+var origin = "http://{{host}}:{{ports[http][0]}}";
+
+corsOrigin("Cross domain different subdomain [origin OK]", "http", "www1", undefined, "GET", origin, true);
+corsOrigin("Cross domain different subdomain [origin KO]", "http", "www1", undefined, "GET", undefined, false);
+corsOrigin("Same domain different port [origin OK]", "http", undefined, port2, "GET", origin, true);
+corsOrigin("Same domain different port [origin KO]", "http", undefined, port2, "GET", undefined, false);
+corsOrigin("Cross domain different port [origin OK]", "http", "www1", port2, "GET", origin, true);
+corsOrigin("Cross domain different port [origin KO]", "http", "www1", port2, "GET", undefined, false);
+corsOrigin("Cross domain different protocol [origin OK]", "https", "www1", httpsPort, "GET", origin, true);
+corsOrigin("Cross domain different protocol [origin KO]", "https", "www1", httpsPort, "GET", undefined, false);
+corsOrigin("Same domain different protocol different port [origin OK]", "https", undefined, httpsPort, "GET", origin, true);
+corsOrigin("Same domain different protocol different port [origin KO]", "https", undefined, httpsPort, "GET", undefined, false);
+corsOrigin("Cross domain [POST] [origin OK]", "http", "www1", undefined, "POST", origin, true);
+corsOrigin("Cross domain [POST] [origin KO]", "http", "www1", undefined, "POST", undefined, false);
+corsOrigin("Cross domain [HEAD] [origin OK]", "http", "www1", undefined, "HEAD", origin, true);
+corsOrigin("Cross domain [HEAD] [origin KO]", "http", "www1", undefined, "HEAD", undefined, false);
+corsOrigin("CORS preflight [PUT] [origin OK]", "http", "www1", undefined, "PUT", origin, true);
+corsOrigin("CORS preflight [PUT] [origin KO]", "http", "www1", undefined, "PUT", undefined, false);
+corsOrigin("Allowed origin: \"\" [origin KO]", "http", "www1", undefined, "GET", "" , false);
+
+done();
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-redirect-worker.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-redirect-worker.html
new file mode 100644
index 00000000000..663f5d655c1
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-redirect-worker.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch in worker: redirection handling for cors with preflight</title>
+ <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-cors-protocol">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-fetch">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script>
+ fetch_tests_from_worker(new Worker("cors-preflight-redirect.js?pipe=sub"));
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-redirect.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-redirect.html
new file mode 100644
index 00000000000..6f136af76be
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-redirect.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch: redirection handling for cors with preflight</title>
+ <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-cors-protocol">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-fetch">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script src="/common/utils.js"></script>
+ <script src="../resources/utils.js"></script>
+ <script src="cors-preflight-redirect.js?pipe=sub"></script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-redirect.js b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-redirect.js
new file mode 100644
index 00000000000..52a7bca3cd7
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-redirect.js
@@ -0,0 +1,40 @@
+if (this.document === undefined) {
+ importScripts("/resources/testharness.js");
+ importScripts("../resources/utils.js");
+ importScripts("/common/utils.js");
+}
+
+function corsPreflightRedirect(desc, redirectUrl, redirectLocation, redirectStatus, redirectPreflight) {
+ var uuid_token = token();
+ var url = redirectUrl;
+ var urlParameters = "?token=" + uuid_token + "&max_age=0";
+ urlParameters += "&redirect_status=" + redirectStatus;
+ urlParameters += "&location=" + encodeURIComponent(redirectLocation);
+
+ if (redirectPreflight)
+ urlParameters += "&redirect_preflight";
+ var requestInit = {"mode": "cors", "redirect": "follow"};
+
+ /* Force preflight */
+ requestInit["headers"] = {"x-force-preflight": ""};
+ urlParameters += "&allow_headers=x-force-preflight";
+
+ promise_test(function(test) {
+ fetch(RESOURCES_DIR + "clean-stash.py?token=" + uuid_token).then(function(resp) {
+ assert_equals(resp.status, 200, "Clean stash response's status is 200");
+ return promise_rejects(test, new TypeError(), fetch(url + urlParameters, requestInit));
+ });
+ }, desc);
+}
+
+var redirectUrl = "http://www1.{{host}}:{{ports[http][0]}}" + dirname(location.pathname) + RESOURCES_DIR + "redirect.py";
+var locationUrl = "http://www1.{{host}}:{{ports[http][0]}}" + dirname(location.pathname) + RESOURCES_DIR + "preflight.py";
+
+for (var code of [301, 302, 303, 307, 308]) {
+ /* preflight should not follow the redirection */
+ corsPreflightRedirect("Redirection " + code + " on preflight failed", redirectUrl, locationUrl, code, true);
+ /* preflight is done before redirection: preflight force redirect to error */
+ corsPreflightRedirect("Redirection " + code + " after preflight failed", redirectUrl, locationUrl, code, false);
+}
+
+done();
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-referrer-worker.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-referrer-worker.html
new file mode 100644
index 00000000000..4ed9072fb51
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-referrer-worker.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch in worker: Referer header management in CORS request with preflight</title>
+ <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#cors-preflight-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+ <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("cors-preflight-referrer.js?pipe=sub"));
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-referrer.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-referrer.html
new file mode 100644
index 00000000000..a399a051cb1
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-referrer.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch: Referer header management in CORS request with preflight</title>
+ <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#cors-preflight-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+ <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="/common/utils.js"></script>
+ <script src="../resources/utils.js"></script>
+ <script src="cors-preflight-referrer.js?pipe=sub"></script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-referrer.js b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-referrer.js
new file mode 100644
index 00000000000..5cc3a084436
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-referrer.js
@@ -0,0 +1,39 @@
+if (this.document === undefined) {
+ importScripts("/resources/testharness.js");
+ importScripts("/common/utils.js");
+ importScripts("../resources/utils.js");
+}
+
+function corsPreflightReferrer(desc, corsUrl, referrerPolicy, expectedReferrer) {
+ var uuid_token = token();
+ var url = corsUrl;
+ var urlParameters = "?token=" + uuid_token + "&max_age=0";
+ var requestInit = {"mode": "cors", "referrerPolicy": referrerPolicy};
+
+ /* Force preflight */
+ requestInit["headers"] = {"x-force-preflight": ""};
+ urlParameters += "&allow_headers=x-force-preflight";
+
+ promise_test(function(test) {
+ fetch(RESOURCES_DIR + "clean-stash.py?token=" + uuid_token).then(function(resp) {
+ assert_equals(resp.status, 200, "Clean stash response's status is 200");
+ return fetch(url + urlParameters, requestInit).then(function(resp) {
+ assert_equals(resp.status, 200, "Response's status is 200");
+ assert_equals(resp.headers.get("x-did-preflight"), "1", "Preflight request has been made");
+ assert_equals(resp.headers.get("x-preflight-referrer"), expectedReferrer, "Preflight's referrer is correct");
+ assert_equals(resp.headers.get("x-referrer"), expectedReferrer, "Request's refferer is correct");
+ });
+ });
+ }, desc);
+}
+
+var corsUrl = "http://www1.{{host}}:{{ports[http][0]}}" + dirname(location.pathname) + RESOURCES_DIR + "preflight.py";
+var origin = "http://{{host}}:{{ports[http][0]}}";
+
+corsPreflightReferrer("Referrer policy: no-referrer", corsUrl, "no-referrer", "");
+corsPreflightReferrer("Referrer policy: \"\"", corsUrl, "", "");
+corsPreflightReferrer("Referrer policy: origin-only", corsUrl, "origin-only", origin);
+corsPreflightReferrer("Referrer policy: origin-when-cross-origin", corsUrl, "origin-when-cross-origin", origin);
+corsPreflightReferrer("Referrer policy: unsafe-url", corsUrl, "unsafe-url", location.toString());
+
+done();
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-status-worker.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-status-worker.html
new file mode 100644
index 00000000000..7650c37d1ea
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-status-worker.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch in worker: preflight status code handling</title>
+ <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#cors-preflight-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+ <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("cors-preflight-status.js?pipe=sub"));
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-status.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-status.html
new file mode 100644
index 00000000000..bc11fb755e6
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-status.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch: preflight status code handling</title>
+ <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#cors-preflight-fetch">
+ <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="/common/utils.js"></script>
+ <script src="../resources/utils.js"></script>
+ <script src="cors-preflight-status.js?pipe=sub"></script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-status.js b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-status.js
new file mode 100644
index 00000000000..07bd23c9003
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-status.js
@@ -0,0 +1,41 @@
+if (this.document === undefined) {
+ importScripts("/resources/testharness.js");
+ importScripts("../resources/utils.js");
+ importScripts("/common/utils.js");
+}
+
+/* Check preflight is ok if status is ok status (200 to 299)*/
+function corsPreflightStatus(desc, corsUrl, preflightStatus) {
+ var uuid_token = token();
+ var url = corsUrl;
+ var requestInit = {"mode": "cors"};
+ /* Force preflight */
+ requestInit["headers"] = {"x-force-preflight": ""};
+
+ var urlParameters = "?token=" + uuid_token + "&max_age=0";
+ urlParameters += "&allow_headers=x-force-preflight";
+ urlParameters += "&preflight_status=" + preflightStatus;
+
+ promise_test(function(test) {
+ fetch(RESOURCES_DIR + "clean-stash.py?token=" + uuid_token).then(function(resp) {
+ assert_equals(resp.status, 200, "Clean stash response's status is 200");
+ if (200 <= preflightStatus && 299 >= preflightStatus) {
+ return fetch(url + urlParameters, requestInit).then(function(resp) {
+ assert_equals(resp.status, 200, "Response's status is 200");
+ assert_equals(resp.headers.get("x-did-preflight"), "1", "Preflight request has been made");
+ });
+ } else {
+ return promise_rejects(test, new TypeError(), fetch(url + urlParameters, requestInit));
+ }
+ });
+ }, desc);
+}
+
+var corsUrl = "http://www1.{{host}}:{{ports[http][0]}}" + dirname(location.pathname) + RESOURCES_DIR + "preflight.py";
+for (status of [200, 201, 202, 203, 204, 205, 206,
+ 300, 301, 302, 303, 304, 305, 306, 307, 308,
+ 400, 401, 402, 403, 404, 405,
+ 501, 502, 503, 504, 505])
+ corsPreflightStatus("Preflight answered with status " + status, corsUrl, status);
+
+done();
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-worker.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-worker.html
new file mode 100644
index 00000000000..bedef5d7751
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-worker.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch in worker: Check cors fetches requiring prefligh</title>
+ <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>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-cors-protocol">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#simple-method">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#simple-header">
+ </head>
+ <body>
+ <script>
+ fetch_tests_from_worker(new Worker("cors-preflight.js?pipe=sub"));
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight.html
new file mode 100644
index 00000000000..c4a581a55c5
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch: Check cors fetches requiring preflight</title>
+ <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-cors-protocol">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#simple-method">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#simple-header">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script src="../resources/utils.js"></script>
+ <script src="/common/utils.js"></script>
+ <script src="cors-preflight.js?pipe=sub"></script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight.js b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight.js
new file mode 100644
index 00000000000..60ecd186df1
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight.js
@@ -0,0 +1,82 @@
+if (this.document === undefined) {
+ importScripts("/resources/testharness.js");
+ importScripts("../resources/utils.js");
+ importScripts("/common/utils.js");
+}
+
+/*
+ Check preflight is done
+ Control if server allows method and headers and check accordingly
+ Check control access headers added by UA (for method and headers)
+*/
+function corsPreflight(desc, corsUrl, method, allowed, headers) {
+ var uuid_token = token();
+ fetch(RESOURCES_DIR + "clean-stash.py?token=" + uuid_token).then(function(response) {
+
+ var url = corsUrl;
+ var urlParameters = "?token=" + uuid_token + "&max_age=0";
+ var requestInit = {"mode": "cors", "method": method};
+ if (headers)
+ requestInit["headers"] = headers;
+
+ if (allowed) {
+ urlParameters += "&allow_methods=" + method;
+ if (headers) {
+ //Let's check prefligh request.
+ //Server will send back headers from Access-Control-Request-Headers in x-control-request-headers
+ urlParameters += "&control_request_headers"
+ //Make the server allow the headers
+ urlParameters += "&allow_headers="
+ urlParameters += headers.join("%2C%20");
+ }
+ promise_test(function(test) {
+ test.add_cleanup(function() {
+ fetch(RESOURCES_DIR + "clean-stash.py?token=" + uuid_token);
+ });
+ return fetch(url + urlParameters, requestInit).then(function(resp) {
+ assert_equals(resp.status, 200, "Response's status is 200");
+ assert_equals(resp.headers.get("x-did-preflight"), "1", "Preflight request has been made");
+ if (headers) {
+ var actualHeaders = resp.headers.get("x-control-request-headers").split(",");
+ for (var i in actualHeaders)
+ actualHeaders[i] = actualHeaders[i].trim();
+ for (var header in headers)
+ assert_in_array(header, actualHeaders, "Preflight asked permission for header: " + header);
+ }
+ });
+ }, desc);
+ } else {
+ promise_test(function(test) {
+ test.add_cleanup(function() {
+ fetch(RESOURCES_DIR + "clean-stash.py?token=" + uuid_token);
+ });
+ return promise_rejects(test, new TypeError(), fetch(url + urlParameters, requestInit));
+ }, desc);
+ }
+ });
+}
+
+var corsUrl = "http://www1.{{host}}:{{ports[http][0]}}" + dirname(location.pathname) + RESOURCES_DIR + "preflight.py";
+
+corsPreflight("CORS [DELETE], server allows", corsUrl, "DELETE", true);
+corsPreflight("CORS [DELETE], server refuses", corsUrl, "DELETE", false);
+corsPreflight("CORS [PUT], server allows", corsUrl, "PUT", true);
+corsPreflight("CORS [PUT], server refuses", corsUrl, "PUT", false);
+corsPreflight("CORS [PATCH], server allows", corsUrl, "PATCH", true);
+corsPreflight("CORS [PATCH], server refuses", corsUrl, "PATCH", false);
+corsPreflight("CORS [NEW], server allows", corsUrl, "NEW", true);
+corsPreflight("CORS [NEW], server refuses", corsUrl, "NEW", false);
+
+corsPreflight("CORS [GET] [x-test-header: allowed], server allows", corsUrl, "GET", true, {"x-test-header1": "allowed"});
+corsPreflight("CORS [GET] [x-test-header: refused], server refuses", corsUrl, "GET", false, {"x-test-header1": "refused"});
+
+var headers = {"x-test-header1": "allowedOrRefused",
+ "x-test-header2": "allowedOrRefused",
+ "x-test-header3": "allowedOrRefused",
+};
+corsPreflight("CORS [GET] [several headers], server allows", corsUrl, "GET", true, headers);
+corsPreflight("CORS [GET] [several headers], server refuses", corsUrl, "GET", false, headers);
+corsPreflight("CORS [PUT] [several headers], server allows", corsUrl, "PUT", true, headers);
+corsPreflight("CORS [PUT] [several headers], server refuses", corsUrl, "PUT", false, headers);
+
+done();
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect-credentials-worker.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect-credentials-worker.html
new file mode 100644
index 00000000000..38e3e78ac51
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect-credentials-worker.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch in worker: redirection url has credentials</title>
+ <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-fetch">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script>
+ fetch_tests_from_worker(new Worker("cors-redirect-credentials.js"));
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect-credentials.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect-credentials.html
new file mode 100644
index 00000000000..2491f692d10
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect-credentials.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch: redirection url has credentials</title>
+ <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-fetch">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script src="../resources/utils.js"></script>
+ <script src="cors-redirect-credentials.js?pipe=sub"></script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect-credentials.js b/tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect-credentials.js
new file mode 100644
index 00000000000..ce0ef2d0b26
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect-credentials.js
@@ -0,0 +1,47 @@
+if (this.document === undefined) {
+ importScripts("/resources/testharness.js");
+ importScripts("../resources/utils.js");
+}
+
+function corsRedirectCredentials(desc, redirectUrl, redirectLocation, redirectStatus, locationCredentials) {
+
+ var url = redirectUrl
+ var urlParameters = "?redirect_status=" + redirectStatus;
+ urlParameters += "&location=" + encodeURIComponent(redirectLocation.replace("://", "://" + locationCredentials + "@"));
+
+ var requestInit = {"mode": "cors", "redirect": "follow", "credentials":"include"};
+
+ promise_test(function(test) {
+ return promise_rejects(test, new TypeError(), fetch(url + urlParameters, requestInit));
+ }, desc);
+}
+
+var redirPath = dirname(location.pathname) + RESOURCES_DIR + "redirect.py";
+var preflightPath = dirname(location.pathname) + RESOURCES_DIR + "preflight.py";
+
+var localRedirect = "http://{{host}}:{{ports[http][0]}}" + redirPath;
+var remoteRedirect = "http://www1.{{host}}:{{ports[http][0]}}" + redirPath;
+
+var localLocation = "http://{{host}}:{{ports[http][0]}}" + preflightPath;
+var remoteLocation = "http://www1.{{host}}:{{ports[http][0]}}" + preflightPath;
+var remoteLocation2 = "http://www.{{host}}:{{ports[http][0]}}" + preflightPath;
+
+for (var code of [301, 302, 303, 307, 308]) {
+ corsRedirectCredentials("Redirect " + code + " from same origin to remote with user and password", localRedirect, remoteLocation, code, "user:password");
+ corsRedirectCredentials("Redirect " + code + " from same origin to remote with user", localRedirect, remoteLocation, code, "user:");
+ corsRedirectCredentials("Redirect " + code + " from same origin to remote with password", localRedirect, remoteLocation, code, ":password");
+
+ corsRedirectCredentials("Redirect " + code + " from remote to same origin with user and password", remoteRedirect, localLocation, code, "user:password");
+ corsRedirectCredentials("Redirect " + code + " from remote to same origin with user", remoteRedirect, localLocation, code, "user:");
+ corsRedirectCredentials("Redirect " + code + " from remote to same origin with password", remoteRedirect, localLocation, code, ":password");
+
+ corsRedirectCredentials("Redirect " + code + " from remote to another remote with user and password", remoteRedirect, remoteLocation2, code, "user:password");
+ corsRedirectCredentials("Redirect " + code + " from remote to another remote with user", remoteRedirect, remoteLocation2, code, "user:");
+ corsRedirectCredentials("Redirect " + code + " from remote to another remote with password", remoteRedirect, remoteLocation2, code, ":password");
+
+ corsRedirectCredentials("Redirect " + code + " from remote to same remote with user and password", remoteRedirect, remoteLocation, code, "user:password");
+ corsRedirectCredentials("Redirect " + code + " from remote to same remote with user", remoteRedirect, remoteLocation, code, "user:");
+ corsRedirectCredentials("Redirect " + code + " from remote to same remote with password", remoteRedirect, remoteLocation, code, ":password");
+}
+
+done();
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect-worker.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect-worker.html
new file mode 100644
index 00000000000..bf7bd965272
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect-worker.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch in worker: CORS Redirection with several origins</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">
+ <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("cors-redirect.js?pipe=sub"));
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect.html b/tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect.html
new file mode 100644
index 00000000000..f88eacf7bc5
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch: CORS Redirection with several origins</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">
+ <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="/common/utils.js"></script>
+ <script src="../resources/utils.js"></script>
+ <script src="cors-redirect.js?pipe=sub"></script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect.js b/tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect.js
new file mode 100644
index 00000000000..a818054ab10
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-redirect.js
@@ -0,0 +1,44 @@
+if (this.document === undefined) {
+ importScripts("/resources/testharness.js");
+ importScripts("/common/utils.js");
+ importScripts("../resources/utils.js");
+}
+
+function corsRedirect(desc, redirectUrl, redirectLocation, redirectStatus, expectedOrigin) {
+ var uuid_token = token();
+ var url = redirectUrl;
+ var urlParameters = "?token=" + uuid_token + "&max_age=0";
+ urlParameters += "&redirect_status=" + redirectStatus;
+ urlParameters += "&location=" + encodeURIComponent(redirectLocation);
+
+ var requestInit = {"mode": "cors", "redirect": "follow"};
+
+ promise_test(function(test) {
+ fetch(RESOURCES_DIR + "clean-stash.py?token=" + uuid_token).then(function(resp) {
+ return fetch(url + urlParameters, requestInit).then(function(resp) {
+ assert_equals(resp.status, 200, "Response's status is 200");
+ assert_equals(resp.headers.get("x-did-preflight"), "0", "No preflight request has been made");
+ assert_equals(resp.headers.get("x-origin"), expectedOrigin, "Origin is correctly set after redirect");
+ });
+ });
+ }, desc);
+}
+
+var redirPath = dirname(location.pathname) + RESOURCES_DIR + "redirect.py";
+var preflightPath = dirname(location.pathname) + RESOURCES_DIR + "preflight.py";
+
+var localRedirect = "http://{{host}}:{{ports[http][0]}}" + redirPath;
+var remoteRedirect = "http://www1.{{host}}:{{ports[http][0]}}" + redirPath;
+
+var localLocation = "http://{{host}}:{{ports[http][0]}}" + preflightPath;
+var remoteLocation = "http://www1.{{host}}:{{ports[http][0]}}" + preflightPath;
+var remoteLocation2 = "http://www.{{host}}:{{ports[http][0]}}" + preflightPath;
+
+for (var code of [301, 302, 303, 307, 308]) {
+ corsRedirect("Redirect " + code + ": cors to same cors", remoteRedirect, remoteLocation, code, location.origin);
+ corsRedirect("Redirect " + code + ": cors to another cors", remoteRedirect, remoteLocation2, code, "null");
+ corsRedirect("Redirect " + code + ": same origin to cors", localRedirect, remoteLocation, code, location.origin);
+ corsRedirect("Redirect " + code + ": cors to same origin", remoteRedirect, localLocation, code, "null");
+}
+
+done();
diff --git a/tests/wpt/web-platform-tests/fetch/api/credentials/authentication-basic-worker.html b/tests/wpt/web-platform-tests/fetch/api/credentials/authentication-basic-worker.html
new file mode 100644
index 00000000000..e9ced4f10af
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/credentials/authentication-basic-worker.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch in worker: Authorisation header management for basic authentication</title>
+ <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-fetch">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script>
+ fetch_tests_from_worker(new Worker("authentication-basic.js"));
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/credentials/authentication-basic.html b/tests/wpt/web-platform-tests/fetch/api/credentials/authentication-basic.html
new file mode 100644
index 00000000000..cba1ecd4acc
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/credentials/authentication-basic.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch: Authorisation header management for basic authentication</title>
+ <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-fetch">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script src="../resources/utils.js"></script>
+ <script src="authentication-basic.js"></script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/credentials/authentication-basic.js b/tests/wpt/web-platform-tests/fetch/api/credentials/authentication-basic.js
new file mode 100644
index 00000000000..ce93e9d7b93
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/credentials/authentication-basic.js
@@ -0,0 +1,21 @@
+if (this.document === undefined) {
+ importScripts("/resources/testharness.js");
+ importScripts("../resources/utils.js");
+}
+
+function basicAuth(desc, user, pass, mode, status) {
+ promise_test(function(test) {
+ var headers = { "Authorization": "Basic " + btoa(user + ":" + pass)};
+ var requestInit = {"credentials": mode, "headers": headers};
+ return fetch(RESOURCES_DIR + "authentication.py?realm=test", requestInit).then(function(resp) {
+ assert_equals(resp.status, status, "HTTP status is " + status);
+ assert_equals(resp.type , "basic", "Response's type is basic");
+ });
+ }, desc);
+}
+
+basicAuth("User-added Authorization header with include mode", "user", "password", "include", 200);
+basicAuth("User-added Authorization header with same-origin mode", "user", "password", "same-origin", 200);
+basicAuth("User-added Authorization header with omit mode", "user", "password", "omit", 200);
+
+done();
diff --git a/tests/wpt/web-platform-tests/fetch/api/credentials/cookies-worker.html b/tests/wpt/web-platform-tests/fetch/api/credentials/cookies-worker.html
new file mode 100644
index 00000000000..86febf10bef
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/credentials/cookies-worker.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch in worker: cookies management</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">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-fetch">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script>
+ fetch_tests_from_worker(new Worker("cookies.js"));
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/credentials/cookies.html b/tests/wpt/web-platform-tests/fetch/api/credentials/cookies.html
new file mode 100644
index 00000000000..72913029a2f
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/credentials/cookies.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch: cookies management</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">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-fetch">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script src="../resources/utils.js"></script>
+ <script src="cookies.js"></script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/credentials/cookies.js b/tests/wpt/web-platform-tests/fetch/api/credentials/cookies.js
new file mode 100644
index 00000000000..9c394d6fb38
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/credentials/cookies.js
@@ -0,0 +1,51 @@
+if (this.document === undefined) {
+ importScripts("/resources/testharness.js");
+ importScripts("../resources/utils.js");
+}
+
+function cookies(desc, credentials1, credentials2 ,cookies) {
+ var url = RESOURCES_DIR + "top.txt"
+ var urlParameters = "";
+ var urlCleanParameters = "";
+ if (cookies) {
+ urlParameters +="?pipe=header(Set-Cookie,";
+ urlParameters += cookies.join(",True)|header(Set-Cookie,") + ",True)";
+ urlCleanParameters +="?pipe=header(Set-Cookie,";
+ urlCleanParameters += cookies.join("%3B%20max-age=0,True)|header(Set-Cookie,") + "%3B%20max-age=0,True)";
+ }
+
+ var requestInit = {"credentials": credentials1}
+ promise_test(function(test){
+ var requestInit = {"credentials": credentials1}
+ 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");
+ //check cookies sent
+ return fetch(RESOURCES_DIR + "inspect-headers.py?headers=cookie" , {"credentials": credentials2});
+ }).then(function(resp) {
+ assert_equals(resp.status, 200, "HTTP status is 200");
+ assert_equals(resp.type , "basic", "Response's type is basic");
+ assert_false(resp.headers.has("Cookie") , "Cookie header is not exposed in response");
+ if (credentials1 != "omit" && credentials2 != "omit") {
+ assert_equals(resp.headers.get("x-request-cookie") , cookies.join("; "), "Request include cookie(s)");
+ }
+ else {
+ assert_false(resp.headers.has("x-request-cookie") , "Request does not have cookie(s)");
+ }
+ //clean cookies
+ return fetch(url + urlCleanParameters, {"credentials": "include"});
+ }).catch(function() {
+ fetch(url + urlCleanParameters, {"credentials": "include"});
+ });
+ }, desc);
+}
+
+cookies("Include mode: 1 cookie", "include", "include", ["a=1"]);
+cookies("Include mode: 2 cookies", "include", "include", ["b=2", "c=3"]);
+cookies("Omit mode: discard cookies", "omit", "omit", ["d=4"]);
+cookies("Omit mode: no cookie is stored", "omit", "include", ["e=5"]);
+cookies("Omit mode: no cookie is sent", "include", "omit", ["f=6"]);
+cookies("Same-origin mode: 1 cookie", "same-origin", "same-origin", ["a=1"]);
+cookies("Same-origin mode: 2 cookies", "same-origin", "same-origin", ["b=2", "c=3"]);
+
+done();
diff --git a/tests/wpt/web-platform-tests/fetch/api/headers/headers-basic.html b/tests/wpt/web-platform-tests/fetch/api/headers/headers-basic.html
new file mode 100644
index 00000000000..a5b8b6cfa9c
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/headers/headers-basic.html
@@ -0,0 +1,111 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Headers structure</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#headers">
+ <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>
+ test(function() {
+ new Headers();
+ }, "Create headers from no parameter");
+
+ test(function() {
+ new Headers(undefined);
+ }, "Create headers from undefined parameter");
+
+ test(function() {
+ new Headers({});
+ }, "Create headers from empty object");
+
+ var parameters = [null, 1];
+ parameters.forEach(function(parameter) {
+ test(function() {
+ assert_throws(new TypeError(), () => new Headers(parameter));
+ }, "Create headers with " + parameter + " should throw");
+ });
+
+ var headerDict = {"name1": "value1",
+ "name2": "value2",
+ "name3": "value3",
+ "name5": undefined,
+ "name4": null,
+ "Content-Type": "value4"
+ };
+
+ var headerSeq = [];
+ for (var name in headerDict)
+ headerSeq.push([name, headerDict[name]]);
+
+ test(function() {
+ var headers = new Headers(headerSeq);
+ for (name in headerDict)
+ assert_equals(headers.get(name), String(headerDict[name]),
+ "name: " + name + " has value: " + headerDict[name]);
+ }, "Create headers with sequence");
+
+ test(function() {
+ var headers = new Headers(headerDict);
+ for (name in headerDict)
+ assert_equals(headers.get(name), String(headerDict[name]),
+ "name: " + name + " has value: " + headerDict[name]);
+ }, "Create headers with OpenEndedDictionary");
+
+ test(function() {
+ var headers = new Headers(headerDict);
+ var headers2 = new Headers(headers);
+ for (name in headerDict)
+ assert_equals(headers2.get(name), String(headerDict[name]),
+ "name: " + name + " has value: " + headerDict[name]);
+ }, "Create headers whith existing headers");
+
+ test(function() {
+ var headers = new Headers();
+ for (name in headerDict) {
+ headers.append(name, headerDict[name]);
+ assert_equals(headers.get(name), String(headerDict[name]),
+ "name: " + name + " has value: " + headerDict[name]);
+ }
+ }, "Check append method");
+
+ test(function() {
+ var headers = new Headers();
+ for (name in headerDict) {
+ headers.set(name, headerDict[name]);
+ assert_equals(headers.get(name), String(headerDict[name]),
+ "name: " + name + " has value: " + headerDict[name]);
+ }
+ }, "Check set method");
+
+ test(function() {
+ var headers = new Headers(headerDict);
+ for (name in headerDict)
+ assert_true(headers.has(name),"headers has name " + name);
+
+ assert_false(headers.has("nameNotInHeaders"),"headers do not have header: nameNotInHeaders");
+ }, "Check has method");
+
+ test(function() {
+ var headers = new Headers(headerDict);
+ for (name in headerDict) {
+ assert_true(headers.has(name),"headers have a header: " + name);
+ headers.delete(name)
+ assert_true(!headers.has(name),"headers do not have anymore a header: " + name);
+ }
+ }, "Check delete method");
+
+ test(function() {
+ var headers = new Headers(headerDict);
+ for (name in headerDict)
+ assert_equals(headers.get(name), String(headerDict[name]),
+ "name: " + name + "has value: " + headerDict[name]);
+
+ assert_equals(headers.get("nameNotInHeaders"), null, "header: nameNotInHeaders has no value");
+ }, "Check get method");
+ </script>
+ </body>
+</html>
diff --git a/tests/wpt/web-platform-tests/fetch/api/headers/headers-casing.html b/tests/wpt/web-platform-tests/fetch/api/headers/headers-casing.html
new file mode 100644
index 00000000000..1e505d81cda
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/headers/headers-casing.html
@@ -0,0 +1,64 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Headers case management</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#concept-header-list-append">
+ <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>
+ var headerDictCase = {"UPPERCASE": "value1",
+ "lowercase": "value2",
+ "mixedCase": "value3",
+ "Content-TYPE": "value4"
+ };
+
+ function checkHeadersCase(originalName, headersToCheck, expectedDict) {
+ var lowCaseName = originalName.toLowerCase();
+ var upCaseName = originalName.toUpperCase();
+ var expectedValue = expectedDict[originalName];
+ assert_equals(headersToCheck.get(originalName), expectedValue,
+ "name: " + originalName + " has value: " + expectedValue);
+ assert_equals(headersToCheck.get(lowCaseName), expectedValue,
+ "name: " + lowCaseName + " has value: " + expectedValue);
+ assert_equals(headersToCheck.get(upCaseName), expectedValue,
+ "name: " + upCaseName + " has value: " + expectedValue);
+ }
+
+ test(function() {
+ var headers = new Headers(headerDictCase);
+ for (name in headerDictCase)
+ checkHeadersCase(name, headers, headerDictCase)
+ }, "Create headers, names use characters with different case");
+
+ test(function() {
+ var headers = new Headers();
+ for (name in headerDictCase) {
+ headers.append(name, headerDictCase[name]);
+ checkHeadersCase(name, headers, headerDictCase);
+ }
+ }, "Check append method, names use characters with different case");
+
+ test(function() {
+ var headers = new Headers();
+ for (name in headerDictCase) {
+ headers.set(name, headerDictCase[name]);
+ checkHeadersCase(name, headers, headerDictCase);
+ }
+ }, "Check set method, names use characters with different case");
+
+ test(function() {
+ var headers = new Headers();
+ for (name in headerDictCase)
+ headers.set(name, headerDictCase[name]);
+ for (name in headerDictCase)
+ headers.delete(name.toLowerCase());
+ for (name in headerDictCase)
+ assert_false(headers.has(name), "header " + name + " should have been deleted");
+ }, "Check delete method, names use characters with different case");
+ </script>
+ </body>
+</html>
diff --git a/tests/wpt/web-platform-tests/fetch/api/headers/headers-combine.html b/tests/wpt/web-platform-tests/fetch/api/headers/headers-combine.html
new file mode 100644
index 00000000000..ddcfdbee6eb
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/headers/headers-combine.html
@@ -0,0 +1,60 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Headers nameshake</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#headers">
+ <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>
+ var headerSeqCombine = [["single", "singleValue"],
+ ["double", "doubleValue1"],
+ ["double", "doubleValue2"],
+ ["triple", "tripleValue1"],
+ ["triple", "tripleValue2"],
+ ["triple", "tripleValue3"]
+ ];
+ var expectedDict = {"single": "singleValue",
+ "double": "doubleValue1, doubleValue2",
+ "triple": "tripleValue1, tripleValue2, tripleValue3"
+ };
+
+ test(function() {
+ var headers = new Headers(headerSeqCombine);
+ for (name in expectedDict)
+ assert_equals(headers.get(name), expectedDict[name],
+ "name: " + name + " has value: " + expectedDict[name]);
+ }, "Create headers using same name for different values");
+
+ test(function() {
+ var headers = new Headers(headerSeqCombine);
+ for (name in expectedDict) {
+ assert_true(headers.has(name), "name: " + name + " has value(s)");
+ headers.delete(name);
+ assert_false(headers.has(name), "name: " + name + " has no value(s) anymore");
+ }
+ }, "Check delete and has methods when using same name for different values");
+
+ test(function() {
+ var headers = new Headers(headerSeqCombine);
+ for (name in expectedDict) {
+ headers.set(name,"newSingleValue");
+ assert_equals(headers.get(name), "newSingleValue", "name: " + name + " has value: newSingleValue");
+ }
+ }, "Check set methods when called with already used name");
+
+ test(function() {
+ var headers = new Headers(headerSeqCombine);
+ for (name in expectedDict) {
+ var value = headers.get(name);
+ headers.append(name,"newSingleValue");
+ assert_equals(headers.get(name), (value + ", " + "newSingleValue"),
+ "name: " + name + " has value: " + headers.get(name));
+ }
+ }, "Check append methods when called with already used name");
+ </script>
+ </body>
+</html>
diff --git a/tests/wpt/web-platform-tests/fetch/api/headers/headers-errors.html b/tests/wpt/web-platform-tests/fetch/api/headers/headers-errors.html
new file mode 100644
index 00000000000..be2d1a518dc
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/headers/headers-errors.html
@@ -0,0 +1,66 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Headers errors</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#headers">
+ <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>
+
+ test(function() {
+ assert_throws(new TypeError() , function() { new Headers([["name"]]) });
+ }, "Create headers giving an array having one string as init argument");
+
+ test(function() {
+ assert_throws(new TypeError() , function() { new Headers([["invalid", "invalidValue1", "invalidValue2"]]) });
+ }, "Create headers giving an array having three strings as init argument");
+
+ test(function() {
+ assert_throws(new TypeError() , function() { new Headers([["invalidĀ", "Value1"]]) });
+ }, "Create headers giving bad header name as init argument");
+
+ test(function() {
+ assert_throws(new TypeError() , function() { new Headers([["name", "invalidValueĀ"]]) });
+ }, "Create headers giving bad header value as init argument");
+
+ test(function() {
+ var headers = new Headers();
+ assert_throws(new TypeError() , function() { headers.get("invalidĀ") });
+ }, "Check headers get with an invalid name");
+
+ test(function() {
+ var headers = new Headers();
+ assert_throws(new TypeError() , function() { headers.delete("invalidĀ") });
+ }, "Check headers delete with an invalid name");
+
+ test(function() {
+ var headers = new Headers();
+ assert_throws(new TypeError() , function() { headers.has("invalidĀ") });
+ }, "Check headers has with an invalid name");
+
+ test(function() {
+ var headers = new Headers();
+ assert_throws(new TypeError() , function() { headers.set("invalidĀ", "Value1") });
+ }, "Check headers set with an invalid name");
+
+ test(function() {
+ var headers = new Headers();
+ assert_throws(new TypeError() , function() { headers.set("name", "invalidValueĀ") });
+ }, "Check headers set with an invalid value");
+
+ test(function() {
+ var headers = new Headers();
+ assert_throws(new TypeError() , function() { headers.append("invalidĀ", "Value1") });
+ }, "Check headers append with an invalid name");
+
+ test(function() {
+ var headers = new Headers();
+ assert_throws(new TypeError() , function() { headers.append("name", "invalidValueĀ") });
+ }, "Check headers append with an invalid value");
+ </script>
+ </body>
+</html>
diff --git a/tests/wpt/web-platform-tests/fetch/api/headers/headers-idl.html b/tests/wpt/web-platform-tests/fetch/api/headers/headers-idl.html
new file mode 100644
index 00000000000..2aaa1ceeaee
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/headers/headers-idl.html
@@ -0,0 +1,36 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Headers idl interface</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#response">
+ <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>
+ <script src="/resources/WebIDLParser.js"></script>
+ <script src="/resources/idlharness.js"></script>
+ </head>
+ <body>
+ <script id="headers-idl" type="text/plain">
+ typedef (Headers or sequence<sequence<ByteString>> or OpenEndedDictionary<ByteString>) HeadersInit;
+
+ [Constructor(optional HeadersInit init),
+ Exposed=(Window,Worker)]
+ interface Headers {
+ void append(ByteString name, ByteString value);
+ void delete(ByteString name);
+ ByteString? get(ByteString name);
+ boolean has(ByteString name);
+ void set(ByteString name, ByteString value);
+ iterable<ByteString, ByteString>;
+ };
+ </script>
+ <script>
+ var idlsArray = new IdlArray();
+ var idl = document.getElementById("headers-idl").innerHTML
+ idlsArray.add_idls(idl);
+ idlsArray.add_objects({ Headers: ['new Headers()'] });
+ idlsArray.test();
+ </script>
+ </body>
+</html>
diff --git a/tests/wpt/web-platform-tests/fetch/api/headers/headers-normalize.html b/tests/wpt/web-platform-tests/fetch/api/headers/headers-normalize.html
new file mode 100644
index 00000000000..384c4f4c26f
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/headers/headers-normalize.html
@@ -0,0 +1,47 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Headers normalize values</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#concept-header-value-normalize">
+ <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>
+ var headerDictWS = {"name1": " space ",
+ "name2": "\ttab\t",
+ "name3": " spaceAndTab\t",
+ "name4": "\r\n newLine", //obs-fold cases
+ "name5": "newLine\r\n ",
+ "name6": "\r\n\tnewLine",
+ };
+
+ test(function() {
+ var headers = new Headers(headerDictWS);
+ for (name in headerDictWS)
+ assert_equals(headers.get(name), headerDictWS[name].trim(),
+ "name: " + name + " has normalized value: " + headerDictWS[name].trim());
+ }, "Create headers with not normalized values");
+
+ test(function() {
+ var headers = new Headers();
+ for (name in headerDictWS) {
+ headers.append(name, headerDictWS[name]);
+ assert_equals(headers.get(name), headerDictWS[name].trim(),
+ "name: " + name + " has value: " + headerDictWS[name].trim());
+ }
+ }, "Check append method whith not normalized values");
+
+ test(function() {
+ var headers = new Headers();
+ for (name in headerDictWS) {
+ headers.set(name, headerDictWS[name]);
+ assert_equals(headers.get(name), headerDictWS[name].trim(),
+ "name: " + name + " has value: " + headerDictWS[name].trim());
+ }
+ }, "Check set method whith not normalized values");
+ </script>
+ </body>
+</html>
diff --git a/tests/wpt/web-platform-tests/fetch/api/headers/headers-structure.html b/tests/wpt/web-platform-tests/fetch/api/headers/headers-structure.html
new file mode 100644
index 00000000000..9448e450c9b
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/headers/headers-structure.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Headers basic</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#headers">
+ <meta name="help" href="https://heycam.github.io/webidl/#idl-iterable">
+ <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>
+ var headers = new Headers();
+ var methods = ["append",
+ "delete",
+ "get",
+ "has",
+ "set",
+ //Headers is iterable
+ "entries",
+ "keys",
+ "values"
+ ];
+ for (var idx in methods)
+ test(function() {
+ assert_true(methods[idx] in headers, "headers has " + methods[idx] + " method");
+ }, "Headers has " + methods[idx] + " method");
+ </script>
+ </body>
+</html>
diff --git a/tests/wpt/web-platform-tests/fetch/api/policies/csp-blocked-worker.html b/tests/wpt/web-platform-tests/fetch/api/policies/csp-blocked-worker.html
new file mode 100644
index 00000000000..e8660dffa94
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/policies/csp-blocked-worker.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch in worker: blocked by CSP</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-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("csp-blocked.js"));
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/policies/csp-blocked.html b/tests/wpt/web-platform-tests/fetch/api/policies/csp-blocked.html
new file mode 100644
index 00000000000..99e90dfcd8f
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/policies/csp-blocked.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch: blocked by CSP</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-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="csp-blocked.js"></script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/policies/csp-blocked.html.headers b/tests/wpt/web-platform-tests/fetch/api/policies/csp-blocked.html.headers
new file mode 100644
index 00000000000..c8c1e9ffbd9
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/policies/csp-blocked.html.headers
@@ -0,0 +1 @@
+Content-Security-Policy: connect-src 'none'; \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/policies/csp-blocked.js b/tests/wpt/web-platform-tests/fetch/api/policies/csp-blocked.js
new file mode 100644
index 00000000000..0395304b816
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/policies/csp-blocked.js
@@ -0,0 +1,13 @@
+if (this.document === undefined) {
+ importScripts("/resources/testharness.js");
+ importScripts("../resources/utils.js");
+}
+
+//Content-Security-Policy: connect-src 'none'; cf .headers file
+cspViolationUrl = RESOURCES_DIR + "top.txt";
+
+promise_test(function(test) {
+ return promise_rejects(test, new TypeError(), fetch(cspViolationUrl));
+}, "Fetch is blocked by CSP, got a TypeError");
+
+done();
diff --git a/tests/wpt/web-platform-tests/fetch/api/policies/csp-blocked.js.headers b/tests/wpt/web-platform-tests/fetch/api/policies/csp-blocked.js.headers
new file mode 100644
index 00000000000..c8c1e9ffbd9
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/policies/csp-blocked.js.headers
@@ -0,0 +1 @@
+Content-Security-Policy: connect-src 'none'; \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/policies/referrer-no-referrer-worker.html b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-no-referrer-worker.html
new file mode 100644
index 00000000000..dbef9bb658f
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-no-referrer-worker.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch in worker: referrer with no-referrer policy</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-or-cache-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("referrer-no-referrer.js"));
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/policies/referrer-no-referrer.html b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-no-referrer.html
new file mode 100644
index 00000000000..22a6f34c525
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-no-referrer.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch: referrer with no-referrer policy</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-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="referrer-no-referrer.js"></script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/policies/referrer-no-referrer.html.headers b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-no-referrer.html.headers
new file mode 100644
index 00000000000..6954766b475
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-no-referrer.html.headers
@@ -0,0 +1 @@
+Content-Security-Policy: referrer no-referrer; \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/policies/referrer-no-referrer.js b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-no-referrer.js
new file mode 100644
index 00000000000..60600bf081c
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-no-referrer.js
@@ -0,0 +1,19 @@
+if (this.document === undefined) {
+ importScripts("/resources/testharness.js");
+ importScripts("../resources/utils.js");
+}
+
+var fetchedUrl = RESOURCES_DIR + "inspect-headers.py?headers=origin";
+
+promise_test(function(test) {
+ return fetch(fetchedUrl).then(function(resp) {
+ assert_equals(resp.status, 200, "HTTP status is 200");
+ assert_equals(resp.type , "basic", "Response's type is basic");
+ var referrer = resp.headers.get("x-request-referer");
+ //Either no referrer header is sent or it is empty
+ if (referrer)
+ assert_equals(referrer, "", "request's referrer is empty");
+ });
+}, "Request's referrer is empty");
+
+done();
diff --git a/tests/wpt/web-platform-tests/fetch/api/policies/referrer-no-referrer.js.headers b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-no-referrer.js.headers
new file mode 100644
index 00000000000..6954766b475
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-no-referrer.js.headers
@@ -0,0 +1 @@
+Content-Security-Policy: referrer no-referrer; \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/policies/referrer-origin-worker.html b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-origin-worker.html
new file mode 100644
index 00000000000..bb80dd54fbf
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-origin-worker.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch in worker: referrer with origin policy</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-or-cache-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("referrer-origin.js?pipe=sub"));
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/policies/referrer-origin.html b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-origin.html
new file mode 100644
index 00000000000..92baed79be7
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-origin.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch: referrer with origin policy</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-or-cache-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="referrer-origin.js?pipe=sub"></script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/policies/referrer-origin.html.headers b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-origin.html.headers
new file mode 100644
index 00000000000..9bb592a867d
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-origin.html.headers
@@ -0,0 +1 @@
+Content-Security-Policy: referrer origin; \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/policies/referrer-origin.js b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-origin.js
new file mode 100644
index 00000000000..3eb414b2fe4
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-origin.js
@@ -0,0 +1,22 @@
+if (this.document === undefined) {
+ importScripts("/resources/testharness.js");
+ importScripts("../resources/utils.js");
+}
+
+var origin = "http://{{host}}:{{ports[http][0]}}";
+var fetchedUrl = RESOURCES_DIR + "inspect-headers.py?headers=referer";
+
+promise_test(function(test) {
+ return fetch(fetchedUrl).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-referer"), origin, "request's referrer is " + origin);
+ });
+}, "Request's referrer is origin");
+
+promise_test(function(test) {
+ var referrerUrl = "http://{{domains[www]}}:{{ports[http][0]}}/";
+ return promise_rejects(test, new TypeError(), fetch(fetchedUrl, { "referrer": referrerUrl}));
+}, "Throw a TypeError referrer is not same-origin with origin");
+
+done();
diff --git a/tests/wpt/web-platform-tests/fetch/api/policies/referrer-origin.js.headers b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-origin.js.headers
new file mode 100644
index 00000000000..9bb592a867d
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-origin.js.headers
@@ -0,0 +1 @@
+Content-Security-Policy: referrer origin; \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/policies/referrer-unsafe-url-worker.html b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-unsafe-url-worker.html
new file mode 100644
index 00000000000..42045776b12
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-unsafe-url-worker.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch in worker: referrer with unsafe-url policy</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-or-cache-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("referrer-unsafe-url.js"));
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/policies/referrer-unsafe-url.html b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-unsafe-url.html
new file mode 100644
index 00000000000..10dd79e3d35
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-unsafe-url.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch: referrer with unsafe-url policy</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-or-cache-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="referrer-unsafe-url.js"></script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/policies/referrer-unsafe-url.html.headers b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-unsafe-url.html.headers
new file mode 100644
index 00000000000..8efcca15fe0
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-unsafe-url.html.headers
@@ -0,0 +1 @@
+Content-Security-Policy: referrer unsafe-url; \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/policies/referrer-unsafe-url.js b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-unsafe-url.js
new file mode 100644
index 00000000000..b593fad5aa2
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-unsafe-url.js
@@ -0,0 +1,17 @@
+if (this.document === undefined) {
+ importScripts("/resources/testharness.js");
+ importScripts("../resources/utils.js");
+}
+
+var referrerUrl = location.href;
+var fetchedUrl = RESOURCES_DIR + "inspect-headers.py?headers=referer";
+
+promise_test(function(test) {
+ return fetch(fetchedUrl).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-referer"), referrerUrl, "request's referrer is " + referrerUrl);
+ });
+}, "Request's referrer is the full url of current document/worker");
+
+done();
diff --git a/tests/wpt/web-platform-tests/fetch/api/policies/referrer-unsafe-url.js.headers b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-unsafe-url.js.headers
new file mode 100644
index 00000000000..8efcca15fe0
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/policies/referrer-unsafe-url.js.headers
@@ -0,0 +1 @@
+Content-Security-Policy: referrer unsafe-url; \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-count-worker.html b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-count-worker.html
new file mode 100644
index 00000000000..1ce33b7c403
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-count-worker.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch in worker: rediraction loop</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("redirect-count.js"));
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-count.html b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-count.html
new file mode 100644
index 00000000000..61deb9f528d
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-count.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch: redirection loop</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="/common/utils.js"></script>
+ <script src="../resources/utils.js"></script>
+ <script src="redirect-count.js"></script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-count.js b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-count.js
new file mode 100644
index 00000000000..ffa521a5c0f
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-count.js
@@ -0,0 +1,42 @@
+if (this.document === undefined) {
+ importScripts("/resources/testharness.js");
+ importScripts("../resources/utils.js");
+ importScripts("/common/utils.js");
+}
+
+function redirectCount(desc, redirectUrl, redirectLocation, redirectStatus, maxCount, shouldPass) {
+ var uuid_token = token();
+
+ var urlParameters = "?token=" + uuid_token + "&max_age=0";
+ urlParameters += "&redirect_status=" + redirectStatus;
+ urlParameters += "&max_count=" + maxCount;
+ if (redirectLocation)
+ urlParameters += "&location=" + encodeURIComponent(redirectLocation);
+
+ var url = redirectUrl;
+ var requestInit = {"redirect": "follow"};
+
+ promise_test(function(test) {
+ fetch(RESOURCES_DIR + "clean-stash.py?token=" + uuid_token).then(function(resp) {
+ assert_equals(resp.status, 200, "Clean stash response's status is 200");
+
+ if (!shouldPass)
+ return promise_rejects(test, new TypeError(), fetch(url + urlParameters, requestInit));
+
+ return fetch(url + urlParameters, requestInit).then(function(resp) {
+ assert_equals(resp.status, 200, "Response's status is 200");
+ });
+ }).then(function(body) {
+ assert_equals(body, maxCount.toString(), "Redirected " + maxCount + "times");
+ });
+ }, desc);
+}
+
+var redirUrl = RESOURCES_DIR + "redirect.py";
+
+for (var statusCode of [301, 302, 303, 307, 308]) {
+ redirectCount("Redirect " + statusCode + " 20 times", redirUrl, redirUrl, statusCode, 20, true);
+ redirectCount("Redirect " + statusCode + " 21 times", redirUrl, redirUrl, statusCode, 21, false);
+}
+
+done();
diff --git a/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-location-worker.html b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-location-worker.html
new file mode 100644
index 00000000000..e2970811c07
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-location-worker.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch in worker: handling Location header during redirection</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("redirect-location.js"));
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-location.html b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-location.html
new file mode 100644
index 00000000000..ac35dea54c4
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-location.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch: handling Location header during redirection</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="redirect-location.js"></script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-location.js b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-location.js
new file mode 100644
index 00000000000..5b081a75408
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-location.js
@@ -0,0 +1,50 @@
+if (this.document === undefined) {
+ importScripts("/resources/testharness.js");
+ importScripts("../resources/utils.js");
+}
+
+function redirectLocation(desc, redirectUrl, redirectLocation, redirectStatus, redirectMode, shouldPass) {
+ var url = redirectUrl;
+ var urlParameters = "?redirect_status=" + redirectStatus;
+ if (redirectLocation)
+ urlParameters += "&location=" + encodeURIComponent(redirectLocation);
+
+ var requestInit = {"redirect": redirectMode};
+
+ promise_test(function(test) {
+ if (redirectMode === "error" || !shouldPass)
+ return promise_rejects(test, new TypeError(), fetch(url + urlParameters, requestInit));
+ if (redirectLocation && redirectMode === "manual")
+ return fetch(url + urlParameters, requestInit).then(function(resp) {
+ assert_equals(resp.status, 0, "Response's status is 0");
+ assert_equals(resp.type, "opaqueredirect", "Response's type is opaqueredirect");
+ assert_equals(resp.statusText, "", "Response's statusText is \"\"");
+ assert_true(resp.headers.entries().next().done, "Headers should be empty");
+ });
+
+ if (redirectMode === "manual" || redirectMode === "follow")
+ return fetch(url + urlParameters, requestInit).then(function(resp) {
+ assert_equals(resp.status, redirectStatus, "Response's status is " + redirectStatus);
+ });
+ assert_unreached(redirectMode + " is not a valid redirect mode");
+ }, desc);
+}
+
+var redirUrl = RESOURCES_DIR + "redirect.py";
+var locationUrl = "top.txt";
+var invalidLocationUrl = "#invalidurl:";
+var dataLocationUrl = "data:,data%20url";
+// FIXME: We may want to mix redirect-mode and cors-mode.
+// FIXME: Add tests for "error" redirect-mode.
+for (var statusCode of [301, 302, 303, 307, 308]) {
+ redirectLocation("Redirect " + statusCode + " in \"follow\" mode without location", redirUrl, undefined, statusCode, "follow", true);
+ redirectLocation("Redirect " + statusCode + " in \"manual\" mode without location", redirUrl, undefined, statusCode, "manual", true);
+
+ redirectLocation("Redirect " + statusCode + " in \"follow\" mode with invalid location", redirUrl, invalidLocationUrl, statusCode, "follow", false);
+ redirectLocation("Redirect " + statusCode + " in \"manual\" mode with invalid location", redirUrl, invalidLocationUrl, statusCode, "manual", false);
+
+ redirectLocation("Redirect " + statusCode + " in \"follow\" mode with data location", redirUrl, dataLocationUrl, statusCode, "follow", false);
+ redirectLocation("Redirect " + statusCode + " in \"manual\" mode with data location", redirUrl, dataLocationUrl, statusCode, "manual", true);
+}
+
+done();
diff --git a/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-method-worker.html b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-method-worker.html
new file mode 100644
index 00000000000..fc0bc5e529d
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-method-worker.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch in worker: request method handling when redirected</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("redirect-method.js"));
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-method.html b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-method.html
new file mode 100644
index 00000000000..028842dbe07
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-method.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch: request method handling when redirected</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="redirect-method.js"></script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-method.js b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-method.js
new file mode 100644
index 00000000000..a7e1b0b69c5
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-method.js
@@ -0,0 +1,46 @@
+if (this.document === undefined) {
+ importScripts("/resources/testharness.js");
+ importScripts("../resources/utils.js");
+}
+
+function redirectMethod(desc, redirectUrl, redirectLocation, redirectStatus, method, expectedMethod) {
+ var url = redirectUrl;
+ var urlParameters = "?redirect_status=" + redirectStatus;
+ urlParameters += "&location=" + encodeURIComponent(redirectLocation);
+
+ var requestInit = {"method": method, "redirect": "follow"};
+ if (method != "GET" && method != "HEAD")
+ requestInit.body = "this is my body";
+
+ promise_test(function(test) {
+ return fetch(url + urlParameters, requestInit).then(function(resp) {
+ assert_equals(resp.status, 200, "Response's status is 200");
+ assert_equals(resp.type, "basic", "Response's type basic");
+ assert_equals(resp.headers.get("x-request-method"), expectedMethod, "Request method after redirection is " + expectedMethod);
+ return resp.text().then(function(text) {
+ assert_equals(text, expectedMethod == "POST" ? requestInit.body : "");
+ });
+ });
+ }, desc);
+}
+
+var redirUrl = RESOURCES_DIR + "redirect.py";
+var locationUrl = "method.py";
+
+redirectMethod("Redirect 301 with GET", redirUrl, locationUrl, 301, "GET", "GET");
+redirectMethod("Redirect 301 with POST", redirUrl, locationUrl, 301, "POST", "GET");
+redirectMethod("Redirect 301 with HEAD", redirUrl, locationUrl, 301, "HEAD", "HEAD");
+
+redirectMethod("Redirect 302 with GET", redirUrl, locationUrl, 302, "GET", "GET");
+redirectMethod("Redirect 302 with POST", redirUrl, locationUrl, 302, "POST", "GET");
+redirectMethod("Redirect 302 with HEAD", redirUrl, locationUrl, 302, "HEAD", "HEAD");
+
+redirectMethod("Redirect 303 with GET", redirUrl, locationUrl, 303, "GET", "GET");
+redirectMethod("Redirect 303 with POST", redirUrl, locationUrl, 303, "POST", "GET");
+redirectMethod("Redirect 303 with HEAD", redirUrl, locationUrl, 303, "HEAD", "HEAD");
+
+redirectMethod("Redirect 307 with GET", redirUrl, locationUrl, 307, "GET", "GET");
+redirectMethod("Redirect 307 with POST", redirUrl, locationUrl, 307, "POST", "POST");
+redirectMethod("Redirect 307 with HEAD", redirUrl, locationUrl, 307, "HEAD", "HEAD");
+
+done();
diff --git a/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-mode-worker.html b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-mode-worker.html
new file mode 100644
index 00000000000..32d219f7678
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-mode-worker.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch in worker: redirect mode handling</title>
+ <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#concept-filtered-response-opaque-redirect">
+ <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("redirect-mode.js"));
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-mode.html b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-mode.html
new file mode 100644
index 00000000000..2f68d2b70a0
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-mode.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch: redirect mode handling</title>
+ <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#concept-filtered-response-opaque-redirect">
+ <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="redirect-mode.js"></script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-mode.js b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-mode.js
new file mode 100644
index 00000000000..f6832c49276
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/redirect/redirect-mode.js
@@ -0,0 +1,40 @@
+if (this.document === undefined) {
+ importScripts("/resources/testharness.js");
+ importScripts("../resources/utils.js");
+}
+
+function redirectMode(desc, redirectUrl, redirectLocation, redirectStatus, redirectMode) {
+ var url = redirectUrl;
+ var urlParameters = "?redirect_status=" + redirectStatus;
+ urlParameters += "&location=" + encodeURIComponent(redirectLocation);
+
+ var requestInit = {"redirect": redirectMode};
+
+ promise_test(function(test) {
+ if (redirectMode === "error")
+ return promise_rejects(test, new TypeError(), fetch(url + urlParameters, requestInit));
+ if (redirectMode === "manual")
+ return fetch(url + urlParameters, requestInit).then(function(resp) {
+ assert_equals(resp.status, 0, "Response's status is 0");
+ assert_equals(resp.type, "opaqueredirect", "Response's type is opaqueredirect");
+ assert_equals(resp.statusText, "", "Response's statusText is \"\"");
+ });
+ if (redirectMode === "follow")
+ return fetch(url + urlParameters, requestInit).then(function(resp) {
+ assert_true(new URL(resp.url).pathname.endsWith(locationUrl), "Response's url should be the redirected one");
+ assert_equals(resp.status, 200, "Response's status is 200");
+ });
+ assert_unreached(redirectMode + " is no a valid redirect mode");
+ }, desc);
+}
+
+var redirUrl = RESOURCES_DIR + "redirect.py";
+var locationUrl = "top.txt";
+
+for (var statusCode of [301, 302, 303, 307, 308]) {
+ redirectMode("Redirect " + statusCode + " in \"error\" mode ", redirUrl, locationUrl, statusCode, "error");
+ redirectMode("Redirect " + statusCode + " in \"follow\" mode ", redirUrl, locationUrl, statusCode, "follow");
+ redirectMode("Redirect " + statusCode + " in \"manual\" mode ", redirUrl, locationUrl, statusCode, "manual");
+}
+
+done();
diff --git a/tests/wpt/web-platform-tests/fetch/api/request/request-clone.sub.html b/tests/wpt/web-platform-tests/fetch/api/request/request-clone.sub.html
new file mode 100644
index 00000000000..ae784564d70
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/request/request-clone.sub.html
@@ -0,0 +1,48 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Request clone</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#request">
+ <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>
+ <script src="../resources/utils.js"></script>
+ </head>
+ <body>
+ <script>
+ var headers = new Headers( {"name":"value"} );
+ var emptyHeaders = new Headers();
+
+ var initValuesDict = {"method" : "POST",
+ "referrer" : "http://{{host}}:{{ports[http][0]}}/",
+ "referrerPolicy" : "origin-only",
+ "mode" : "same-origin",
+ "credentials" : "include",
+ "cache" : "no-cache",
+ "redirect" : "error",
+ "integrity" : "Request's Integrity",
+ "headers" : headers,
+ "body" : "Request's body"
+ };
+
+ var expectedInitialized = {"method" : "POST",
+ "referrer" : "http://{{host}}:{{ports[http][0]}}/",
+ "referrerPolicy" : "origin-only",
+ "mode" : "same-origin",
+ "credentials" : "include",
+ "cache" : "no-cache",
+ "redirect" : "error",
+ "integrity" : "Request's Integrity",
+ "headers" : headers,
+ "body" : "Request's body"
+ };
+
+ test(function() {
+ var RequestInitialized = new Request("", initValuesDict);
+ var requestToCheck = RequestInitialized.clone();
+ checkRequest(requestToCheck, expectedInitialized);
+ }, "Check cloning a request");
+ </script>
+ </body>
+</html>
diff --git a/tests/wpt/web-platform-tests/fetch/api/request/request-consume.html b/tests/wpt/web-platform-tests/fetch/api/request/request-consume.html
new file mode 100644
index 00000000000..d0f756dc402
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/request/request-consume.html
@@ -0,0 +1,89 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Request consume</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#request">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#body-mixin">
+ <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>
+ function checkBodyText(request, expectedBody) {
+ return request.text().then( function(bodyAsText) {
+ assert_equals(bodyAsText, expectedBody, "Retrieve and verify request's body");
+ assert_true(request.bodyUsed, "body as text: bodyUsed turned true");
+ });
+ }
+
+ function checkBodyBlob(request, expectedBody) {
+ return request.blob().then(function(bodyAsBlob) {
+ var promise = new Promise(function (resolve, reject) {
+ var reader = new FileReader();
+ reader.onload = function(evt) {
+ resolve(reader.result)
+ };
+ reader.onerror = function() {
+ reject("Blob's reader failed");
+ };
+ reader.readAsText(bodyAsBlob);
+ });
+ return promise.then(function(body) {
+ assert_equals(body, expectedBody, "Retrieve and verify request's body");
+ assert_true(request.bodyUsed, "body as blob: bodyUsed turned true");
+ });
+ });
+ }
+
+ <!-- Taken from https://developers.google.com -->
+ function str2ab(str) {
+ var buf = new ArrayBuffer(str.length*2); // 2 bytes for each char
+ var bufView = new Uint16Array(buf);
+ for (var i=0, strLen=str.length; i < strLen; i++) {
+ bufView[i] = str.charCodeAt(i);
+ }
+ return buf;
+ }
+
+ function checkBodyArrayBuffer(request, expectedBody) {
+ return request.arrayBuffer().then( function(bodyAsArrayBuffer) {
+ assert_array_equals(bodyAsArrayBuffer, str2ab(expectedBody), "Retrieve and verify request's body");
+ assert_true(request.bodyUsed, "body as arrayBuffer: bodyUsed turned true");
+ });
+ }
+
+ function checkBodyJSON(request, expectedBody) {
+ return request.json().then(function(bodyAsJSON) {
+ var strBody = JSON.stringify(bodyAsJSON)
+ assert_equals(strBody, expectedBody, "Retrieve and verify request's body");
+ assert_true(request.bodyUsed, "body as json: bodyUsed turned true");
+ });
+ }
+
+ function checkBodyFormData(request, expectedBody) {
+ return request.formData().then(function(bodyAsFormData) {
+ assert_true(bodyAsFormData instanceof FormData, "Should receive a FormData");
+ assert_true(request.bodyUsed, "body as formData: bodyUsed turned true");
+ });
+ }
+
+ function checkRequestBody(body, bodyType, checkFunction) {
+ promise_test(function(test) {
+ var request = new Request("", {"method": "POST", "body": body });
+ assert_false(request.bodyUsed, "bodyUsed is false at init");
+ return checkFunction(request, body);
+ }, "Consume request's body as " + bodyType);
+ }
+
+ var formData = new FormData();
+ formData.append("name", "value")
+ checkRequestBody("This is request's body", "text", checkBodyText);
+ checkRequestBody("This is request's body", "blob", checkBodyBlob);
+ checkRequestBody("This is request's body", "arrayBuffer", checkBodyArrayBuffer);
+ checkRequestBody(JSON.stringify("This is request's body"), "json", checkBodyJSON);
+ checkRequestBody(formData, "formData", checkBodyFormData);
+ </script>
+ </body>
+</html>
diff --git a/tests/wpt/web-platform-tests/fetch/api/request/request-disturbed.html b/tests/wpt/web-platform-tests/fetch/api/request/request-disturbed.html
new file mode 100644
index 00000000000..958def41768
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/request/request-disturbed.html
@@ -0,0 +1,55 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Request disturbed</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#request">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#body-mixin">
+ <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>
+ var initValuesDict = {"method" : "POST",
+ "body" : "Request's body"
+ };
+
+ var noBodyConsumed = new Request("");
+ noBodyConsumed.blob();
+ var bodyConsumed = new Request("", initValuesDict);
+ bodyConsumed.blob();
+
+ test(function() {
+ assert_false(noBodyConsumed.bodyUsed , "bodyUsed is false when request is not disturbed");
+ try {
+ noBodyConsumed.clone();
+ } catch (e) {
+ assert_unreached("Can use request not disturbed for creating or cloning request");
+ }
+ }, "Request without body cannot be disturbed");
+
+ test(function() {
+ assert_true(bodyConsumed.bodyUsed , "bodyUsed is true when request is disturbed");
+ assert_throws(new TypeError(), function() { bodyConsumed.clone(); });
+ }, "Check cloning a disturbed request");
+
+ test(function() {
+ assert_true(bodyConsumed.bodyUsed , "bodyUsed is true when request is disturbed");
+ assert_throws(new TypeError(), function() { new Request(bodyConsumed); });
+ }, "Check creating a new request from a disturbed request");
+
+ test(function() {
+ var bodyRequest = new Request("", initValuesDict);
+ assert_false(bodyRequest.bodyUsed , "bodyUsed is false when request is not disturbed");
+ var requestFromRequest = new Request(bodyRequest);
+ assert_true(bodyRequest.bodyUsed , "bodyUsed is true when request is disturbed");
+ }, "Input request used for creating new request became disturbed");
+
+ promise_test(function(test) {
+ assert_true(bodyConsumed.bodyUsed , "bodyUsed is true when request is disturbed");
+ return promise_rejects(test, new TypeError(), bodyConsumed.blob());
+ }, "Check consuming a disturbed request");
+ </script>
+ </body>
+</html>
diff --git a/tests/wpt/web-platform-tests/fetch/api/request/request-error.html b/tests/wpt/web-platform-tests/fetch/api/request/request-error.html
new file mode 100644
index 00000000000..51db7378e92
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/request/request-error.html
@@ -0,0 +1,104 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Request error</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#request">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#body-mixin">
+ <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>
+ test(function() {
+ assert_throws(new TypeError() , function() { new Request("", {"window" : "http://test.url"}); },
+ "Expect TypeError exception");
+ },"RequestInit's window is not null");
+
+ test(function() {
+ assert_throws(new TypeError() , function() { new Request("http://:not a valid URL"); },
+ "Expect TypeError exception");
+ },"Input URL is not valid")
+
+ test(function() {
+ assert_throws(new TypeError() , function() { new Request("http://user:pass@test.url"); },
+ "Expect TypeError exception");
+ },"Input URL has credentials");
+
+ test(function() {
+ assert_throws(new TypeError() , function() { new Request("", {"mode" : "navigate"}); },
+ "Expect TypeError exception");
+ },"RequestInit's mode is navigate");
+
+ test(function() {
+ assert_throws(new TypeError() , function() { new Request("", {"referrer" : "http://:not a valid URL"}); },
+ "Expect TypeError exception");
+ },"RequestInit's referrer is invalid");
+
+ test(function() {
+ assert_throws(new TypeError() , function() { new Request("", {"referrer" : "http://test.url"}); },
+ "Expect TypeError exception");
+ },"RequestInit's referrer has invalid origin")
+
+ test(function() {
+ assert_throws(new TypeError() , function() { new Request("", {"method" : "IN VALID"}); },
+ "Expect TypeError exception");
+ }, "RequestInit's method is invalid");
+
+ test(function() {
+ assert_throws(new TypeError() , function() { new Request("", {"method" : "TRACE"}); },
+ "Expect TypeError exception");
+ }, "RequestInit's method is forbidden");
+
+ test(function() {
+ assert_throws(new TypeError() , function() { new Request("", {"mode" : "no-cors", "method" : "PUT"}); },
+ "Expect TypeError exception");
+ },"RequestInit's mode is no-cors and method is not simple");
+
+ test(function() {
+ assert_throws(new TypeError() ,
+ function() { new Request("", {"mode" : "no-cors", "integrity" : "not an empty string"}); },
+ "Expect TypeError exception");
+ },"RequestInit's mode is no-cors and integrity is not empty");
+
+ test(function() {
+ var initialHeaders = new Headers([["Content-Type", "potato"]]);
+ var initialRequest = new Request("", {"headers" : initialHeaders});
+ var request = new Request(initialRequest);
+ assert_equals(request.headers.get("Content-Type"), "potato");
+ }, "Request should get its content-type from the init request");
+
+ test(function() {
+ var initialHeaders = new Headers([["Content-Type", "potato"]]);
+ var initialRequest = new Request("", {"headers" : initialHeaders});
+ var headers = new Headers([]);
+ var request = new Request(initialRequest, {"headers" : headers});
+ assert_false(request.headers.has("Content-Type"));
+ }, "Request should not get its content-type from the init request if init headers are provided");
+
+ test(function() {
+ var initialHeaders = new Headers([["Content-Type-Extra", "potato"]]);
+ var initialRequest = new Request("", {"headers" : initialHeaders, "body" : "this is my plate", "method" : "POST"});
+ var request = new Request(initialRequest);
+ assert_equals(request.headers.get("Content-Type"), "text/plain;charset=UTF-8");
+ }, "Request should get its content-type from the body if none is provided");
+
+ test(function() {
+ var initialHeaders = new Headers([["Content-Type", "potato"]]);
+ var initialRequest = new Request("", {"headers" : initialHeaders, "body" : "this is my plate", "method" : "POST"});
+ var request = new Request(initialRequest);
+ assert_equals(request.headers.get("Content-Type"), "potato");
+ }, "Request should get its content-type from init headers if one is provided");
+
+ var parameters = ["referrerPolicy", "mode", "credentials", "cache", "redirect"];
+ parameters.forEach(function(parameter) {
+ test(function() {
+ var options = { };
+ options[parameter] = "BAD";
+ assert_throws(new TypeError(), function() { new Request("", options); });
+ },"Bad " + parameter +" init parameter value");
+ });
+ </script>
+ </body>
+</html>
diff --git a/tests/wpt/web-platform-tests/fetch/api/request/request-idl.html b/tests/wpt/web-platform-tests/fetch/api/request/request-idl.html
new file mode 100644
index 00000000000..0faefee3aa4
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/request/request-idl.html
@@ -0,0 +1,85 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Request idl interface</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#response">
+ <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>
+ <script src="/resources/WebIDLParser.js"></script>
+ <script src="/resources/idlharness.js"></script>
+ </head>
+ <body>
+ <script id="body-idl" type="text/plain">
+ typedef any JSON;
+ typedef (Blob or BufferSource or FormData or URLSearchParams or USVString) BodyInit;
+
+ [NoInterfaceObject,
+ Exposed=(Window,Worker)]
+ interface Body {
+ readonly attribute boolean bodyUsed;
+ [NewObject] Promise<ArrayBuffer> arrayBuffer();
+ [NewObject] Promise<Blob> blob();
+ [NewObject] Promise<FormData> formData();
+ [NewObject] Promise<JSON> json();
+ [NewObject] Promise<USVString> text();
+ };
+ </script>
+ <script id="request-idl" type="text/plain">
+ typedef (Request or USVString) RequestInfo;
+
+ [Constructor(RequestInfo input, optional RequestInit init),
+ Exposed=(Window,Worker)]
+ interface Request {
+ readonly attribute ByteString method;
+ readonly attribute USVString url;
+ [SameObject] readonly attribute Headers headers;
+
+ readonly attribute RequestType type;
+ readonly attribute RequestDestination destination;
+ readonly attribute USVString referrer;
+ readonly attribute ReferrerPolicy referrerPolicy;
+ readonly attribute RequestMode mode;
+ readonly attribute RequestCredentials credentials;
+ readonly attribute RequestCache cache;
+ readonly attribute RequestRedirect redirect;
+ readonly attribute DOMString integrity;
+
+ [NewObject] Request clone();
+ };
+ Request implements Body;
+
+ dictionary RequestInit {
+ ByteString method;
+ HeadersInit headers;
+ BodyInit? body;
+ USVString referrer;
+ ReferrerPolicy referrerPolicy;
+ RequestMode mode;
+ RequestCredentials credentials;
+ RequestCache cache;
+ RequestRedirect redirect;
+ DOMString integrity;
+ any window; // can only be set to null
+ };
+
+ enum RequestType { "", "audio", "font", "image", "script", "style", "track", "video" };
+ enum RequestDestination { "", "document", "sharedworker", "subresource", "unknown", "worker" };
+ enum RequestMode { "navigate", "same-origin", "no-cors", "cors" };
+ enum RequestCredentials { "omit", "same-origin", "include" };
+ enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" };
+ enum RequestRedirect { "follow", "error", "manual" };
+ </script>
+ <script>
+ var idlsArray = new IdlArray();
+ var idl = document.getElementById("body-idl").innerHTML
+ idl += document.getElementById("request-idl").innerHTML
+
+ idlsArray.add_idls(idl);
+ idlsArray.add_untested_idls("interface Headers {};");
+ idlsArray.add_objects({ Request: ['new Request("")'] });
+ idlsArray.test();
+ </script>
+ </body>
+</html>
diff --git a/tests/wpt/web-platform-tests/fetch/api/request/request-init-001.sub.html b/tests/wpt/web-platform-tests/fetch/api/request/request-init-001.sub.html
new file mode 100644
index 00000000000..92206b45128
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/request/request-init-001.sub.html
@@ -0,0 +1,92 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Request init: simple cases</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#request">
+ <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>
+ var methods = {"givenValues" : ["GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS", "head"],
+ "expectedValues" : ["GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS", "HEAD"]
+ };
+ var referrers = {"givenValues" : ["/relative/ressource",
+ "http://{{host}}:{{ports[http][0]}}/relative/ressource?query=true#fragment",
+ "http://{{host}}:{{ports[http][0]}}/",
+ "about:client",
+ ""
+ ],
+ "expectedValues" : ["http://{{host}}:{{ports[http][0]}}/relative/ressource",
+ "http://{{host}}:{{ports[http][0]}}/relative/ressource?query=true#fragment",
+ "http://{{host}}:{{ports[http][0]}}/",
+ "about:client",
+ ""
+ ]
+ };
+ var referrerPolicies = {"givenValues" : [ "",
+ "no-referrer",
+ "no-referrer-when-downgrade",
+ "origin-only",
+ "origin-when-cross-origin",
+ "unsafe-url"
+ ],
+ "expectedValues" : ["",
+ "no-referrer",
+ "no-referrer-when-downgrade",
+ "origin-only",
+ "origin-when-cross-origin",
+ "unsafe-url"
+ ]
+ };
+ var modes = {"givenValues" : ["same-origin", "no-cors", "cors"],
+ "expectedValues" : ["same-origin", "no-cors", "cors"]
+ };
+ var credentials = {"givenValues" : ["omit", "same-origin", "include"],
+ "expectedValues" : ["omit", "same-origin", "include"]
+ };
+ var caches = {"givenValues" : [ "default", "no-store", "reload", "no-cache", "force-cache"],
+ "expectedValues" : [ "default", "no-store", "reload", "no-cache", "force-cache"]
+ };
+ var redirects = {"givenValues" : ["follow", "error", "manual"],
+ "expectedValues" : ["follow", "error", "manual"]
+ };
+ var integrities = {"givenValues" : ["", "AZERTYUIOP1234567890" ],
+ "expectedValues" : ["", "AZERTYUIOP1234567890"]
+ };
+
+ //there is no getter for window, init's window might be null
+ var windows = {"givenValues" : [ null ],
+ "expectedValues" : [undefined]
+ };
+
+ var initValuesDict = { "method" : methods,
+ "referrer" : referrers,
+ "referrerPolicy" : referrerPolicies,
+ "mode" : modes,
+ "credentials" : credentials,
+ "cache" : caches,
+ "redirect" : redirects,
+ "integrity" : integrities,
+ "window" : windows
+ };
+
+ for (var attributeName in initValuesDict) {
+ var valuesToTest = initValuesDict[attributeName];
+ for (var valueIdx in valuesToTest["givenValues"]) {
+ var givenValue = valuesToTest["givenValues"][valueIdx];
+ var expectedValue = valuesToTest["expectedValues"][valueIdx];
+ test(function() {
+ var requestInit = {};
+ requestInit[attributeName] = givenValue
+ var request = new Request("", requestInit);
+ assert_equals(request[attributeName], expectedValue,
+ "Expect request's " + attributeName + " is " + expectedValue + " when initialized with " + givenValue);
+ }, "Check " + attributeName + " init value of " + givenValue + " and associated getter");
+ }
+ }
+ </script>
+ </body>
+</html>
diff --git a/tests/wpt/web-platform-tests/fetch/api/request/request-init-002.html b/tests/wpt/web-platform-tests/fetch/api/request/request-init-002.html
new file mode 100644
index 00000000000..46246c11eaf
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/request/request-init-002.html
@@ -0,0 +1,62 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Request init: headers and body</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#request">
+ <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>
+ test(function() {
+ var headerDict = {"name1": "value1",
+ "name2": "value2",
+ "name3": "value3"
+ };
+ var headers = new Headers(headerDict);
+ var request = new Request("", { "headers" : headers })
+ for (var name in headerDict) {
+ assert_equals(request.headers.get(name), headerDict[name],
+ "request's headers has " + name + " : " + headerDict[name]);
+ }
+ }, "Initialize Request with headers values");
+
+ function checkRequestInit(body, bodyType, expectedTextBody) {
+ promise_test(function(test) {
+ var request = new Request("", {"method": "POST", "body": body});
+ assert_throws(new TypeError(),
+ function() { new Request("", {"method": "GET", "body": body}); }
+ );
+ var reqHeaders = request.headers;
+ var mime = reqHeaders.get("Content-Type");
+ assert_true(mime && mime.search(bodyType) > -1, "Content-Type header should be \"" + bodyType + "\", not \"" + mime + "\"");
+ return request.text().then(function(bodyAsText) {
+ //not equals: cannot guess formData exact value
+ assert_true( bodyAsText.search(expectedTextBody) > -1, "Retrieve and verify request body");
+ });
+ }, "Initialize Response's body with " + bodyType);
+ }
+
+ var blob = new Blob(["This is a blob"], {type: "application/octet-binary"});
+ var formaData = new FormData();
+ formaData.append("name", "value");
+ var usvString = "This is a USVString"
+
+ checkRequestInit(blob, "application/octet-binary", "This is a blob");
+ checkRequestInit(formaData, "multipart/form-data", "name=\"name\"\r\n\r\nvalue");
+ checkRequestInit(usvString, "text/plain;charset=UTF-8", "This is a USVString");
+
+ // Ensure test does not time out in case of missing URLSearchParams support.
+ if (window.URLSearchParams) {
+ var urlSearchParams = new URLSearchParams("name=value");
+ checkRequestInit(urlSearchParams, "application/x-www-form-urlencoded;charset=UTF-8", "name=value");
+ } else {
+ promise_test(function(test) {
+ return Promise.reject("URLSearchParams not supported");
+ }, "Initialize Response's body with application/x-www-form-urlencoded;charset=UTF-8");
+ }
+ </script>
+ </body>
+</html>
diff --git a/tests/wpt/web-platform-tests/fetch/api/request/request-init-003.sub.html b/tests/wpt/web-platform-tests/fetch/api/request/request-init-003.sub.html
new file mode 100644
index 00000000000..41bafebb18d
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/request/request-init-003.sub.html
@@ -0,0 +1,84 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Request: init with request or url</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#request">
+ <meta name="help" href="https://url.spec.whatwg.org/#concept-url-serializer">
+ <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>
+ var headers = new Headers( {"name":"value"} );
+ var emptyHeaders = new Headers();
+
+ var initValuesDict = {"method" : "POST",
+ "referrer" : "http://{{host}}:{{ports[http][0]}}/",
+ "referrerPolicy" : "origin-only",
+ "mode" : "same-origin",
+ "credentials" : "include",
+ "cache" : "no-cache",
+ "redirect" : "error",
+ "integrity" : "Request's Integrity",
+ "headers" : headers,
+ "body" : "Request's body"
+ };
+
+ var expectedInitialized = {"method" : "POST",
+ "referrer" : "http://{{host}}:{{ports[http][0]}}/",
+ "referrerPolicy" : "origin-only",
+ "mode" : "same-origin",
+ "credentials" : "include",
+ "cache" : "no-cache",
+ "redirect" : "error",
+ "integrity" : "Request's Integrity",
+ "headers" : headers,
+ "body" : "Request's body"
+ };
+
+ var expectedDefault = {"method" : "GET",
+ "url" : location.href,
+ "referrer" : "http://{{host}}:{{ports[http][0]}}/",
+ "referrerPolicy" : "",
+ "mode" : "cors",
+ "credentials" : "omit",
+ "cache" : "default",
+ "redirect" : "follow",
+ "integrity" : "",
+ "headers" : emptyHeaders
+ };
+
+ var requestDefault = new Request("");
+ var requestInitialized = new Request("", initValuesDict);
+
+ test(function() {
+ var requestToCheck = new Request(requestInitialized);
+ checkRequest(requestToCheck, expectedInitialized);
+ }, "Check request values when initialized from Request");
+
+ test(function() {
+ var requestToCheck = new Request(requestDefault, initValuesDict);
+ checkRequest(requestToCheck, expectedInitialized);
+ }, "Check request values when initialized from Request and init values");
+
+ test(function() {
+ var url = "http://url.test:1234/path/subpath?query=true";
+ expectedDefault["url"] = url;
+ url += "#fragment";
+ var requestToCheck = new Request(url);
+ checkRequest(requestToCheck, expectedDefault);
+ }, "Check request values when initialized from url string");
+
+ test(function() {
+ var url = "http://url.test:1234/path/subpath?query=true";
+ expectedInitialized["url"] = url;
+ url += "#fragment";
+ var requestToCheck = new Request(url , initValuesDict);
+ checkRequest(requestToCheck, expectedInitialized);
+ }, "Check request values when initialized from url and init values");
+ </script>
+ </body>
+</html>
diff --git a/tests/wpt/web-platform-tests/fetch/api/request/request-structure.html b/tests/wpt/web-platform-tests/fetch/api/request/request-structure.html
new file mode 100644
index 00000000000..2d7d4dba7bf
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/request/request-structure.html
@@ -0,0 +1,132 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Request structure</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#request">
+ <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>
+ var request = new Request("");
+ var methods = ["clone",
+ //Request implements Body
+ "arrayBuffer",
+ "blob",
+ "formData",
+ "json",
+ "text"
+ ];
+ var attributes = ["method",
+ "url",
+ "headers",
+ "type",
+ "destination",
+ "referrer",
+ "referrerPolicy",
+ "mode",
+ "credentials",
+ "cache",
+ "redirect",
+ "integrity",
+ //Request implements Body
+ "bodyUsed"
+ ];
+
+ function IsreadOnly(request, attributeToCheck) {
+ var defaultValue = undefined;
+ var newValue = undefined;
+ switch (attributeToCheck) {
+ case "method":
+ defaultValue = "GET";
+ newValue = "POST";
+ break;
+
+ case "url":
+ //default value is base url
+ //i.e http://web-platform.test:8000/fetch/api/request-structure.html
+ newValue = "http://url.test";
+ break;
+
+ case "headers":
+ request.headers = new Headers ( {"name":"value"} );
+ assert_false(request.headers.has("name"), "Headers attribute is read only");
+ return;
+ break;
+
+ case "type":
+ defaultValue = "";
+ newValue = "style";
+ break;
+
+ case "destination":
+ defaultValue = "";
+ newValue = "worker";
+ break;
+
+ case "referrer":
+ defaultValue = "about:client";
+ newValue = "http://url.test";
+ break;
+
+ case "referrerPolicy":
+ defaultValue = "";
+ newValue = "unsafe-url";
+ break;
+
+ case "mode":
+ defaultValue = "cors";
+ newValue = "navigate";
+ break;
+
+ case "credentials":
+ defaultValue = "omit";
+ newValue = "cors";
+ break;
+
+ case "cache":
+ defaultValue = "default";
+ newValue = "reload";
+ break;
+
+ case "redirect":
+ defaultValue = "follow";
+ newValue = "manual";
+ break;
+
+ case "integrity":
+ newValue = "CannotWriteIntegrity";
+ break;
+
+ case "bodyUsed":
+ defaultValue = false;
+ newValue = true;
+ break;
+
+ default:
+ return;
+ }
+
+ request[attributeToCheck] = newValue;
+ if (defaultValue === undefined)
+ assert_not_equals(request[attributeToCheck], newValue, "Attribute " + attributeToCheck + " is read only");
+ else
+ assert_equals(request[attributeToCheck], defaultValue,
+ "Attribute " + attributeToCheck + " is read only. Default value is " + defaultValue);
+ }
+
+ for (var idx in methods)
+ test(function() {
+ assert_true(methods[idx] in request, "request has " + methods[idx] + " method");
+ }, "Request has " + methods[idx] + " method");
+
+ for (var idx in attributes)
+ test(function() {
+ assert_true(attributes[idx] in request, "request has " + attributes[idx] + " attribute");
+ IsreadOnly(request, attributes[idx]);
+ }, "Check " + attributes[idx] + " attribute");
+ </script>
+ </body>
+</html>
diff --git a/tests/wpt/web-platform-tests/fetch/api/resources/authentication.py b/tests/wpt/web-platform-tests/fetch/api/resources/authentication.py
new file mode 100644
index 00000000000..a06d179e58e
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/resources/authentication.py
@@ -0,0 +1,15 @@
+def main(request, response):
+ user = request.auth.username
+ password = request.auth.password
+
+ if user == "user" and password == "password":
+ return "Authentication done"
+
+ realm = "test"
+ if "realm" in request.GET:
+ realm = request.GET.first("realm")
+
+ return ((401, "Unauthorized"),
+ [("WWW-Authenticate", 'Basic realm="' + realm + '"')],
+ "Please login with credentials 'user' and 'password'")
+
diff --git a/tests/wpt/web-platform-tests/fetch/api/resources/clean-stash.py b/tests/wpt/web-platform-tests/fetch/api/resources/clean-stash.py
new file mode 100644
index 00000000000..3ae73105269
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/resources/clean-stash.py
@@ -0,0 +1,6 @@
+def main(request, response):
+ token = request.GET.first("token")
+ if request.server.stash.take(token) is not None:
+ return "1"
+ else:
+ return "0"
diff --git a/tests/wpt/web-platform-tests/fetch/api/resources/inspect-headers.py b/tests/wpt/web-platform-tests/fetch/api/resources/inspect-headers.py
new file mode 100644
index 00000000000..c4ace18ab64
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/resources/inspect-headers.py
@@ -0,0 +1,22 @@
+def main(request, response):
+ headers = []
+ request_headers = []
+ if "headers" in request.GET:
+ checked_headers = request.GET.first("headers").split("|")
+ for header in checked_headers:
+ if header in request.headers:
+ headers.append(("x-request-" + header, request.headers.get(header, "") ))
+
+ if "cors" in request.GET:
+ if "Origin" in request.headers:
+ headers.append(("Access-Control-Allow-Origin", request.headers.get("Origin", "")))
+ else:
+ headers.append(("Access-Control-Allow-Origin", "*"))
+ headers.append(("Access-Control-Allow-Credentials", "true"))
+ headers.append(("Access-Control-Allow-Methods", "GET, POST, HEAD"))
+ exposed_headers = ["x-request-" + header for header in checked_headers]
+ headers.append(("Access-Control-Expose-Headers", ", ".join(exposed_headers)))
+ headers.append(("Access-Control-Allow-Headers", ", ".join(request.headers)))
+
+ headers.append(("content-type", "text/plain"))
+ return headers, ""
diff --git a/tests/wpt/web-platform-tests/fetch/api/resources/method.py b/tests/wpt/web-platform-tests/fetch/api/resources/method.py
new file mode 100644
index 00000000000..db234f9d123
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/resources/method.py
@@ -0,0 +1,11 @@
+def main(request, response):
+ headers = []
+ if "cors" in request.GET:
+ headers.append(("Access-Control-Allow-Origin", "*"))
+ headers.append(("Access-Control-Allow-Credentials", "true"))
+ headers.append(("Access-Control-Allow-Methods", "GET, POST, PUT, FOO"))
+ headers.append(("Access-Control-Allow-Headers", "x-test, x-foo"))
+ headers.append(("Access-Control-Expose-Headers", "x-request-method"))
+
+ headers.append(("x-request-method", request.method))
+ return headers, request.body
diff --git a/tests/wpt/web-platform-tests/fetch/api/resources/preflight.py b/tests/wpt/web-platform-tests/fetch/api/resources/preflight.py
new file mode 100644
index 00000000000..72dceba683d
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/resources/preflight.py
@@ -0,0 +1,56 @@
+def main(request, response):
+ headers = [("Content-Type", "text/plain")]
+ stashed_data = {'control_request_headers': "", 'preflight': "0", 'preflight_referrer': ""}
+
+ if "origin" in request.GET:
+ for origin in request.GET['origin'].split(", "):
+ headers.append(("Access-Control-Allow-Origin", origin))
+ else:
+ headers.append(("Access-Control-Allow-Origin", "*"))
+
+ if request.method == "OPTIONS":
+ if not "Access-Control-Request-Method" in request.headers:
+ response.set_error(400, "No Access-Control-Request-Method header")
+ return "ERROR: No access-control-request-method in preflight!"
+
+ if "control_request_headers" in request.GET:
+ stashed_data['control_request_headers'] = request.headers.get("Access-Control-Request-Headers", "")
+
+ if "max_age" in request.GET:
+ headers.append(("Access-Control-Max-Age", request.GET['max_age']))
+
+ if "allow_headers" in request.GET:
+ headers.append(("Access-Control-Allow-Headers", request.GET['allow_headers']))
+
+ if "allow_methods" in request.GET:
+ headers.append(("Access-Control-Allow-Methods", request.GET['allow_methods']))
+
+ preflight_status = 200
+ if "preflight_status" in request.GET:
+ preflight_status = int(request.GET.first("preflight_status"))
+
+ stashed_data['preflight'] = "1"
+ stashed_data['preflight_referrer'] = request.headers.get("Referer", "")
+ request.server.stash.put(request.GET.first("token"), stashed_data)
+
+ return preflight_status, headers, ""
+
+ token = None
+ if "token" in request.GET:
+ token = request.GET.first("token")
+ data = request.server.stash.take(token)
+ if data:
+ stashed_data = data
+
+ #use x-* headers for returning value to bodyless responses
+ headers.append(("Access-Control-Expose-Headers", "x-did-preflight, x-control-request-headers, x-referrer, x-preflight-referrer, x-origin"))
+ headers.append(("x-did-preflight", stashed_data['preflight']))
+ headers.append(("x-control-request-headers", stashed_data['control_request_headers']))
+ headers.append(("x-preflight-referrer", stashed_data['preflight_referrer']))
+ headers.append(("x-referrer", request.headers.get("Referer", "") ))
+ headers.append(("x-origin", request.headers.get("Origin", "") ))
+
+ if token:
+ request.server.stash.put(token, stashed_data)
+
+ return headers, ""
diff --git a/tests/wpt/web-platform-tests/fetch/api/resources/redirect.py b/tests/wpt/web-platform-tests/fetch/api/resources/redirect.py
new file mode 100644
index 00000000000..3767b223aac
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/resources/redirect.py
@@ -0,0 +1,48 @@
+def main(request, response):
+ stashed_data = {'count': 0, 'preflight': "0"}
+ status = 302
+ headers = [("Content-Type", "text/plain"),
+ ("Cache-Control", "no-cache"),
+ ("Pragma", "no-cache"),
+ ("Access-Control-Allow-Origin", "*")]
+ token = None
+
+ if "token" in request.GET:
+ token = request.GET.first("token")
+ data = request.server.stash.take(token)
+ if data:
+ stashed_data = data
+
+ if request.method == "OPTIONS":
+ if "allow_headers" in request.GET:
+ headers.append(("Access-Control-Allow-Headers", request.GET['allow_headers']))
+ stashed_data['preflight'] = "1"
+ #Preflight is not redirected: return 200
+ if not "redirect_preflight" in request.GET:
+ if token:
+ request.server.stash.put(request.GET.first("token"), stashed_data)
+ return 200, headers, ""
+
+ if "redirect_status" in request.GET:
+ status = int(request.GET['redirect_status'])
+
+ stashed_data['count'] += 1
+
+ #keep url parameters in location
+ url_parameters = "?" + "&".join(map(lambda x: x[0][0] + "=" + x[1][0], request.GET.items()))
+ #make sure location changes during redirection loop
+ url_parameters += "&count=" + str(stashed_data['count'])
+
+ if "location" in request.GET:
+ headers.append(("Location", request.GET['location'] + url_parameters))
+
+ if token:
+ request.server.stash.put(request.GET.first("token"), stashed_data)
+ if "max_count" in request.GET:
+ max_count = int(request.GET['max_count'])
+ #stop redirecting and return count
+ if stashed_data['count'] > max_count:
+ # -1 because the last is not a redirection
+ return str(stashed_data['count'] - 1)
+
+ return status, headers, ""
diff --git a/tests/wpt/web-platform-tests/fetch/api/resources/top.txt b/tests/wpt/web-platform-tests/fetch/api/resources/top.txt
new file mode 100644
index 00000000000..83a3157d14d
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/resources/top.txt
@@ -0,0 +1 @@
+top \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/resources/trickle.py b/tests/wpt/web-platform-tests/fetch/api/resources/trickle.py
new file mode 100644
index 00000000000..0e709445c59
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/resources/trickle.py
@@ -0,0 +1,12 @@
+import time
+
+def main(request, response):
+ delay = float(request.GET.first("ms", 500)) / 1E3
+ count = int(request.GET.first("count", 50))
+ time.sleep(delay)
+ response.headers.set("Content-type", "text/plain")
+ response.write_status_headers()
+ time.sleep(delay);
+ for i in xrange(count):
+ response.writer.write_content("TEST_TRICKLE\n")
+ time.sleep(delay)
diff --git a/tests/wpt/web-platform-tests/fetch/api/resources/utils.js b/tests/wpt/web-platform-tests/fetch/api/resources/utils.js
new file mode 100644
index 00000000000..a090e1eebd5
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/resources/utils.js
@@ -0,0 +1,68 @@
+var inWorker = false;
+var RESOURCES_DIR = "../resources/";
+
+try {
+ inWorker = !(self instanceof Window);
+} catch (e) {
+ inWorker = true;
+}
+
+function dirname(path) {
+ return path.replace(/\/[^\/]*$/, '/')
+}
+
+function checkRequest(request, ExpectedValuesDict) {
+ for (var attribute in ExpectedValuesDict) {
+ switch(attribute) {
+ case "headers":
+ for (var key of ExpectedValuesDict["headers"].keys()) {
+ assert_equals(request["headers"].get(key), ExpectedValuesDict["headers"].get(key),
+ "Check headers attribute has " + key + ":" + ExpectedValuesDict["headers"].get(key));
+ }
+ break;
+
+ case "body":
+ //for checking body's content, a dedicated asyncronous/promise test should be used
+ assert_true(request["headers"].has("Content-Type") , "Check request has body using Content-Type header")
+ break;
+
+ case "method":
+ case "referrer":
+ case "referrerPolicy":
+ case "credentials":
+ case "cache":
+ case "redirect":
+ case "integrity":
+ case "url":
+ case "destination":
+ assert_equals(request[attribute], ExpectedValuesDict[attribute], "Check " + attribute + " attribute")
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+//check reader's text content in an asyncronous test
+function readTextStream(reader, asyncTest, expectedValue, retrievedText) {
+ if (!retrievedText)
+ retrievedText = "";
+ reader.read().then(function(data) {
+ if (!data.done) {
+ var decoder = new TextDecoder();
+ retrievedText += decoder.decode(data.value);
+ readTextStream(reader, asyncTest, expectedValue, retrievedText);
+ return;
+ }
+ asyncTest.step(function() {
+ assert_equals(retrievedText, expectedValue, "Retrieve and verify stream");
+ asyncTest.done();
+ });
+ }).catch(function(e) {
+ asyncTest.step(function() {
+ assert_unreached("Cannot read stream " + e);
+ asyncTest.done();
+ });
+ });
+}
diff --git a/tests/wpt/web-platform-tests/fetch/api/response/response-clone.html b/tests/wpt/web-platform-tests/fetch/api/response/response-clone.html
new file mode 100644
index 00000000000..8afcf36d831
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/response/response-clone.html
@@ -0,0 +1,66 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Response clone</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#response">
+ <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>
+ var defaultValues = { "type" : "default",
+ "url" : "",
+ "ok" : true,
+ "status" : 200,
+ "statusText" : "OK"
+ };
+
+ var response = new Response();
+ var clonedResponse = response.clone();
+ test(function() {
+ for (var attributeName in defaultValues) {
+ var expectedValue = defaultValues[attributeName];
+ assert_equals(clonedResponse[attributeName], expectedValue,
+ "Expect default response." + attributeName + " is " + expectedValue);
+ }
+ }, "Check Response's clone with default values, without body");
+
+ var body = "This is response body";
+ var headersInit = { "name" : "value" };
+ var responseInit = { "status" : 200,
+ "statusText" : "GOOD",
+ "headers" : headersInit
+ };
+ var response = new Response(body, responseInit);
+ var clonedResponse = response.clone();
+ test(function() {
+ assert_equals(clonedResponse.status, responseInit["status"],
+ "Expect response.status is " + responseInit["status"]);
+ assert_equals(clonedResponse.statusText, responseInit["statusText"],
+ "Expect response.statusText is " + responseInit["statusText"]);
+ assert_equals(clonedResponse.headers.get("name"), "value",
+ "Expect response.headers has name:value header");
+ }, "Check Response's clone has the expected attribute values");
+
+ async_test(function(test) {
+ readTextStream(response.body.getReader(), test, body);
+ }, "Check orginal response's body after cloning");
+
+ async_test(function(test) {
+ readTextStream(clonedResponse.body.getReader(), test, body);
+ }, "Check cloned response's body");
+
+ promise_test(function(test) {
+ var disturbedResponse = new Response();
+ return disturbedResponse.text().then(function() {
+ assert_true(disturbedResponse.bodyUsed, "response is disturbed");
+ assert_throws(new TypeError() , function() { disturbedResponse.clone(); },
+ "Expect TypeError exception");
+ });
+ }, "Cannot clone a disturbed response");
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/response/response-consume.html b/tests/wpt/web-platform-tests/fetch/api/response/response-consume.html
new file mode 100644
index 00000000000..14dcad795c2
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/response/response-consume.html
@@ -0,0 +1,81 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Response consume</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#response">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#body-mixin">
+ <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>
+ function checkBodyText(response, expectedBody) {
+ return response.text().then( function(bodyAsText) {
+ assert_equals(bodyAsText, expectedBody, "Retrieve and verify response's body");
+ assert_true(response.bodyUsed, "body as text: bodyUsed turned true");
+ });
+ }
+
+ function checkBodyBlob(response, expectedBody) {
+ return response.blob().then(function(bodyAsBlob) {
+ var promise = new Promise( function (resolve, reject) {
+ var reader = new FileReader();
+ reader.onload = function(evt) {
+ resolve(reader.result)
+ };
+ reader.onerror = function () {
+ reject("Blob's reader failed");
+ };
+ reader.readAsText(bodyAsBlob);
+ });
+ return promise.then(function(body) {
+ assert_equals(body, expectedBody, "Retrieve and verify response's body");
+ assert_true(response.bodyUsed, "body as blob: bodyUsed turned true");
+ });
+ });
+ }
+
+ function checkBodyArrayBuffer(response, expectedBody) {
+ return response.arrayBuffer().then( function(bodyAsArrayBuffer) {
+ var decoder = new TextDecoder("utf-8");
+ var strBody = decoder.decode(bodyAsArrayBuffer);
+ assert_equals(strBody, expectedBody, "Retrieve and verify response's body");
+ assert_true(response.bodyUsed, "body as arrayBuffer: bodyUsed turned true");
+ });
+ }
+
+ function checkBodyJson(response, expectedBody) {
+ return response.json().then(function(bodyAsJson) {
+ var strBody = JSON.stringify(bodyAsJson)
+ assert_equals(strBody, expectedBody, "Retrieve and verify response's body");
+ assert_true(response.bodyUsed, "body as json: bodyUsed turned true");
+ });
+ }
+
+ function checkBodyFormData(response, expectedBody) {
+ return response.formData().then(function(bodyAsFormData) {
+ assert_true(bodyAsFormData instanceof FormData, "Should receive a FormData");
+ assert_true(response.bodyUsed, "body as formData: bodyUsed turned true");
+ });
+ }
+
+ function checkResponseBody(body, bodyType, checkFunction) {
+ promise_test(function(test) {
+ var response = new Response(body);
+ assert_false(response.bodyUsed, "bodyUsed is false at init");
+ return checkFunction(response, body);
+ }, "Consume response's body as " + bodyType);
+ }
+
+ var formData = new FormData();
+ formData.append("name", "value")
+ checkResponseBody("This is response's body", "text", checkBodyText);
+ checkResponseBody("This is response's body", "blob", checkBodyBlob);
+ checkResponseBody("This is response's body", "arrayBuffer", checkBodyArrayBuffer);
+ checkResponseBody(JSON.stringify("This is response's body"), "json", checkBodyJson);
+ checkResponseBody(formData, "formData", checkBodyFormData);
+ </script>
+ </body>
+</html>
diff --git a/tests/wpt/web-platform-tests/fetch/api/response/response-error.html b/tests/wpt/web-platform-tests/fetch/api/response/response-error.html
new file mode 100644
index 00000000000..1e68f6d01c6
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/response/response-error.html
@@ -0,0 +1,39 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Response error</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#response">
+ <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>
+ var invalidStatus = [0, 100, 199, 600, 1000];
+ invalidStatus.forEach(function(status) {
+ test(function() {
+ assert_throws(new RangeError() , function() { new Response("", { "status" : status }); },
+ "Expect RangeError exception when status is " + status);
+ },"Throws RangeError when responseInit's status is " + status);
+ });
+
+ var invalidStatusText = ["\n", "Ā"];
+ invalidStatusText.forEach(function(statusText) {
+ test(function() {
+ assert_throws(new TypeError() , function() { new Response("", { "statusText" : statusText }); },
+ "Expect TypeError exception " + statusText);
+ },"Throws TypeError when responseInit's statusText is " + statusText);
+ });
+
+ var nullBodyStatus = [204, 205, 304];
+ nullBodyStatus.forEach(function(status) {
+ test(function() {
+ assert_throws(new TypeError() ,
+ function() { new Response("body", {"status" : status }); },
+ "Expect TypeError exception ");
+ },"Throws TypeError when building a response with body and a body status of " + status);
+ });
+ </script>
+ </body>
+</html>
diff --git a/tests/wpt/web-platform-tests/fetch/api/response/response-idl.html b/tests/wpt/web-platform-tests/fetch/api/response/response-idl.html
new file mode 100644
index 00000000000..e849856cee3
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/response/response-idl.html
@@ -0,0 +1,69 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Response idl interface</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#response">
+ <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>
+ <script src="/resources/WebIDLParser.js"></script>
+ <script src="/resources/idlharness.js"></script>
+ </head>
+ <body>
+ <script id="body-idl" type="text/plain">
+ typedef any JSON;
+ typedef (Blob or BufferSource or FormData or URLSearchParams or USVString) BodyInit;
+
+ [NoInterfaceObject,
+ Exposed=(Window,Worker)]
+ interface Body {
+ readonly attribute boolean bodyUsed;
+ [NewObject] Promise<ArrayBuffer> arrayBuffer();
+ [NewObject] Promise<Blob> blob();
+ [NewObject] Promise<FormData> formData();
+ [NewObject] Promise<JSON> json();
+ [NewObject] Promise<USVString> text();
+ };
+ </script>
+ <script id="response-idl" type="text/plain">
+ [Constructor(optional BodyInit body, optional ResponseInit init),
+ Exposed=(Window,Worker)]
+ interface Response {
+ [NewObject] static Response error();
+ [NewObject] static Response redirect(USVString url, optional unsigned short status = 302);
+
+ readonly attribute ResponseType type;
+
+ readonly attribute USVString url;
+ readonly attribute unsigned short status;
+ readonly attribute boolean ok;
+ readonly attribute ByteString statusText;
+ [SameObject] readonly attribute Headers headers;
+ readonly attribute ReadableStream? body;
+
+ [NewObject] Response clone();
+ };
+ Response implements Body;
+
+ dictionary ResponseInit {
+ unsigned short status = 200;
+ ByteString statusText = "OK";
+ HeadersInit headers;
+ };
+
+ enum ResponseType { "basic", "cors", "default", "error", "opaque", "opaqueredirect" };
+ </script>
+ <script>
+ var idlsArray = new IdlArray();
+ var idl = document.getElementById("body-idl").innerHTML
+ idl += document.getElementById("response-idl").innerHTML
+
+ idlsArray.add_idls(idl);
+ idlsArray.add_untested_idls("interface Headers {};");
+ idlsArray.add_untested_idls("interface ReadableStream {};");
+ idlsArray.add_objects({ Response: ['new Response()'] });
+ idlsArray.test();
+ </script>
+ </body>
+</html>
diff --git a/tests/wpt/web-platform-tests/fetch/api/response/response-init-001.html b/tests/wpt/web-platform-tests/fetch/api/response/response-init-001.html
new file mode 100644
index 00000000000..e36f90e4c82
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/response/response-init-001.html
@@ -0,0 +1,63 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Response init: simple cases</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#response">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#concept-response">
+ <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>
+ var defaultValues = { "type" : "default",
+ "url" : "",
+ "ok" : true,
+ "status" : 200,
+ "statusText" : "OK",
+ "body" : null
+ };
+
+ var statusCodes = { "givenValues" : [200, 300, 400, 500, 599],
+ "expectedValues" : [200, 300, 400, 500, 599]
+ };
+ var statusTexts = { "givenValues" : ["OK", "with space", String.fromCharCode(0x80)],
+ "expectedValues" : ["OK", "with space", String.fromCharCode(0x80)]
+ };
+ var initValuesDict = { "status" : statusCodes,
+ "statusText" : statusTexts
+ };
+
+ function isOkStatus(status) {
+ return 200 <= status && 299 >= status;
+ }
+
+ var response = new Response();
+ for (var attributeName in defaultValues) {
+ test(function() {
+ var expectedValue = defaultValues[attributeName];
+ assert_equals(response[attributeName], expectedValue,
+ "Expect default response." + attributeName + " is " + expectedValue);
+ }, "Check default value for " + attributeName + " attribute");
+ }
+
+ for (var attributeName in initValuesDict)
+ test(function() {
+ var valuesToTest = initValuesDict[attributeName];
+ for (var valueIdx in valuesToTest["givenValues"]) {
+ var givenValue = valuesToTest["givenValues"][valueIdx];
+ var expectedValue = valuesToTest["expectedValues"][valueIdx];
+ var responseInit = {};
+ responseInit[attributeName] = givenValue;
+ var response = new Response("", responseInit);
+ assert_equals(response[attributeName], expectedValue,
+ "Expect response." + attributeName + " is " + expectedValue +
+ " when initialized with " + givenValue);
+ assert_equals(response.ok, isOkStatus(response.status),
+ "Expect response.ok is " + isOkStatus(response.status));
+ }
+ }, "Check " + attributeName + " init values and associated getter");
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/fetch/api/response/response-init-002.html b/tests/wpt/web-platform-tests/fetch/api/response/response-init-002.html
new file mode 100644
index 00000000000..29008584a85
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/response/response-init-002.html
@@ -0,0 +1,62 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Response init: body and headers</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#response">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#concept-response">
+ <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>
+ test(function() {
+ var headerDict = {"name1": "value1",
+ "name2": "value2",
+ "name3": "value3"
+ };
+ var headers = new Headers(headerDict);
+ var response = new Response("", { "headers" : headers })
+ for (var name in headerDict) {
+ assert_equals(response.headers.get(name), headerDict[name],
+ "response's headers has " + name + " : " + headerDict[name]);
+ }
+ }, "Initialize Response with headers values");
+
+ function checkResponseInit(body, bodyType, expectedTextBody) {
+ promise_test(function(test) {
+ var response = new Response(body);
+ var resHeaders = response.headers;
+ var mime = resHeaders.get("Content-Type");
+ assert_true(mime && mime.search(bodyType) > -1, "Content-Type header should be \"" + bodyType + "\" ");
+ return response.text().then(function(bodyAsText) {
+ //not equals: cannot guess formData exact value
+ assert_true(bodyAsText.search(expectedTextBody) > -1, "Retrieve and verify response body");
+ });
+ }, "Initialize Response's body with " + bodyType);
+ }
+
+ var blob = new Blob(["This is a blob"], {type: "application/octet-binary"});
+ var formaData = new FormData();
+ formaData.append("name", "value");
+ var urlSearchParams = "URLSearchParams are not supported";
+ //avoid test timeout if not implemented
+ if (window.URLSearchParams)
+ urlSearchParams = new URLSearchParams("name=value");
+ var usvString = "This is a USVString"
+
+ checkResponseInit(blob, "application/octet-binary", "This is a blob");
+ checkResponseInit(formaData, "multipart/form-data", "name=\"name\"\r\n\r\nvalue");
+ checkResponseInit(urlSearchParams, "application/x-www-form-urlencoded;charset=UTF-8", "name=value");
+ checkResponseInit(usvString, "text/plain;charset=UTF-8", "This is a USVString");
+
+ async_test(function(test) {
+ var body = "This is response body";
+ var response = new Response(body);
+ readTextStream(response.body.getReader(), test, body);
+ }, "Read Response's body as readableStream");
+ </script>
+ </body>
+</html>
diff --git a/tests/wpt/web-platform-tests/fetch/api/response/response-static-error.html b/tests/wpt/web-platform-tests/fetch/api/response/response-static-error.html
new file mode 100644
index 00000000000..6e927a8bf62
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/response/response-static-error.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Response: error static method</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#response">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#concept-network-error">
+ <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>
+ test(function() {
+ var responseError = Response.error();
+ assert_equals(responseError.type, "error", "Network error response's type is error");
+ assert_equals(responseError.status, 0, "Network error response's status is 0");
+ assert_equals(responseError.statusText, "", "Network error response's statusText is empty");
+ assert_equals(responseError.body, null, "Network error response's body is null");
+
+ assert_true(responseError.headers.entries().next().done, "Headers should be empty");
+ }, "Check response returned by static method error()");
+ </script>
+ </body>
+</html>
diff --git a/tests/wpt/web-platform-tests/fetch/api/response/response-static-redirect.html b/tests/wpt/web-platform-tests/fetch/api/response/response-static-redirect.html
new file mode 100644
index 00000000000..6a50440de36
--- /dev/null
+++ b/tests/wpt/web-platform-tests/fetch/api/response/response-static-redirect.html
@@ -0,0 +1,45 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Response: redirect static method</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#response">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#redirect-status">
+ <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>
+ var url = "http://test.url:1234/";
+ test(function() {
+ redirectResponse = Response.redirect(url);
+ assert_equals(redirectResponse.status, 302, "Default redictect status is 302");
+ assert_equals(redirectResponse.headers.get("Location"), url,
+ "redirected response has Location header with the correct url");
+ }, "Check default redirect response");
+
+ var redirectStatus = [301, 302, 303, 307, 308];
+ redirectStatus.forEach(function(status) {
+ test(function() {
+ redirectResponse = Response.redirect(url, status);
+ assert_equals(redirectResponse.status, status, "Redictect status is " + status);
+ }, "Check response returned by static method redirect(), status = " + status);
+ });
+
+ test(function() {
+ var invalidUrl = "http://:This is not an url";
+ assert_throws(new TypeError(), function() { Response.redirect(invalidUrl); },
+ "Expect TypeError exception");
+ }, "Check error returned when giving invalid url to redirect()");
+
+ var invalidRedirectStatus = [200, 309, 400, 500];
+ invalidRedirectStatus.forEach(function(invalidStatus) {
+ test(function() {
+ assert_throws(new RangeError() , function() { Response.redirect(url, invalidStatus); },
+ "Expect RangeError exception");
+ }, "Check error returned when giving invalid status to redirect(), status = " + invalidStatus);
+ });
+ </script>
+ </body>
+</html>
diff --git a/tests/wpt/web-platform-tests/html/OWNERS b/tests/wpt/web-platform-tests/html/OWNERS
new file mode 100644
index 00000000000..210a621c919
--- /dev/null
+++ b/tests/wpt/web-platform-tests/html/OWNERS
@@ -0,0 +1,7 @@
+@Ms2ger
+@gsnedders
+@jgraham
+@plehegar
+@sideshowbarker
+@zcorpan
+@zqzhang
diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/area-coords.html b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/area-coords.html
new file mode 100644
index 00000000000..9ec6f3e4273
--- /dev/null
+++ b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/area-coords.html
@@ -0,0 +1,47 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>HTMLAreaElement coords parsing</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<style>
+ body { margin: 0 }
+</style>
+<img src=/images/threecolors.png usemap=#x id=img width=300 height=300>
+<map name=x><area id=area></map>
+<script src=support/hit-test.js></script>
+<script>
+tests = [
+ {desc: 'COMMA', shape: 'rect', coords: "2,2,10,10", hit: hitRect},
+ {desc: 'SEMICOLON', shape: 'rect', coords: "2;2;10;10", hit: hitRect},
+ {desc: 'SPACE', shape: 'rect', coords: "2 2 10 10", hit: hitRect},
+ {desc: 'TAB', shape: 'rect', coords: "2\t2\t10\t10", hit: hitRect},
+ {desc: 'FORM FEED', shape: 'rect', coords: "2\f2\f10\f10", hit: hitRect},
+ {desc: 'LINE FEED', shape: 'rect', coords: "2\n2\n10\n10", hit: hitRect},
+ {desc: 'CARRIGAGE RETURN', shape: 'rect', coords: "2\r2\r10\r10", hit: hitRect},
+ {desc: 'LINE TABULATION', shape: 'rect', coords: "2\u000b2\u000b10\u000b10", hit: hitNone},
+ {desc: 'LINE NEXT', shape: 'rect', coords: "2\u00852\u008510\u008510", hit: hitNone},
+ {desc: 'EN QUAD', shape: 'rect', coords: "2\u20002\u200010\u200010", hit: hitNone},
+ {desc: 'abc between numbers', shape: 'rect', coords: "2a2b20c20,2,10,10", hit: hitRect},
+ {desc: 'COLON between numbers', shape: 'rect', coords: "2:2:20:20,2,10,10", hit: hitRect},
+ {desc: 'U+0000 between numbers', shape: 'rect', coords: "2\u00002\u000020\u000020,2,10,10", hit: hitRect},
+ {desc: 'leading COMMA', shape: 'rect', coords: ",2,2,10,10", hit: hitRect},
+ {desc: 'leading SPACE', shape: 'rect', coords: " 2,2,10,10", hit: hitRect},
+ {desc: 'leading SEMICOLON', shape: 'rect', coords: ";2,2,10,10", hit: hitRect},
+ {desc: 'trailing COMMA', shape: 'rect', coords: "2,2,10,", hit: hitNone},
+ {desc: 'trailing SPACE', shape: 'rect', coords: "2,2,10 ", hit: hitNone},
+ {desc: 'trailing SEMICOLON', shape: 'rect', coords: "2,2,10;", hit: hitNone},
+ {desc: 'PERCENT', shape: 'rect', coords: "2%,2%,10%,10%", hit: hitRect},
+ {desc: 'CSS units', shape: 'rect', coords: "2in,2in,10cm,10cm", hit: hitRect},
+ {desc: 'float', shape: 'rect', coords: "1.4,1.4,10,10", hit: hitRect},
+ {desc: 'number starting with PERIOD', shape: 'rect', coords: ".4,.4,10,10", hit: [[area, 1, 1], [img, 0, 0]]},
+ {desc: 'sci-not', shape: 'rect', coords: "2,2,1e1,1e1", hit: hitRect},
+ {desc: 'leading/trailing garbage', shape: 'rect', coords: "='2,2,10,10' ", hit: hitRect},
+ {desc: 'non-ascii garbage', shape: 'rect', coords: "“2,2,10,10\"", hit: hitRect},
+ {desc: 'URL garbage with number', shape: 'rect', coords: "2,2,10ls/spain/holidays/regions/10/Canary+Islands/Canary+Islands.html", hit: hitNone},
+ {desc: 'consecutive COMMAs', shape: 'rect', coords: "2,,10,10", hit: hitNone},
+ {desc: 'consecutive SPACEs', shape: 'rect', coords: "2 10,10", hit: hitNone},
+ {desc: 'consecutive SEMICOLONs', shape: 'rect', coords: "2;;10,10", hit: hitNone},
+ {desc: 'several consecutive separators', shape: 'rect', coords: ",,2;,;2,;,10 \t\r\n10;;", hit: hitRect},
+ {desc: 'one too many numbers, trailing COMMA', shape: 'poly', coords: "100,100,120,100,100,120,300,", hit: hitPoly},
+];
+</script>
diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/area-processing.html b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/area-processing.html
new file mode 100644
index 00000000000..d1c3a83dd85
--- /dev/null
+++ b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/area-processing.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>HTMLAreaElement processing</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<style>
+ body { margin: 0 }
+</style>
+<img src=/images/threecolors.png usemap=#x id=img width=300 height=300>
+<map name=x><area id=area></map>
+<script src=support/hit-test.js></script>
+<script>
+var tests = [
+ {desc: 'too few numbers', shape: 'rect', coords: "2,2,10", hit: hitNone},
+ {desc: 'negative', shape: 'rect', coords: "-10,-10,10,10", hit: [[area, 1, 1], [img, 299, 299]]},
+ {desc: 'empty string', shape: 'rect', coords: "", hit: hitNone},
+ {desc: 'omitted coords', shape: 'rect', coords: null, hit: hitNone},
+ {desc: 'first > third', shape: 'rect', coords: "10,2,2,10", hit: hitRect},
+ {desc: 'second > fourth', shape: 'rect', coords: "2,10,10,2", hit: hitRect},
+ {desc: 'first > third, second > fourth', shape: 'rect', coords: "10,10,2,2", hit: hitRect},
+
+ {desc: 'negative', shape: 'default', coords: "-10,-10,-10,-10", hit: hitAll},
+
+ {desc: 'too few numbers', shape: 'circle', coords: "20,40", hit: hitNone},
+ {desc: 'negative radius', shape: 'circle', coords: "20,40,-10", hit: hitNone},
+ {desc: 'zero radius', shape: 'circle', coords: "20,40,0", hit: hitNone},
+
+ {desc: 'too few numbers', shape: 'poly', coords: "100,100,120,100,100", hit: hitNone},
+ {desc: 'one too many numbers', shape: 'poly', coords: "100,100,120,100,100,120,300", hit: hitPoly},
+ {desc: 'even-odd rule', shape: 'poly', coords: "100,100,200,100,100,200,150,50,200,200", hit: hitStar},
+];
+</script>
diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/area-shape.html b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/area-shape.html
new file mode 100644
index 00000000000..24942273b44
--- /dev/null
+++ b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/area-shape.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>HTMLAreaElement shape</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<style>
+ body { margin: 0 }
+</style>
+<img src=/images/threecolors.png usemap=#x id=img width=300 height=300>
+<map name=x><area id=area></map>
+<script src=support/hit-test.js></script>
+<script>
+var tests = [
+ {desc: 'missing value default', shape: null, coords: "2,2,10,10", hit: hitRect},
+ {desc: 'missing value default', shape: null, coords: "20,40,10", hit: hitNone},
+ {desc: 'missing value default', shape: null, coords: null, hit: hitNone},
+ {desc: 'invalid value default', shape: 'foobar invalid', coords: "2,2,10,10", hit: hitRect},
+ {desc: 'invalid value default', shape: '', coords: "2,2,10,10", hit: hitRect},
+
+ {desc: 'empty string', shape: 'default', coords: "", hit: hitAll},
+ {desc: 'omitted coords', shape: 'DEFAULT', coords: null, hit: hitAll},
+
+ {desc: 'simple', shape: 'circle', coords: "20,40,10", hit: hitCircle},
+ {desc: 'simple', shape: 'circ', coords: "20,40,10", hit: hitCircle},
+ {desc: 'simple', shape: 'CIRCLE', coords: "20,40,10", hit: hitCircle},
+ {desc: 'simple', shape: 'CIRC', coords: "20,40,10", hit: hitCircle},
+ {desc: 'LATIN CAPITAL LETTER I WITH DOT ABOVE', shape: 'C\u0130RCLE', coords: "20,40,10", hit: hitNone},
+ {desc: 'LATIN SMALL LETTER DOTLESS I', shape: 'c\u0131rcle', coords: "20,40,10", hit: hitNone},
+
+ {desc: 'simple', shape: 'poly', coords: "100,100,120,100,100,120", hit: hitPoly},
+ {desc: 'simple', shape: 'polygon', coords: "100,100,120,100,100,120", hit: hitPoly},
+];
+</script>
diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/area_nohref.xhtml b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/area_nohref.xhtml
deleted file mode 100644
index 4af616e0d23..00000000000
--- a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/area_nohref.xhtml
+++ /dev/null
@@ -1,18 +0,0 @@
-<html xmlns='http://www.w3.org/1999/xhtml'>
-<head>
-<title>AREA - NOREF</title>
-</head>
-<body>
-<p>Test for <b>nohref</b> attribute on <b>area</b> </p>
-<p>Hover over the Blue Square below. The square is not clickable but the area around it should be.</p>
-<p>The test passes if clicking on the square doesn't do anything. Clicking on the area around the square should take you to another page.</p>
-<img src="../../../../images/blue-area.png" height="180" width="228" usemap="#square" border="0"/>
-<map name="square">
-<area alt="Blue Square" coords="43,29,176,135" nohref=""/>
-<area shape="rect" alt="White Space" coords="0,0,227,179" href="test-area.xhtml"/>
-</map>
-<p>
-<i>Note - This test checks for User Agent requirement as per HTML5 spec NOT the author requirement</i>
-</p>
-</body>
-</html>
diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/support/hit-test.js b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/support/hit-test.js
new file mode 100644
index 00000000000..54cda3e5cd1
--- /dev/null
+++ b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/support/hit-test.js
@@ -0,0 +1,42 @@
+setup({explicit_done: true});
+
+var img = document.getElementById('img');
+var area = document.getElementById('area');
+
+var hitRect = [[area, 3, 3], [area, 9, 9], [img, 1, 3], [img, 3, 1], [img, 11, 9], [img, 9, 11], [img, 21, 41], [img, 101, 101]];
+var hitNone = [[img, 3, 3], [img, 9, 9], [img, 1, 3], [img, 3, 1], [img, 11, 9], [img, 9, 11], [img, 21, 41], [img, 101, 101]];
+var hitAll = [[area, 1, 1], [area, 1, 299], [area, 299, 1], [area, 299, 299], [area, 21, 41], [area, 101, 101]];
+var hitCircle = [[area, 11, 40], [area, 29, 40], [area, 20, 31], [area, 20, 49], [img, 12, 32], [img, 28, 48], [img, 101, 101]];
+var hitPoly = [[area, 101, 101], [area, 119, 101], [area, 101, 119], [img, 118, 118], [img, 3, 3], [img, 21, 41]];
+var hitStar = [[area, 101, 101], [area, 199, 101], [area, 150, 51], [img, 150, 125], [img, 3, 3], [img, 21, 41]];
+
+var tests;
+// The test file should have `tests` defined as follows:
+// tests = [
+// {desc: string, shape: string?, coords: string?, hit: [[element, x, y], ...]},
+// ...
+// ];
+
+onload = function() {
+ tests.forEach(function(t) {
+ test(function(t_obj) {
+ if (area.shape === null) {
+ area.removeAttribute('shape');
+ } else {
+ area.shape = t.shape;
+ }
+ if (area.coords === null) {
+ area.removeAttribute('coords');
+ } else {
+ area.coords = t.coords;
+ }
+ t.hit.forEach(function(arr) {
+ var expected = arr[0];
+ var x = arr[1];
+ var y = arr[2];
+ assert_equals(document.elementFromPoint(x, y), expected, 'elementFromPoint('+x+', '+y+')');
+ });
+ }, t.desc + ': ' + format_value(t.coords) + ' (' + t.shape + ')');
+ });
+ done();
+};
diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/test-area.xhtml b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/test-area.xhtml
deleted file mode 100644
index baa36c50a6f..00000000000
--- a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-area-element/test-area.xhtml
+++ /dev/null
@@ -1,9 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title> This is a test page</title>
-</head>
-<body>
-This is a simple xhtml page
-<p><a href="area_nohref.xhtml">Click here</a> to go back to the previous page</p>
-</body>
-</html>
diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-embed-element/embed-document.html b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-embed-element/embed-document.html
new file mode 100644
index 00000000000..3dba394baa5
--- /dev/null
+++ b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-embed-element/embed-document.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>HTML Test: The embed element represents a document</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<link rel="stylesheet" href="/resources/testharness.css">
+<meta name="assert" content="Check if the embed element represents a document when a text/html resource source is used">
+<body>
+ <script type="application/javascript">
+ var childLoaded = false;
+ t = async_test("Test document type embedding");
+ addEventListener("load", t.step_func_done(function() { assert_true(childLoaded); }));
+ </script>
+ <embed src="embed-iframe.html">
+</body>
diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-embed-element/embed-iframe.html b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-embed-element/embed-iframe.html
new file mode 100644
index 00000000000..f9b1bfdb57f
--- /dev/null
+++ b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-embed-element/embed-iframe.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<body>
+ <script type="application/javascript">
+ parent.childLoaded = true;
+ </script>
+</body>
diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-input-element/checkbox.html b/tests/wpt/web-platform-tests/html/semantics/forms/the-input-element/checkbox.html
index 1b75d74300a..12f253d67c4 100644
--- a/tests/wpt/web-platform-tests/html/semantics/forms/the-input-element/checkbox.html
+++ b/tests/wpt/web-platform-tests/html/semantics/forms/the-input-element/checkbox.html
@@ -83,9 +83,22 @@
checkbox5.onclick = t5.step_func(function(e) {
e.preventDefault();
- assert_false(checkbox5.checked);
+ /*
+ The prevention of the click doesn't have an effect until after all the
+ click event handlers have been run.
+ */
+ assert_true(checkbox5.checked);
assert_false(checkbox5.indeterminate);
- t5.done();
+ window.setTimeout(t5.step_func(function(e) {
+ /*
+ The click event has finished being dispatched, so the checkedness and
+ determinateness have been toggled back by now because the event
+ was preventDefault-ed.
+ */
+ assert_false(checkbox5.checked);
+ assert_false(checkbox5.indeterminate);
+ t5.done();
+ }), 0);
});
t5.step(function(){
@@ -97,9 +110,22 @@
checkbox6.onclick = t6.step_func(function(e) {
checkbox6.indeterminate = true;
e.preventDefault();
- assert_false(checkbox6.checked);
- assert_false(checkbox6.indeterminate);
- t6.done();
+ /*
+ The prevention of the click doesn't have an effect until after all the
+ click event handlers have been run.
+ */
+ assert_true(checkbox6.checked);
+ assert_true(checkbox6.indeterminate);
+ window.setTimeout(t6.step_func(function(e) {
+ /*
+ The click event has finished being dispatched, so the checkedness and
+ determinateness have been toggled back by now because the event
+ was preventDefault-ed.
+ */
+ assert_false(checkbox6.checked);
+ assert_false(checkbox6.indeterminate);
+ t6.done();
+ }), 0);
});
t6.step(function(){
diff --git a/tests/wpt/web-platform-tests/navigation-timing/test_navigation_type_reload.html b/tests/wpt/web-platform-tests/navigation-timing/test_navigation_type_reload.html
index 0eaa5bf17ec..c10c3bdb9c3 100644
--- a/tests/wpt/web-platform-tests/navigation-timing/test_navigation_type_reload.html
+++ b/tests/wpt/web-platform-tests/navigation-timing/test_navigation_type_reload.html
@@ -57,7 +57,7 @@
//Verify that the navigation type has updated to reload
test_equals(reload_frame.contentWindow.performance.navigation.type,
performanceNamespace.navigation.TYPE_RELOAD,
- 'window.performance.navigation.type == TYPE_RELOAD,{help:"http://www.w3.org/TR/navigation-timing/#sec-navigation-info-interface"}');
+ 'window.performance.navigation.type == TYPE_RELOAD');
//Verify that the timing data has been updated into the future
var reloadTime = reload_frame.contentWindow.performance.timing;
@@ -76,9 +76,9 @@
{
test_greater_than(reloadTime[time],
startingTime[time],
- "Reload " + time + "(" + reloadTime[time] + ")" +
+ "Reload " + time +
" > " +
- "Original " + time + "(" + startingTime[time] + ")");
+ "Original " + time);
}
}
}
diff --git a/tests/wpt/web-platform-tests/notifications/interfaces.html b/tests/wpt/web-platform-tests/notifications/interfaces.html
index 5930086f598..95d648d7ad3 100644
--- a/tests/wpt/web-platform-tests/notifications/interfaces.html
+++ b/tests/wpt/web-platform-tests/notifications/interfaces.html
@@ -20,7 +20,7 @@ typedef EventHandlerNonNull? EventHandler;
[Constructor(DOMString title, optional NotificationOptions options)]
interface Notification : EventTarget {
static readonly attribute NotificationPermission permission;
- static void requestPermission(optional NotificationPermissionCallback callback);
+ static Promise<NotificationPermission> requestPermission(optional NotificationPermissionCallback callback);
attribute EventHandler onclick;
attribute EventHandler onshow;
diff --git a/tests/wpt/web-platform-tests/old-tests/submission/Microsoft/sandbox/iframe_sandbox_002.htm b/tests/wpt/web-platform-tests/old-tests/submission/Microsoft/sandbox/iframe_sandbox_002.htm
index 59b3d16123d..e637847714b 100644
--- a/tests/wpt/web-platform-tests/old-tests/submission/Microsoft/sandbox/iframe_sandbox_002.htm
+++ b/tests/wpt/web-platform-tests/old-tests/submission/Microsoft/sandbox/iframe_sandbox_002.htm
@@ -2,18 +2,16 @@
<html>
<head>
<title>HTML5 video with autoplay attribute.</title>
- <script type="text/javascript" src="/common/media.js"></script>
+ <script src="/common/media.js"></script>
</head>
<body>
- <script type="text/javascript">
-
- function do_play(event)
- {
+ <script>
+ function do_play(event) {
parent.window.postMessage("play event fired", "*");
}
-
+
document.write(
- "<video id='video0' src='" + getVideoURI("/media/green-at-15") + "'" +
+ "<video id='video0' src='" + getVideoURI("/media/green-at-15") + "'" +
" autoplay onplay='do_play(event);'>"
);
</script>
diff --git a/tests/wpt/web-platform-tests/old-tests/submission/Microsoft/sandbox/sandbox_002.htm b/tests/wpt/web-platform-tests/old-tests/submission/Microsoft/sandbox/sandbox_002.htm
index 87049d0c1c0..767518456f0 100644
--- a/tests/wpt/web-platform-tests/old-tests/submission/Microsoft/sandbox/sandbox_002.htm
+++ b/tests/wpt/web-platform-tests/old-tests/submission/Microsoft/sandbox/sandbox_002.htm
@@ -2,33 +2,24 @@
<html>
<head>
<title>HTML5 Sandbox: Allow autoplay for HTML5 Video inside iframe with sandbox attribute if sandbox='allow-scripts'.</title>
+ <meta name=timeout content=long>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
- <link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-automatic-features-browsing-context-flag" />
- <meta name="assert" content="Allow autoplay for HTML5 Video inside iframe with sandbox attribute if sandbox='allow-scripts'." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
- <script type="text/javascript">
-
-
- var t = async_test("Allow autoplay for HTML5 Video inside iframe with sandbox attribute if sandbox='allow-scripts'.");
-
- function callback(event)
- {
- t.step(function(){
- assert_true('sandbox' in document.createElement('iframe'));
- assert_equals(event.data, "play event fired");
- });
- t.done();
- }
+ <script>
+ async_test(function (t) {
+ var callback = t.step_func_done(function(event) {
+ assert_true('sandbox' in document.createElement('iframe'));
+ assert_equals(event.data, "play event fired");
+ });
- var timer = setTimeout(callback, 8000);
window.addEventListener("message", callback, false);
+ }, "Allow autoplay for HTML5 Video inside iframe with sandbox attribute if sandbox='allow-scripts'.");
</script>
<iframe src="iframe_sandbox_002.htm" sandbox="allow-scripts" style="display: none"></iframe>
<div id=log></div>
</body>
</html>
-
diff --git a/tests/wpt/web-platform-tests/selectors/attribute-selectors/attribute-case/syntax.html b/tests/wpt/web-platform-tests/selectors/attribute-selectors/attribute-case/syntax.html
index 1a6aa5b369d..9d895b8ef2d 100644
--- a/tests/wpt/web-platform-tests/selectors/attribute-selectors/attribute-case/syntax.html
+++ b/tests/wpt/web-platform-tests/selectors/attribute-selectors/attribute-case/syntax.html
@@ -12,6 +12,7 @@ setup({explicit_done:true});
var valid = [
"[foo='BAR'] /* sanity check (valid) */",
"[foo='bar' i]",
+ "[foo='bar' I]",
"[foo=bar i]",
'[foo="bar" i]',
"[foo='bar'i]",
@@ -37,7 +38,6 @@ var valid = [
var invalid = [
"[foo[ /* sanity check (invalid) */",
"[foo='bar' i i]",
- "[foo='bar' I]",
"[foo i ='bar']",
"[foo= i 'bar']",
"[i foo='bar']",
diff --git a/tests/wpt/web-platform-tests/shadow-dom/styles/shadow-cascade-order.html b/tests/wpt/web-platform-tests/shadow-dom/styles/shadow-cascade-order.html
new file mode 100644
index 00000000000..cc333eaeb7e
--- /dev/null
+++ b/tests/wpt/web-platform-tests/shadow-dom/styles/shadow-cascade-order.html
@@ -0,0 +1,404 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Shadow DOM: CSS Style Rule cascading</title>
+<meta name="author" title="Takayoshi Kochi" href="mailto:kochi@google.com">
+<meta name="assert" content="Cascading order test for style rules from various shadow trees.">
+<link rel="help" href="https://github.com/w3c/webcomponents/blob/gh-pages/proposals/Shadow-DOM-Cascade-Order.md">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<link rel='stylesheet' href='/resources/testharness.css'>
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+// Taken from the example in
+// https://github.com/w3c/webcomponents/blob/gh-pages/proposals/Shadow-DOM-Cascade-Order.md
+// https://github.com/w3c/webcomponents/issues/316
+// https://github.com/w3c/webcomponents/blob/gh-pages/proposals/Shadow-DOM-Cascade-Order-in-v1.md
+// with element renamed and style rule location changed.
+//
+// <style>my-item { color: red; }</style>
+// <my-list>
+// <:shadow>
+// <style>::slotted(my-item) { color: blue; }</style>
+// <slot/>
+// </:shadow>
+// <my-item style="color: green;">
+// <:shadow>
+// <style>:host { color: yellow; }</style>
+// <slot/>
+// </:shadow>
+// ITEM
+// </my-item>
+// </my-list>
+//
+// There are 4 possible style rules that applies to <my-item> above:
+// 1. document-wide style
+// 2. ::slotted style in the shadow in <my-list>
+// 3. :host style in the shadow in <my-item>
+// 4. inline style within <my-item> itself.
+//
+// It could be possible to nest many more shadow trees in <my-list>,
+// but to prevent the number of combination explosion, such case is covered
+// in another test file.
+//
+// So testing cases where 2 style rules are competing,
+// 4C2 = 6 combinations exist, multiplied by 4, which is the possible
+// combination of applying "!important" for the 2 style rules.
+
+function createMyList(mode, slottedStyle, hostStyle, inlineStyle) {
+ var myList = document.createElement('my-list');
+ var root = myList.attachShadow({'mode': mode});
+ root.innerHTML = '<style>' + slottedStyle + '</style><slot></slot>';
+ var myItem = document.createElement('my-item');
+ if (inlineStyle !== '')
+ myItem.setAttribute('style', inlineStyle);
+ myList.appendChild(myItem);
+ var root2 = myItem.attachShadow({'mode': mode});
+ root2.innerHTML = '<style>' + hostStyle + '</style><slot></slot>';
+ myItem.appendChild(document.createTextNode('ITEM'));
+ return myList;
+}
+
+function testCascadingOrder(mode) {
+ // In all test cases, the rule specified as "color: green" should win.
+ var testCases = [
+ // [A] Cases between document, ::slotteed, :host, and inline
+ {
+ title: 'A1. document vs ::slotted, document rule should win',
+ documentStyle: 'my-item { color: green; }',
+ slottedStyle: '::slotted(my-item) { color: red; }',
+ hostStyle: '',
+ inlineStyle: ''
+ },
+ {
+ title: 'A2. document vs :host, document rule should win',
+ documentStyle: 'my-item { color: green; }',
+ slottedStyle: '',
+ hostStyle: ':host { color: red; }',
+ inlineStyle: ''
+ },
+ {
+ title: 'A3. document vs inline, inline rule should win',
+ documentStyle: 'my-item { color: red; }',
+ slottedStyle: '',
+ hostStyle: '',
+ inlineStyle: 'color: green;'
+ },
+ {
+ title: 'A4. ::slotted vs :host, earlier in tree-of-trees rule should win',
+ documentStyle: '',
+ slottedStyle: '::slotted(my-item) { color: green; }',
+ hostStyle: ':host { color: red; }',
+ inlineStyle: ''
+ },
+ {
+ title: 'A5. ::slotted vs inline, inline rule should win',
+ documentStyle: '',
+ slottedStyle: '::slotted(my-item) { color: red; }',
+ hostStyle: '',
+ inlineStyle: 'color: green;'
+ },
+ {
+ title: 'A6. :host vs inline, inline rule should win',
+ documentStyle: '',
+ slottedStyle: '',
+ hostStyle: ':host { color: red; }',
+ inlineStyle: 'color: green;'
+ },
+
+ // [B] Stronger rule is still stronger with !important
+ {
+ title: 'B1. document with !important vs ::slotted, document rule should win',
+ documentStyle: 'my-item { color: green !important; }',
+ slottedStyle: '::slotted(my-item) { color: red; }',
+ hostStyle: '',
+ inlineStyle: ''
+ },
+ {
+ title: 'B2. document with !important vs :host, document rule should win',
+ documentStyle: 'my-item { color: green !important; }',
+ slottedStyle: '',
+ hostStyle: ':host { color: red; }',
+ inlineStyle: ''
+ },
+ {
+ title: 'B3. document vs inline with !important, inline rule should win',
+ documentStyle: 'my-item { color: red; }',
+ slottedStyle: '',
+ hostStyle: '',
+ inlineStyle: 'color: green !important;'
+ },
+ {
+ title: 'B4. ::slotted with !important vs :host, earlier in tree-of-trees rule should win',
+ documentStyle: '',
+ slottedStyle: '::slotted(my-item) { color: green !important; }',
+ hostStyle: ':host { color: red; }',
+ inlineStyle: ''
+ },
+ {
+ title: 'B5. ::slotted vs inline with !important, inline rule should win',
+ documentStyle: '',
+ slottedStyle: '::slotted(my-item) { color: green !important; }',
+ hostStyle: '',
+ inlineStyle: 'color: red;'
+ },
+ {
+ title: 'B6. :host vs inline with !important, inline rule should win',
+ documentStyle: '',
+ slottedStyle: '',
+ hostStyle: ':host { color: red; }',
+ inlineStyle: 'color: green !important;'
+ },
+
+ // [C] Weaker rule gets stronger with !important
+ {
+ title: 'C1. document vs ::slotted with !important, ::slotted rule should win',
+ documentStyle: 'my-item { color: red; }',
+ slottedStyle: '::slotted(my-item) { color: green !important; }',
+ hostStyle: '',
+ inlineStyle: ''
+ },
+ {
+ title: 'C2. document vs :host with !important, :host rule should win',
+ documentStyle: 'my-item { color: red; }',
+ slottedStyle: '',
+ hostStyle: ':host { color: green !important; }',
+ inlineStyle: ''
+ },
+ {
+ title: 'C3. document with !important vs inline, document rule should win',
+ documentStyle: 'my-item { color: green !important; }',
+ slottedStyle: '',
+ hostStyle: '',
+ inlineStyle: 'color: red;'
+ },
+ {
+ title: 'C4. ::slotted vs :host with !important, later in tree-of-trees rule should win',
+ documentStyle: '',
+ slottedStyle: '::slotted(my-item) { color: green !important; }',
+ hostStyle: ':host { color: red; }',
+ inlineStyle: ''
+ },
+ {
+ title: 'C5. ::slotted with !important vs inline, ::slotted rule should win',
+ documentStyle: '',
+ slottedStyle: '::slotted(my-item) { color: green !important; }',
+ hostStyle: '',
+ inlineStyle: 'color: red;'
+ },
+ {
+ title: 'C6. :host with !important vs inline, :host rule should win',
+ documentStyle: '',
+ slottedStyle: '',
+ hostStyle: ':host { color: green !important; }',
+ inlineStyle: 'color: red;'
+ },
+
+ // [D] Cases between document, ::slotteed, :host, and inline, both with !important
+ {
+ title: 'D1. document vs ::slotted both with !important, ::slotted rule should win',
+ documentStyle: 'my-item { color: red !important; }',
+ slottedStyle: '::slotted(my-item) { color: green !important; }',
+ hostStyle: '',
+ inlineStyle: ''
+ },
+ {
+ title: 'D2. document vs :host both with !important, :host rule should win',
+ documentStyle: 'my-item { color: red !important; }',
+ slottedStyle: '',
+ hostStyle: ':host { color: green !important; }',
+ inlineStyle: ''
+ },
+ {
+ title: 'D3. document vs inline both with !important, inline rule should win',
+ documentStyle: 'my-item { color: red !important; }',
+ slottedStyle: '',
+ hostStyle: '',
+ inlineStyle: 'color: green !important;'
+ },
+ {
+ title: 'D4. ::slotted vs :host both with !important, later in tree-of-trees rule should win',
+ documentStyle: '',
+ slottedStyle: '::slotted(my-item) { color: red !important; }',
+ hostStyle: ':host { color: green !important; }',
+ inlineStyle: ''
+ },
+ {
+ title: 'D5. ::slotted vs inline both with !important, ::slotted rule should win',
+ documentStyle: '',
+ slottedStyle: '::slotted(my-item) { color: green !important; }',
+ hostStyle: '',
+ inlineStyle: 'color: red !important;'
+ },
+ {
+ title: 'D6. :host vs inline both with !important, :host rule should win',
+ documentStyle: '',
+ slottedStyle: '',
+ hostStyle: ':host { color: green !important; }',
+ inlineStyle: 'color: red !important;'
+ },
+ // [E] Putting all together
+ {
+ title: 'E1. all style applied, inline rule should win',
+ documentStyle: 'my-item { color: red; }',
+ slottedStyle: '::slotted(my-item) { color: blue; }',
+ hostStyle: ':host { color: yellow; }',
+ inlineStyle: 'color: green;'
+ },
+ {
+ title: 'E2. all styles with !important applied, rule in the last tree-of-trees should win',
+ documentStyle: 'my-item { color: red !important; }',
+ slottedStyle: '::slotted(my-item) { color: blue !important; }',
+ hostStyle: ':host { color: green !important; }',
+ inlineStyle: 'color: yellow !important;'
+ },
+ ];
+
+ for (var i = 0; i < testCases.length; ++i) {
+ var testCase = testCases[i];
+ var documentStyle = document.createElement('style');
+ documentStyle.appendChild(document.createTextNode(testCase['documentStyle']));
+ document.head.appendChild(documentStyle);
+
+ var myList = createMyList(mode,
+ testCase['slottedStyle'], testCase['hostStyle'], testCase['inlineStyle']);
+ document.body.appendChild(myList);
+
+ test(function () {
+ var myItem = myList.querySelector('my-item');
+ assert_equals(window.getComputedStyle(myItem).color, 'rgb(0, 128, 0)',
+ testCase['title']);
+ }, testCase['title'] + ' for ' + mode + ' mode.');
+
+ myList.parentNode.removeChild(myList);
+ document.head.removeChild(documentStyle)
+ }
+}
+
+// Open or Closed should not make any difference in style application.
+testCascadingOrder('open');
+testCascadingOrder('closed');
+
+
+// Taken from the example in
+// https://github.com/w3c/webcomponents/blob/gh-pages/proposals/Shadow-DOM-Cascade-Order.md
+// https://github.com/w3c/webcomponents/issues/316
+// https://github.com/w3c/webcomponents/blob/gh-pages/proposals/Shadow-DOM-Cascade-Order-in-v1.md
+// with element renamed and style rule location changed.
+//
+// <style>my-item { color: red; }</style>
+// <my-list>
+// <:shadow>
+// <style>::slotted(my-item) { color: blue; }</style>
+// <div>
+// <:shadow>
+// <slot/>
+// </:shadow>
+// <slot/>
+// </div>
+// </:shadow>
+// <my-item style="color: green;">
+// <:shadow>
+// <style>:host { color: yellow; }</style>
+// <slot/>
+// </:shadow>
+// ITEM
+// </my-item>
+// </my-list>
+//
+// The difference from the example tree above is that <my-list> has 2 levels of
+// shadow trees, each with ::slotted(my-list) style rules.
+
+function createMyListWith2LevelShadow(mode, slottedStyle1, slottedStyle2, hostStyle) {
+ var myList = document.createElement('my-list');
+ var root = myList.attachShadow({'mode': mode});
+ root.innerHTML = '<style>' + slottedStyle1 + '</style><div><slot></slot></div>';
+ var div = root.querySelector('div');
+ var root2 = div.attachShadow({'mode': mode});
+ root2.innerHTML = '<style>' + slottedStyle2 + '</style><slot></slot>';
+ var myItem = document.createElement('my-item');
+ myList.appendChild(myItem);
+ var root3 = myItem.attachShadow({'mode': mode});
+ root3.innerHTML = '<style>' + hostStyle + '</style><slot></slot>';
+ myItem.appendChild(document.createTextNode('ITEM'));
+ return myList;
+}
+
+function testCascadingOrderWith2LevelShadow(mode) {
+ // In all test cases, the rule specified as "color: green" should win.
+ var testCases = [
+ {
+ title: 'F1. document vs others, document (the first rule in tree-of-trees order) rule should win',
+ documentStyle: 'my-item { color: green; }',
+ slottedStyle1: '::slotted(my-item) { color: red; }',
+ slottedStyle2: '::slotted(my-item) { color: red; }',
+ hostStyle: ':host { color: red; }',
+ },
+ {
+ title: 'F2. document with !important vs others, document rule should win',
+ documentStyle: 'my-item { color: green !important; }',
+ slottedStyle1: '::slotted(my-item) { color: red; }',
+ slottedStyle2: '::slotted(my-item) { color: red; }',
+ hostStyle: ':host { color: red; }',
+ },
+ {
+ title: 'F3. document vs ::slotted with !important, important rule should win',
+ documentStyle: 'my-item { color: red; }',
+ slottedStyle1: '::slotted(my-item) { color: green !important; }',
+ slottedStyle2: '::slotted(my-item) { color: red; }',
+ hostStyle: ':host { color: red; }',
+ },
+ {
+ title: 'F4. document vs ::slotted with !important, important rule should win',
+ documentStyle: 'my-item { color: red; }',
+ slottedStyle1: '::slotted(my-item) { color: red; }',
+ slottedStyle2: '::slotted(my-item) { color: green !important; }',
+ hostStyle: ':host { color: red; }',
+ },
+ {
+ title: 'F5. document vs :host with !important, important rule should win',
+ documentStyle: 'my-item { color: red; }',
+ slottedStyle1: '::slotted(my-item) { color: red; }',
+ slottedStyle2: '::slotted(my-item) { color: red; }',
+ hostStyle: ':host { color: green !important; }',
+ },
+ {
+ title: 'F6. all rules with !important, the last rule in tree-of-trees should win',
+ documentStyle: 'my-item { color: red !important; }',
+ slottedStyle1: '::slotted(my-item) { color: red !important; }',
+ slottedStyle2: '::slotted(my-item) { color: red !important; }',
+ hostStyle: ':host { color: green !important ; }',
+ }
+ ];
+
+ for (var i = 0; i < testCases.length; ++i) {
+ var testCase = testCases[i];
+ var documentStyle = document.createElement('style');
+ documentStyle.appendChild(document.createTextNode(testCase['documentStyle']));
+ document.head.appendChild(documentStyle);
+
+ var myList = createMyListWith2LevelShadow(mode,
+ testCase['slottedStyle1'], testCase['slottedStyle2'], testCase['hostStyle']);
+ document.body.appendChild(myList);
+
+ test(function () {
+ var myItem = myList.querySelector('my-item');
+ assert_equals(window.getComputedStyle(myItem).color, 'rgb(0, 128, 0)',
+ testCase['title']);
+ }, testCase['title'] + ' for ' + mode + ' mode.');
+
+ myList.parentNode.removeChild(myList);
+ document.head.removeChild(documentStyle)
+ }
+}
+
+// Open or Closed should not make any difference in style application.
+testCascadingOrderWith2LevelShadow('open');
+testCascadingOrderWith2LevelShadow('closed');
+
+</script>
+</body>
+</html>
diff --git a/tests/wpt/web-platform-tests/svg/interfaces.html b/tests/wpt/web-platform-tests/svg/interfaces.html
index 15c44773486..e5509ac58df 100644
--- a/tests/wpt/web-platform-tests/svg/interfaces.html
+++ b/tests/wpt/web-platform-tests/svg/interfaces.html
@@ -1333,8 +1333,6 @@ var altGlyphItem = document.createElementNS("http://www.w3.org/2000/svg",
"altGlyphItem");
var glyphRef = document.createElementNS("http://www.w3.org/2000/svg",
"glyphRef");
-var glyphRef = document.createElementNS("http://www.w3.org/2000/svg",
- "glyphRef");
var marker = document.createElementNS("http://www.w3.org/2000/svg", "marker");
var colorProfile = document.createElementNS("http://www.w3.org/2000/svg",
"color-profile");
@@ -1386,8 +1384,6 @@ var filter = document.createElementNS("http://www.w3.org/2000/svg", "filter");
var feBlend = document.createElementNS("http://www.w3.org/2000/svg", "feBlend");
var feColorMatrix = document.createElementNS("http://www.w3.org/2000/svg",
"feColorMatrix");
-var feColorMatrix = document.createElementNS("http://www.w3.org/2000/svg",
- "feColorMatrix");
var feComponentTransfer = document.createElementNS("http://www.w3.org/2000/svg",
"feComponentTransfer");
var feFuncR = document.createElementNS("http://www.w3.org/2000/svg", "feFuncR");
@@ -1415,9 +1411,6 @@ var feDisplacementMap = document.createElementNS("http://www.w3.org/2000/svg",
"feDisplacementMap");
var feDropShadow = document.createElementNS("http://www.w3.org/2000/svg",
"feDropShadow");
-var feFlood = document.createElementNS("http://www.w3.org/2000/svg", "feFlood");
-var feGaussianBlur = document.createElementNS("http://www.w3.org/2000/svg",
- "feGaussianBlue");
var feImage = document.createElementNS("http://www.w3.org/2000/svg", "feImage");
var feMerge = document.createElementNS("http://www.w3.org/2000/svg", "feMerge");
var feMergeNode = document.createElementNS("http://www.w3.org/2000/svg",
diff --git a/tests/wpt/web-platform-tests/url/urltestdata.json b/tests/wpt/web-platform-tests/url/urltestdata.json
index 1f787d795ef..1e8c68fc46b 100644
--- a/tests/wpt/web-platform-tests/url/urltestdata.json
+++ b/tests/wpt/web-platform-tests/url/urltestdata.json
@@ -1760,7 +1760,7 @@
{
"input": "http://example.com/foo/%2e%2",
"base": "about:blank",
- "href": "http://example.com/foo/%2e%2",
+ "href": "http://example.com/foo/.%2",
"origin": "http://example.com",
"protocol": "http:",
"username": "",
@@ -1768,14 +1768,14 @@
"host": "example.com",
"hostname": "example.com",
"port": "",
- "pathname": "/foo/%2e%2",
+ "pathname": "/foo/.%2",
"search": "",
"hash": ""
},
{
"input": "http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar",
"base": "about:blank",
- "href": "http://example.com/%2e.bar",
+ "href": "http://example.com/..bar",
"origin": "http://example.com",
"protocol": "http:",
"username": "",
@@ -1783,7 +1783,7 @@
"host": "example.com",
"hostname": "example.com",
"port": "",
- "pathname": "/%2e.bar",
+ "pathname": "/..bar",
"search": "",
"hash": ""
},
diff --git a/tests/wpt/web-platform-tests/user-timing/test_user_timing_mark.html b/tests/wpt/web-platform-tests/user-timing/test_user_timing_mark.html
index 23157d8d3d6..57e8012b250 100644
--- a/tests/wpt/web-platform-tests/user-timing/test_user_timing_mark.html
+++ b/tests/wpt/web-platform-tests/user-timing/test_user_timing_mark.html
@@ -183,7 +183,7 @@
// test startTime, allow for an acceptable threshold in the difference between the startTime and the
// expected value for the startTime (loadEventStart + markTestDelay)
test_true(Math.abs(markEntry.startTime - expectedStartTime) <= testThreshold,
- markEntryCommand + ".startTime ~== " + expectedStartTime + " (up to " + testThreshold +
+ markEntryCommand + ".startTime is approximately correct (up to " + testThreshold +
"ms difference allowed)");
// verify entryType
diff --git a/tests/wpt/web-platform-tests/user-timing/test_user_timing_measure.html b/tests/wpt/web-platform-tests/user-timing/test_user_timing_measure.html
index 205b7fa1e6c..6dee57c363a 100644
--- a/tests/wpt/web-platform-tests/user-timing/test_user_timing_measure.html
+++ b/tests/wpt/web-platform-tests/user-timing/test_user_timing_measure.html
@@ -233,7 +233,7 @@
// test startTime; since for a mark, the startTime is always equal to a mark's value or the value of a
// navigation timing attribute, the actual startTime should match the expected value exactly
test_true(Math.abs(measureEntry.startTime - expectedStartTime) == 0,
- measureEntryCommand + ".startTime == " + expectedStartTime);
+ measureEntryCommand + ".startTime is correct");
// test entryType
test_true(measureEntry.entryType == "measure", measureEntryCommand + ".entryType == \"measure\"");
@@ -241,7 +241,7 @@
// test duration, allow for an acceptable threshold in the difference between the actual duration and the
// expected value for the duration
test_true(Math.abs(measureEntry.duration - expectedDuration) <= testThreshold, measureEntryCommand +
- ".duration ~== " + expectedDuration + " (up to " + testThreshold + "ms difference allowed)");
+ ".duration is approximately correct (up to " + testThreshold + "ms difference allowed)");
}
function test_measure_list(measureEntryList, measureEntryListCommand, measureScenarios)
diff --git a/tests/wpt/web-platform-tests/user-timing/test_user_timing_measure_navigation_timing.html b/tests/wpt/web-platform-tests/user-timing/test_user_timing_measure_navigation_timing.html
index 52ca2de30b1..d29f4e5e6d8 100644
--- a/tests/wpt/web-platform-tests/user-timing/test_user_timing_measure_navigation_timing.html
+++ b/tests/wpt/web-platform-tests/user-timing/test_user_timing_measure_navigation_timing.html
@@ -198,7 +198,7 @@
// test startTime; since for a mark, the startTime is always equal to a mark's value or the value of a
// navigation timing attribute, the actual startTime should match the expected value exactly
test_true(Math.abs(measureEntry.startTime - expectedStartTime) == 0,
- measureEntryCommand + ".startTime == " + expectedStartTime);
+ measureEntryCommand + ".startTime is correct");
// test entryType
test_true(measureEntry.entryType == "measure", measureEntryCommand + ".entryType == \"measure\"");
@@ -206,7 +206,7 @@
// test duration, allow for an acceptable threshold in the difference between the actual duration and the
// expected value for the duration
test_true(Math.abs(measureEntry.duration - expectedDuration) <= testThreshold, measureEntryCommand +
- ".duration ~== " + expectedDuration + " (up to " + testThreshold + "ms difference allowed)");
+ ".duration is aproximately correct (up to " + testThreshold + "ms difference allowed)");
}
</script>
</head>
diff --git a/tests/wpt/web-platform-tests/web-animations/animatable/animate.html b/tests/wpt/web-platform-tests/web-animations/animatable/animate.html
new file mode 100644
index 00000000000..d649aef28af
--- /dev/null
+++ b/tests/wpt/web-platform-tests/web-animations/animatable/animate.html
@@ -0,0 +1,126 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Animatable.animate tests</title>
+<link rel="help" href="http://w3c.github.io/web-animations/#dom-animatable-animate">
+<link rel="author" title="Brian Birtles" href="mailto:bbirtles@mozilla.com">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../testcommon.js"></script>
+<link rel="stylesheet" href="/resources/testharness.css">
+<body>
+<div id="log"></div>
+<iframe src="data:text/html;charset=utf-8," width="10" height="10"
+ id="iframe"></iframe>
+<script>
+'use strict';
+
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
+ assert_class_string(anim, 'Animation', 'Returned object is an Animation');
+}, 'Element.animate() creates an Animation object');
+
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
+ assert_class_string(anim.effect, 'KeyframeEffect',
+ 'Returned Animation has a KeyframeEffect');
+}, 'Element.animate() creates an Animation object with a KeyframeEffect');
+
+// Animatable.animate() passes its |frames| argument to the KeyframeEffect
+// constructor. As a result, detailed tests of the handling of that argument
+// are found in the tests for that constructor. Here we just check that the
+// different types of arguments are correctly passed along.
+
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
+ assert_equals(anim.effect.getFrames().length, 2);
+ assert_equals(anim.effect.getFrames()[0].opacity, '0');
+ assert_equals(anim.effect.getFrames()[1].opacity, '1');
+}, 'Element.animate() accepts a property-indexed keyframe specification');
+
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate([ { opacity: 0 }, { opacity: 1 } ], 2000);
+ assert_equals(anim.effect.getFrames().length, 2);
+ assert_equals(anim.effect.getFrames()[0].opacity, '0');
+ assert_equals(anim.effect.getFrames()[1].opacity, '1');
+}, 'Element.animate() accepts a frame-indexed keyframe specification');
+
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate({ opacity: 0 }, 2000);
+ assert_equals(anim.effect.getFrames().length, 1);
+ assert_equals(anim.effect.getFrames()[0].opacity, '0');
+}, 'Element.animate() accepts a single-valued keyframe specification');
+
+// As with the |frames| argument, Animatable.animate() passes its |options|
+// argument to the KeyframeEffect constructor as well. As a result, detailed
+// tests of the handling of that argument are found in the tests for that
+// constructor. Here we just check that the different types of arguments are
+// correctly passed along.
+
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
+ assert_equals(anim.effect.timing.duration, 2000);
+ // Also check that unspecified parameters receive their default values
+ assert_equals(anim.effect.timing.fill, 'auto');
+}, 'Element.animate() accepts a double as an options argument');
+
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate({ opacity: [ 0, 1 ] },
+ { duration: Infinity, fill: 'forwards' });
+ assert_equals(anim.effect.timing.duration, Infinity);
+ assert_equals(anim.effect.timing.fill, 'forwards');
+ // Also check that unspecified parameters receive their default values
+ assert_equals(anim.effect.timing.direction, 'normal');
+}, 'Element.animate() accepts a KeyframeAnimationOptions argument');
+
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate({ opacity: [ 0, 1 ] });
+ assert_equals(anim.effect.timing.duration, 'auto');
+}, 'Element.animate() accepts an absent options argument');
+
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
+ assert_equals(anim.id, '');
+}, 'Element.animate() correctly sets the id attribute when no id is specified');
+
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate({ opacity: [ 0, 1 ] }, { id: 'test' });
+ assert_equals(anim.id, 'test');
+}, 'Element.animate() correctly sets the id attribute');
+
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
+ assert_equals(anim.timeline, document.timeline);
+}, 'Element.animate() correctly sets the Animation\'s timeline');
+
+async_test(function(t) {
+ var iframe = document.getElementById('iframe');
+ iframe.addEventListener('load', t.step_func(function() {
+ var div = createDiv(t, iframe.contentDocument);
+ var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
+ assert_equals(anim.timeline, iframe.contentDocument.timeline);
+ t.done();
+ }));
+}, 'Element.animate() correctly sets the Animation\'s timeline when ' +
+ 'triggered on an element in a different document');
+
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
+ assert_equals(anim.playState, 'pending');
+}, 'Element.animate() calls play on the Animation');
+
+// TODO: Test the same on CSSPseudoElement
+
+</script>
+</body>
diff --git a/tests/wpt/web-platform-tests/web-animations/testcommon.js b/tests/wpt/web-platform-tests/web-animations/testcommon.js
index 5a704bb4dc8..d9876c30f54 100644
--- a/tests/wpt/web-platform-tests/web-animations/testcommon.js
+++ b/tests/wpt/web-platform-tests/web-animations/testcommon.js
@@ -34,7 +34,7 @@ function newAnimation(animationTarget) {
}
// creates div element, appends it to the document body and
-// add removing of the created element to test cleanup
+// removes the created element during test cleanup
function createDiv(test, doc) {
if (!doc) {
doc = document;
diff --git a/tests/wpt/web-platform-tests/webgl/OWNERS b/tests/wpt/web-platform-tests/webgl/OWNERS
new file mode 100644
index 00000000000..fd31fb27543
--- /dev/null
+++ b/tests/wpt/web-platform-tests/webgl/OWNERS
@@ -0,0 +1 @@
+@Ms2ger
diff --git a/tests/wpt/web-platform-tests/webvtt/OWNERS b/tests/wpt/web-platform-tests/webvtt/OWNERS
new file mode 100644
index 00000000000..dd2b7600f63
--- /dev/null
+++ b/tests/wpt/web-platform-tests/webvtt/OWNERS
@@ -0,0 +1,4 @@
+@foolip
+@r12a
+@silviapfeiffer
+@zcorpan
diff --git a/tests/wpt/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/001.html b/tests/wpt/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/001.html
deleted file mode 100644
index 00398c78077..00000000000
--- a/tests/wpt/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/001.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!--
-try {
- importScripts();
- postMessage(true);
-} catch(ex) {
- postMessage(String(ex));
-}
-/*
--->
-<!doctype html>
-<title>importScripts no arguments</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<div id="log"></div>
-<script>
-async_test(function() {
- var worker = new Worker('#');
- worker.onmessage = this.step_func(function(e) {
- assert_true(e.data);
- this.done();
- });
-});
-</script>
-<!--
-*/
-//-->
diff --git a/tests/wpt/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/001.worker.js b/tests/wpt/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/001.worker.js
new file mode 100644
index 00000000000..aa86c8ef177
--- /dev/null
+++ b/tests/wpt/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/001.worker.js
@@ -0,0 +1,7 @@
+importScripts("/resources/testharness.js");
+
+test(function() {
+ importScripts();
+});
+
+done();
diff --git a/tests/wpt/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/002.html b/tests/wpt/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/002.html
deleted file mode 100644
index e7d52e9797d..00000000000
--- a/tests/wpt/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/002.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!--
-var ran = false;
-var threw = false;
-var code = undefined;
-try {
- importScripts('data:text/javascript,ran=true','http://foo bar');
-} catch(e) {
- threw = true;
- code = e.code;
-}
-postMessage([ran, threw, code]);
-/*
--->
-<!doctype html>
-<title>importScripts resolving urls</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<div id="log"></div>
-<script>
-async_test(function() {
- var worker = new Worker('#');
- worker.onmessage = this.step_func(function(e) {
- assert_false(e.data[0], 'first argument to importScripts ran');
- assert_true(e.data[1], 'space in URL in second argument to importScripts did not throw');
- assert_equals(e.data[2], 12, 'exception code');
- this.done();
- });
-});
-</script>
-<!--
-*/
-//-->
diff --git a/tests/wpt/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/002.worker.js b/tests/wpt/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/002.worker.js
new file mode 100644
index 00000000000..2cecbcb5352
--- /dev/null
+++ b/tests/wpt/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/002.worker.js
@@ -0,0 +1,11 @@
+importScripts("/resources/testharness.js");
+
+test(function() {
+ var ran = false;
+ assert_throws("SyntaxError", function() {
+ importScripts('data:text/javascript,ran=true','http://foo bar');
+ });
+ assert_false(ran, 'first argument to importScripts ran');
+});
+
+done();