Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (238663 => 238664)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2018-11-29 10:19:56 UTC (rev 238663)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2018-11-29 10:30:29 UTC (rev 238664)
@@ -1,3 +1,61 @@
+2018-11-29 Rob Buis <[email protected]>
+
+ Import fetch/api/cors tests
+ https://bugs.webkit.org/show_bug.cgi?id=192092
+
+ Reviewed by Frédéric Wang.
+
+ Import to most recent checkout since some old
+ tests like cors-multiple-origins.js were incorrect.
+
+ * resources/import-expectations.json:
+ * web-platform-tests/fetch/api/cors/cors-expose-star-worker.html: Removed.
+ * web-platform-tests/fetch/api/cors/cors-expose-star.html: Removed.
+ * web-platform-tests/fetch/api/cors/cors-expose-star.sub.any-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star-expected.txt.
+ * web-platform-tests/fetch/api/cors/cors-expose-star.sub.any.html: Added.
+ * web-platform-tests/fetch/api/cors/cors-expose-star.sub.any.js: Renamed from LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.js.
+ (sharedHeaders.string_appeared_here.promise_test):
+ (string_appeared_here.promise_test):
+ * web-platform-tests/fetch/api/cors/cors-expose-star.sub.any.worker-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star-worker-expected.txt.
+ * web-platform-tests/fetch/api/cors/cors-expose-star.sub.any.worker.html: Added.
+ * web-platform-tests/fetch/api/cors/cors-filtering-worker.html: Removed.
+ * web-platform-tests/fetch/api/cors/cors-filtering.html: Removed.
+ * web-platform-tests/fetch/api/cors/cors-filtering.sub.any-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering-expected.txt.
+ * web-platform-tests/fetch/api/cors/cors-filtering.sub.any.html: Added.
+ * web-platform-tests/fetch/api/cors/cors-filtering.sub.any.js: Renamed from LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.js.
+ (corsFilter):
+ (corsExposeFilter):
+ * web-platform-tests/fetch/api/cors/cors-filtering.sub.any.worker-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering-worker-expected.txt.
+ * web-platform-tests/fetch/api/cors/cors-filtering.sub.any.worker.html: Added.
+ * web-platform-tests/fetch/api/cors/cors-multiple-origins-worker-expected.txt: Removed.
+ * web-platform-tests/fetch/api/cors/cors-multiple-origins-worker.html: Removed.
+ * web-platform-tests/fetch/api/cors/cors-multiple-origins.html: Removed.
+ * web-platform-tests/fetch/api/cors/cors-multiple-origins.js: Removed.
+ * web-platform-tests/fetch/api/cors/cors-multiple-origins.sub.any-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins-expected.txt.
+ * web-platform-tests/fetch/api/cors/cors-multiple-origins.sub.any.html: Added.
+ * web-platform-tests/fetch/api/cors/cors-multiple-origins.sub.any.js: Added.
+ (corsMultipleOrigins):
+ * web-platform-tests/fetch/api/cors/cors-multiple-origins.sub.any.worker-expected.txt: Added.
+ * web-platform-tests/fetch/api/cors/cors-multiple-origins.sub.any.worker.html: Added.
+ * web-platform-tests/fetch/api/cors/cors-preflight-not-cors-safelisted.any-expected.txt: Added.
+ * web-platform-tests/fetch/api/cors/cors-preflight-not-cors-safelisted.any.html: Added.
+ * web-platform-tests/fetch/api/cors/cors-preflight-not-cors-safelisted.any.js: Added.
+ (runTests):
+ * web-platform-tests/fetch/api/cors/cors-preflight-not-cors-safelisted.any.worker-expected.txt: Added.
+ * web-platform-tests/fetch/api/cors/cors-preflight-not-cors-safelisted.any.worker.html: Added.
+ * web-platform-tests/fetch/api/cors/cors-preflight.any.js:
+ (headerNames): Deleted.
+ (): Deleted.
+ (corsPreflight): Deleted.
+ * web-platform-tests/fetch/api/cors/resources/corspreflight.js: Copied from LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight.any.js.
+ (headerNames):
+ (corsPreflight):
+ * web-platform-tests/fetch/api/cors/resources/not-cors-safelisted.json: Added.
+ * web-platform-tests/fetch/api/cors/resources/w3c-import.log: Added.
+ * web-platform-tests/fetch/api/cors/sandboxed-iframe-expected.txt: Added.
+ * web-platform-tests/fetch/api/cors/sandboxed-iframe.html: Added.
+ * web-platform-tests/fetch/api/cors/w3c-import.log:
+
2018-11-28 Rob Buis <[email protected]>
[XHR] Document.lastModified doesn't work for non-rendered documents
Modified: trunk/LayoutTests/imported/w3c/resources/import-expectations.json (238663 => 238664)
--- trunk/LayoutTests/imported/w3c/resources/import-expectations.json 2018-11-29 10:19:56 UTC (rev 238663)
+++ trunk/LayoutTests/imported/w3c/resources/import-expectations.json 2018-11-29 10:30:29 UTC (rev 238664)
@@ -149,6 +149,7 @@
"web-platform-tests/feature-policy/resources/": "import",
"web-platform-tests/fetch": "import",
"web-platform-tests/fetch/api": "import",
+ "web-platform-tests/fetch/api/cors": "import",
"web-platform-tests/fetch/range": "import",
"web-platform-tests/fullscreen": "skip",
"web-platform-tests/gamepad": "skip",
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star-expected.txt (238663 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star-expected.txt 2018-11-29 10:19:56 UTC (rev 238663)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star-expected.txt 2018-11-29 10:30:29 UTC (rev 238664)
@@ -1,5 +0,0 @@
-
-FAIL Basic Access-Control-Expose-Headers: * support assert_equals: expected (string) "X" but got (object) null
-PASS * for credentialed fetches only matches literally
-FAIL * can be one of several values assert_equals: expected (string) "X" but got (object) null
-
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star-worker-expected.txt (238663 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star-worker-expected.txt 2018-11-29 10:19:56 UTC (rev 238663)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star-worker-expected.txt 2018-11-29 10:30:29 UTC (rev 238664)
@@ -1,5 +0,0 @@
-
-FAIL Basic Access-Control-Expose-Headers: * support assert_equals: expected (string) "X" but got (object) null
-PASS * for credentialed fetches only matches literally
-FAIL * can be one of several values assert_equals: expected (string) "X" but got (object) null
-
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star-worker.html (238663 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star-worker.html 2018-11-29 10:19:56 UTC (rev 238663)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star-worker.html 2018-11-29 10:30:29 UTC (rev 238664)
@@ -1,14 +0,0 @@
-<!doctype html>
-<html>
- <head>
- <meta charset="utf-8">
- <title>Fetch in worker: Access-Control-Expose-Headers: *</title>
- <script src=""
- <script src=""
- </head>
- <body>
- <script>
- fetch_tests_from_worker(new Worker("cors-expose-star.js?pipe=sub"));
- </script>
- </body>
-</html>
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.html (238663 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.html 2018-11-29 10:19:56 UTC (rev 238663)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.html 2018-11-29 10:30:29 UTC (rev 238664)
@@ -1,13 +0,0 @@
-<!doctype html>
-<html>
- <head>
- <meta charset="utf-8">
- <title>Fetch: Access-Control-Expose-Headers: *</title>
- <script src=""
- <script src=""
- </head>
- <body>
- <script src=""
- <script src=""
- </body>
-</html>
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.js (238663 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.js 2018-11-29 10:19:56 UTC (rev 238663)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.js 2018-11-29 10:30:29 UTC (rev 238664)
@@ -1,44 +0,0 @@
-if (this.document === undefined) {
- importScripts("/resources/testharness.js");
- importScripts("../resources/utils.js");
-}
-
-const url = "" + dirname(location.pathname) + RESOURCES_DIR + "top.txt",
- sharedHeaders = "?pipe=header(Access-Control-Expose-Headers,*)|header(Test,X)|header(Set-Cookie,X)|header(*,whoa)|"
-
-promise_test(() => {
- const headers = "header(Access-Control-Allow-Origin,*)"
- return fetch(url + sharedHeaders + headers).then(resp => {
- assert_equals(resp.status, 200)
- assert_equals(resp.type , "cors")
- assert_equals(resp.headers.get("test"), "X")
- assert_equals(resp.headers.get("set-cookie"), null)
- assert_equals(resp.headers.get("*"), "whoa")
- })
-}, "Basic Access-Control-Expose-Headers: * support")
-
-promise_test(() => {
- const origin = location.origin, // assuming an ASCII origin
- headers = "header(Access-Control-Allow-Origin," + origin + ")|header(Access-Control-Allow-Credentials,true)"
- return fetch(url + sharedHeaders + headers, { credentials:"include" }).then(resp => {
- assert_equals(resp.status, 200)
- assert_equals(resp.type , "cors")
- assert_equals(resp.headers.get("content-type"), "text/plain") // safelisted
- assert_equals(resp.headers.get("test"), null)
- assert_equals(resp.headers.get("set-cookie"), null)
- assert_equals(resp.headers.get("*"), "whoa")
- })
-}, "* for credentialed fetches only matches literally")
-
-promise_test(() => {
- const headers = "header(Access-Control-Allow-Origin,*)|header(Access-Control-Expose-Headers,set-cookie\\,*)"
- return fetch(url + sharedHeaders + headers).then(resp => {
- assert_equals(resp.status, 200)
- assert_equals(resp.type , "cors")
- assert_equals(resp.headers.get("test"), "X")
- assert_equals(resp.headers.get("set-cookie"), null)
- assert_equals(resp.headers.get("*"), "whoa")
- })
-}, "* can be one of several values")
-
-done();
Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.sub.any-expected.txt (from rev 238663, trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star-expected.txt) (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.sub.any-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.sub.any-expected.txt 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1,5 @@
+
+FAIL Basic Access-Control-Expose-Headers: * support assert_equals: expected (string) "X" but got (object) null
+PASS * for credentialed fetches only matches literally
+FAIL * can be one of several values assert_equals: expected (string) "X" but got (object) null
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.sub.any.html (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.sub.any.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.sub.any.html 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.sub.any.js (from rev 238663, trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.js) (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.sub.any.js (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.sub.any.js 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1,41 @@
+// META: script=../resources/utils.js
+
+const url = "" + dirname(location.pathname) + RESOURCES_DIR + "top.txt",
+ sharedHeaders = "?pipe=header(Access-Control-Expose-Headers,*)|header(Test,X)|header(Set-Cookie,X)|header(*,whoa)|"
+
+promise_test(() => {
+ const headers = "header(Access-Control-Allow-Origin,*)"
+ return fetch(url + sharedHeaders + headers).then(resp => {
+ assert_equals(resp.status, 200)
+ assert_equals(resp.type , "cors")
+ assert_equals(resp.headers.get("test"), "X")
+ assert_equals(resp.headers.get("set-cookie"), null)
+ assert_equals(resp.headers.get("*"), "whoa")
+ })
+}, "Basic Access-Control-Expose-Headers: * support")
+
+promise_test(() => {
+ const origin = location.origin, // assuming an ASCII origin
+ headers = "header(Access-Control-Allow-Origin," + origin + ")|header(Access-Control-Allow-Credentials,true)"
+ return fetch(url + sharedHeaders + headers, { credentials:"include" }).then(resp => {
+ assert_equals(resp.status, 200)
+ assert_equals(resp.type , "cors")
+ assert_equals(resp.headers.get("content-type"), "text/plain") // safelisted
+ assert_equals(resp.headers.get("test"), null)
+ assert_equals(resp.headers.get("set-cookie"), null)
+ assert_equals(resp.headers.get("*"), "whoa")
+ })
+}, "* for credentialed fetches only matches literally")
+
+promise_test(() => {
+ const headers = "header(Access-Control-Allow-Origin,*)|header(Access-Control-Expose-Headers,set-cookie\\,*)"
+ return fetch(url + sharedHeaders + headers).then(resp => {
+ assert_equals(resp.status, 200)
+ assert_equals(resp.type , "cors")
+ assert_equals(resp.headers.get("test"), "X")
+ assert_equals(resp.headers.get("set-cookie"), null)
+ assert_equals(resp.headers.get("*"), "whoa")
+ })
+}, "* can be one of several values")
+
+done();
Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.sub.any.worker-expected.txt (from rev 238663, trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star-worker-expected.txt) (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.sub.any.worker-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.sub.any.worker-expected.txt 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1,5 @@
+
+FAIL Basic Access-Control-Expose-Headers: * support assert_equals: expected (string) "X" but got (object) null
+PASS * for credentialed fetches only matches literally
+FAIL * can be one of several values assert_equals: expected (string) "X" but got (object) null
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.sub.any.worker.html (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.sub.any.worker.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.sub.any.worker.html 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering-expected.txt (238663 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering-expected.txt 2018-11-29 10:19:56 UTC (rev 238663)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering-expected.txt 2018-11-29 10:30:29 UTC (rev 238664)
@@ -1,21 +0,0 @@
-
-PASS CORS filter on Cache-Control header
-PASS CORS filter on Content-Language header
-PASS CORS filter on Content-Type header
-PASS CORS filter on Expires header
-PASS CORS filter on Last-Modified header
-PASS CORS filter on Pragma header
-PASS CORS filter on Content-Length header
-PASS CORS filter on Age header
-PASS CORS filter on Server header
-PASS CORS filter on Warning header
-PASS CORS filter on Set-Cookie header
-PASS CORS filter on Set-Cookie2 header
-PASS CORS filter on Age header, header is exposed
-PASS CORS filter on Server header, header is exposed
-PASS CORS filter on Warning header, header is exposed
-PASS CORS filter on Set-Cookie header, header is forbidden
-PASS CORS filter on Set-Cookie2 header, header is forbidden
-PASS CORS filter on Set-Cookie header, header is forbidden(credentials = include)
-PASS CORS filter on Set-Cookie2 header, header is forbidden(credentials = include)
-
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering-worker-expected.txt (238663 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering-worker-expected.txt 2018-11-29 10:19:56 UTC (rev 238663)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering-worker-expected.txt 2018-11-29 10:30:29 UTC (rev 238664)
@@ -1,21 +0,0 @@
-
-PASS CORS filter on Cache-Control header
-PASS CORS filter on Content-Language header
-PASS CORS filter on Content-Type header
-PASS CORS filter on Expires header
-PASS CORS filter on Last-Modified header
-PASS CORS filter on Pragma header
-PASS CORS filter on Content-Length header
-PASS CORS filter on Age header
-PASS CORS filter on Server header
-PASS CORS filter on Warning header
-PASS CORS filter on Set-Cookie header
-PASS CORS filter on Set-Cookie2 header
-PASS CORS filter on Age header, header is exposed
-PASS CORS filter on Server header, header is exposed
-PASS CORS filter on Warning header, header is exposed
-PASS CORS filter on Set-Cookie header, header is forbidden
-PASS CORS filter on Set-Cookie2 header, header is forbidden
-PASS CORS filter on Set-Cookie header, header is forbidden(credentials = include)
-PASS CORS filter on Set-Cookie2 header, header is forbidden(credentials = include)
-
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering-worker.html (238663 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering-worker.html 2018-11-29 10:19:56 UTC (rev 238663)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering-worker.html 2018-11-29 10:30:29 UTC (rev 238664)
@@ -1,18 +0,0 @@
-<!doctype html>
-<html>
- <head>
- <meta charset="utf-8">
- <title>Fetch in worker: filtered headers in CORS response</title>
- <meta name="help" href=""
- <meta name="help" href=""
- <meta name="help" href=""
- <meta name="author" title="Canon Research France" href=""
- <script src=""
- <script src=""
- </head>
- <body>
- <script>
- fetch_tests_from_worker(new Worker("cors-filtering.js?pipe=sub"));
- </script>
- </body>
-</html>
\ No newline at end of file
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.html (238663 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.html 2018-11-29 10:19:56 UTC (rev 238663)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.html 2018-11-29 10:30:29 UTC (rev 238664)
@@ -1,17 +0,0 @@
-<!doctype html>
-<html>
- <head>
- <meta charset="utf-8">
- <title>Fetch: filtered headers in CORS response</title>
- <meta name="help" href=""
- <meta name="help" href=""
- <meta name="help" href=""
- <meta name="author" title="Canon Research France" href=""
- <script src=""
- <script src=""
- </head>
- <body>
- <script src=""
- <script src=""
- </body>
-</html>
\ No newline at end of file
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.js (238663 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.js 2018-11-29 10:19:56 UTC (rev 238663)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.js 2018-11-29 10:30:29 UTC (rev 238664)
@@ -1,72 +0,0 @@
-if (this.document === undefined) {
- importScripts("/resources/testharness.js");
- importScripts("../resources/utils.js");
-}
-
-function corsFilter(corsUrl, headerName, headerValue, isFiltered) {
- var url = "" + "?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, withCredentials) {
- var url = "" + "?pipe=header(" + headerName + "," + encodeURIComponent(headerValue) +")|" +
- "header(Access-Control-Allow-Origin, http://{{host}}:{{ports[http][0]}})" +
- "header(Access-Control-Allow-Credentials, true)" +
- "header(Access-Control-Expose-Headers," + headerName + ")";
-
- var title = "CORS filter on " + headerName + " header, header is " + (isForbidden ? "forbidden" : "exposed");
- if (withCredentials)
- title+= "(credentials = include)";
- promise_test(function(test) {
- return fetch(new Request(url, { credentials: withCredentials ? "include" : "omit" })).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();
- });
- }, title);
-}
-
-var url = "" + 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, "Content-Length", "3" , false); // top.txt contains "top"
-
-corsFilter(url, "Age", "27", true);
-corsFilter(url, "Server", "wptServe" , true);
-corsFilter(url, "Warning", "Mind the gap" , 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, "Set-Cookie", "name=value" , true);
-corsExposeFilter(url, "Set-Cookie2", "name=value" , true);
-corsExposeFilter(url, "Set-Cookie", "name=value" , true, true);
-corsExposeFilter(url, "Set-Cookie2", "name=value" , true, true);
-
-done();
Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.sub.any-expected.txt (from rev 238663, trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering-expected.txt) (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.sub.any-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.sub.any-expected.txt 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1,21 @@
+
+PASS CORS filter on Cache-Control header
+PASS CORS filter on Content-Language header
+PASS CORS filter on Content-Type header
+PASS CORS filter on Expires header
+PASS CORS filter on Last-Modified header
+PASS CORS filter on Pragma header
+PASS CORS filter on Content-Length header
+PASS CORS filter on Age header
+PASS CORS filter on Server header
+PASS CORS filter on Warning header
+PASS CORS filter on Set-Cookie header
+PASS CORS filter on Set-Cookie2 header
+PASS CORS filter on Age header, header is exposed
+PASS CORS filter on Server header, header is exposed
+PASS CORS filter on Warning header, header is exposed
+PASS CORS filter on Set-Cookie header, header is forbidden
+PASS CORS filter on Set-Cookie2 header, header is forbidden
+PASS CORS filter on Set-Cookie header, header is forbidden(credentials = include)
+PASS CORS filter on Set-Cookie2 header, header is forbidden(credentials = include)
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.sub.any.html (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.sub.any.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.sub.any.html 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.sub.any.js (from rev 238663, trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.js) (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.sub.any.js (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.sub.any.js 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1,69 @@
+// META: script=../resources/utils.js
+
+function corsFilter(corsUrl, headerName, headerValue, isFiltered) {
+ var url = "" + "?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, withCredentials) {
+ var url = "" + "?pipe=header(" + headerName + "," + encodeURIComponent(headerValue) +")|" +
+ "header(Access-Control-Allow-Origin, http://{{host}}:{{ports[http][0]}})" +
+ "header(Access-Control-Allow-Credentials, true)" +
+ "header(Access-Control-Expose-Headers," + headerName + ")";
+
+ var title = "CORS filter on " + headerName + " header, header is " + (isForbidden ? "forbidden" : "exposed");
+ if (withCredentials)
+ title+= "(credentials = include)";
+ promise_test(function(test) {
+ return fetch(new Request(url, { credentials: withCredentials ? "include" : "omit" })).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();
+ });
+ }, title);
+}
+
+var url = "" + 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, "Content-Length", "3" , false); // top.txt contains "top"
+
+corsFilter(url, "Age", "27", true);
+corsFilter(url, "Server", "wptServe" , true);
+corsFilter(url, "Warning", "Mind the gap" , 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, "Set-Cookie", "name=value" , true);
+corsExposeFilter(url, "Set-Cookie2", "name=value" , true);
+corsExposeFilter(url, "Set-Cookie", "name=value" , true, true);
+corsExposeFilter(url, "Set-Cookie2", "name=value" , true, true);
+
+done();
Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.sub.any.worker-expected.txt (from rev 238663, trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering-worker-expected.txt) (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.sub.any.worker-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.sub.any.worker-expected.txt 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1,21 @@
+
+PASS CORS filter on Cache-Control header
+PASS CORS filter on Content-Language header
+PASS CORS filter on Content-Type header
+PASS CORS filter on Expires header
+PASS CORS filter on Last-Modified header
+PASS CORS filter on Pragma header
+PASS CORS filter on Content-Length header
+PASS CORS filter on Age header
+PASS CORS filter on Server header
+PASS CORS filter on Warning header
+PASS CORS filter on Set-Cookie header
+PASS CORS filter on Set-Cookie2 header
+PASS CORS filter on Age header, header is exposed
+PASS CORS filter on Server header, header is exposed
+PASS CORS filter on Warning header, header is exposed
+PASS CORS filter on Set-Cookie header, header is forbidden
+PASS CORS filter on Set-Cookie2 header, header is forbidden
+PASS CORS filter on Set-Cookie header, header is forbidden(credentials = include)
+PASS CORS filter on Set-Cookie2 header, header is forbidden(credentials = include)
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.sub.any.worker.html (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.sub.any.worker.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.sub.any.worker.html 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins-expected.txt (238663 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins-expected.txt 2018-11-29 10:19:56 UTC (rev 238663)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins-expected.txt 2018-11-29 10:30:29 UTC (rev 238664)
@@ -1,20 +0,0 @@
-CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
-CONSOLE MESSAGE: Fetch API cannot load http://localhost:8801/fetch/api/resources/preflight.py?origin=%22%22%2C%20http%3A%2F%2Fexample.com%2C%20http%3A%2F%2Flocalhost%3A8800 due to access control checks.
-CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
-CONSOLE MESSAGE: Fetch API cannot load http://localhost:8801/fetch/api/resources/preflight.py?origin=%22%22%2C%20http%3A%2F%2Fexample.com%2C%20* due to access control checks.
-CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
-CONSOLE MESSAGE: Fetch API cannot load http://localhost:8801/fetch/api/resources/preflight.py?origin=%22%22%2C%20http%3A%2F%2Flocalhost%3A8800%2C%20http%3A%2F%2Flocalhost%3A8800 due to access control checks.
-CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
-CONSOLE MESSAGE: Fetch API cannot load http://localhost:8801/fetch/api/resources/preflight.py?origin=*%2C%20http%3A%2F%2Fexample.com%2C%20* due to access control checks.
-CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
-CONSOLE MESSAGE: Fetch API cannot load http://localhost:8801/fetch/api/resources/preflight.py?origin=*%2C%20http%3A%2F%2Fexample.com%2C%20http%3A%2F%2Flocalhost%3A8800 due to access control checks.
-CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
-CONSOLE MESSAGE: Fetch API cannot load http://localhost:8801/fetch/api/resources/preflight.py?origin=%2C%20http%3A%2F%2Fexample.com%2C%20https%3A%2F%2Fexample2.com due to access control checks.
-
-FAIL 3 origins allowed, match the 3rd (http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Access-Control-Allow-Origin cannot contain more than one origin."
-FAIL 3 origins allowed, match the 3rd ("*") promise_test: Unhandled rejection with value: object "TypeError: Access-Control-Allow-Origin cannot contain more than one origin."
-FAIL 3 origins allowed, match twice (http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Access-Control-Allow-Origin cannot contain more than one origin."
-FAIL 3 origins allowed, match twice ("*") promise_test: Unhandled rejection with value: object "TypeError: Access-Control-Allow-Origin cannot contain more than one origin."
-FAIL 3 origins allowed, match twice ("*" and http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Access-Control-Allow-Origin cannot contain more than one origin."
-PASS 3 origins allowed, no match
-
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins-worker-expected.txt (238663 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins-worker-expected.txt 2018-11-29 10:19:56 UTC (rev 238663)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins-worker-expected.txt 2018-11-29 10:30:29 UTC (rev 238664)
@@ -1,14 +0,0 @@
-CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
-CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
-CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
-CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
-CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
-CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
-
-FAIL 3 origins allowed, match the 3rd (http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Access-Control-Allow-Origin cannot contain more than one origin."
-FAIL 3 origins allowed, match the 3rd ("*") promise_test: Unhandled rejection with value: object "TypeError: Access-Control-Allow-Origin cannot contain more than one origin."
-FAIL 3 origins allowed, match twice (http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Access-Control-Allow-Origin cannot contain more than one origin."
-FAIL 3 origins allowed, match twice ("*") promise_test: Unhandled rejection with value: object "TypeError: Access-Control-Allow-Origin cannot contain more than one origin."
-FAIL 3 origins allowed, match twice ("*" and http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Access-Control-Allow-Origin cannot contain more than one origin."
-PASS 3 origins allowed, no match
-
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins-worker.html (238663 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins-worker.html 2018-11-29 10:19:56 UTC (rev 238663)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins-worker.html 2018-11-29 10:30:29 UTC (rev 238664)
@@ -1,19 +0,0 @@
-<!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=""
- <meta name="help" href=""
- <meta name="help" href=""
- <meta name="help" href=""
- <meta name="help" href=""
- <script src=""
- <script src=""
- </head>
- <body>
- <script>
- fetch_tests_from_worker(new Worker("cors-multiple-origins.js?pipe=sub"));
- </script>
- </body>
-</html>
\ No newline at end of file
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.html (238663 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.html 2018-11-29 10:19:56 UTC (rev 238663)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.html 2018-11-29 10:30:29 UTC (rev 238664)
@@ -1,18 +0,0 @@
-<!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=""
- <meta name="help" href=""
- <meta name="help" href=""
- <meta name="help" href=""
- <meta name="help" href=""
- <script src=""
- <script src=""
- </head>
- <body>
- <script src=""
- <script src=""
- </body>
-</html>
\ No newline at end of file
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.js (238663 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.js 2018-11-29 10:19:56 UTC (rev 238663)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.js 2018-11-29 10:30:29 UTC (rev 238664)
@@ -1,32 +0,0 @@
-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 = "" + 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();
Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.sub.any-expected.txt (from rev 238663, trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins-expected.txt) (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.sub.any-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.sub.any-expected.txt 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1,20 @@
+CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8801/fetch/api/resources/preflight.py?origin=%22%22%2C%20http%3A%2F%2Fexample.com%2C%20http%3A%2F%2Flocalhost%3A8800 due to access control checks.
+CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8801/fetch/api/resources/preflight.py?origin=%22%22%2C%20http%3A%2F%2Fexample.com%2C%20* due to access control checks.
+CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8801/fetch/api/resources/preflight.py?origin=%22%22%2C%20http%3A%2F%2Flocalhost%3A8800%2C%20http%3A%2F%2Flocalhost%3A8800 due to access control checks.
+CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8801/fetch/api/resources/preflight.py?origin=*%2C%20http%3A%2F%2Fexample.com%2C%20* due to access control checks.
+CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8801/fetch/api/resources/preflight.py?origin=*%2C%20http%3A%2F%2Fexample.com%2C%20http%3A%2F%2Flocalhost%3A8800 due to access control checks.
+CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8801/fetch/api/resources/preflight.py?origin=%2C%20http%3A%2F%2Fexample.com%2C%20https%3A%2F%2Fexample2.com due to access control checks.
+
+PASS Listing multiple origins is illegal: "",http://example.com,http://localhost:8800
+PASS Listing multiple origins is illegal: "",http://example.com,*
+PASS Listing multiple origins is illegal: "",http://localhost:8800,http://localhost:8800
+PASS Listing multiple origins is illegal: *,http://example.com,*
+PASS Listing multiple origins is illegal: *,http://example.com,http://localhost:8800
+PASS Listing multiple origins is illegal: ,http://example.com,https://example2.com
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.sub.any.html (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.sub.any.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.sub.any.html 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.sub.any.js (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.sub.any.js (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.sub.any.js 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1,21 @@
+// META: script=../resources/utils.js
+
+function corsMultipleOrigins(originList) {
+ var urlParameters = "?origin=" + encodeURIComponent(originList.join(", "));
+ var url = "" + dirname(location.pathname) + RESOURCES_DIR + "preflight.py";
+
+ promise_test(function(test) {
+ return promise_rejects(test, new TypeError(), fetch(url + urlParameters));
+ }, "Listing multiple origins is illegal: " + originList);
+}
+/* Actual origin */
+var origin = "http://{{host}}:{{ports[http][0]}}";
+
+corsMultipleOrigins(["\"\"", "http://example.com", origin]);
+corsMultipleOrigins(["\"\"", "http://example.com", "*"]);
+corsMultipleOrigins(["\"\"", origin, origin]);
+corsMultipleOrigins(["*", "http://example.com", "*"]);
+corsMultipleOrigins(["*", "http://example.com", origin]);
+corsMultipleOrigins(["", "http://example.com", "https://example2.com"]);
+
+done();
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.sub.any.worker-expected.txt (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.sub.any.worker-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.sub.any.worker-expected.txt 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1,14 @@
+CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
+CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
+CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
+CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
+CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
+CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin.
+
+PASS Listing multiple origins is illegal: "",http://example.com,http://localhost:8800
+PASS Listing multiple origins is illegal: "",http://example.com,*
+PASS Listing multiple origins is illegal: "",http://localhost:8800,http://localhost:8800
+PASS Listing multiple origins is illegal: *,http://example.com,*
+PASS Listing multiple origins is illegal: *,http://example.com,http://localhost:8800
+PASS Listing multiple origins is illegal: ,http://example.com,https://example2.com
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.sub.any.worker.html (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.sub.any.worker.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.sub.any.worker.html 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-not-cors-safelisted.any-expected.txt (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-not-cors-safelisted.any-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-not-cors-safelisted.any-expected.txt 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1,12 @@
+
+PASS Loading data…
+PASS Need CORS-preflight for accept/" header
+FAIL Need CORS-preflight for accept/012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 header assert_equals: Preflight request has been made expected "1" but got "0"
+PASS Need CORS-preflight for accept-language/ header
+PASS Need CORS-preflight for accept-language/@ header
+PASS Need CORS-preflight for content-language/ header
+PASS Need CORS-preflight for content-language/@ header
+PASS Need CORS-preflight for content-type/text/html header
+FAIL Need CORS-preflight for content-type/text/plain; long=0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901 header assert_equals: Preflight request has been made expected "1" but got "0"
+PASS Need CORS-preflight for test/hi header
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-not-cors-safelisted.any.html (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-not-cors-safelisted.any.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-not-cors-safelisted.any.html 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-not-cors-safelisted.any.js (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-not-cors-safelisted.any.js (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-not-cors-safelisted.any.js 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1,19 @@
+// META: script=/common/utils.js
+// META: script=../resources/utils.js
+// META: script=/common/get-host-info.sub.js
+// META: script=resources/corspreflight.js
+
+const corsURL = get_host_info().HTTP_REMOTE_ORIGIN + dirname(location.pathname) + RESOURCES_DIR + "preflight.py";
+
+promise_test(() => fetch("resources/not-cors-safelisted.json").then(res => res.json().then(runTests)), "Loading data…");
+
+function runTests(testArray) {
+ testArray.forEach(testItem => {
+ const [headerName, headerValue] = testItem;
+ corsPreflight("Need CORS-preflight for " + headerName + "/" + headerValue + " header",
+ corsURL,
+ "GET",
+ true,
+ [[headerName, headerValue]]);
+ });
+}
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-not-cors-safelisted.any.worker-expected.txt (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-not-cors-safelisted.any.worker-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-not-cors-safelisted.any.worker-expected.txt 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1,12 @@
+
+PASS Loading data…
+PASS Need CORS-preflight for accept/" header
+FAIL Need CORS-preflight for accept/012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 header assert_equals: Preflight request has been made expected "1" but got "0"
+PASS Need CORS-preflight for accept-language/ header
+PASS Need CORS-preflight for accept-language/@ header
+PASS Need CORS-preflight for content-language/ header
+PASS Need CORS-preflight for content-language/@ header
+PASS Need CORS-preflight for content-type/text/html header
+FAIL Need CORS-preflight for content-type/text/plain; long=0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901 header assert_equals: Preflight request has been made expected "1" but got "0"
+PASS Need CORS-preflight for test/hi header
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-not-cors-safelisted.any.worker.html (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-not-cors-safelisted.any.worker.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-not-cors-safelisted.any.worker.html 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight.any.js (238663 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight.any.js 2018-11-29 10:19:56 UTC (rev 238663)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight.any.js 2018-11-29 10:30:29 UTC (rev 238664)
@@ -1,66 +1,8 @@
// META: script=/common/utils.js
// META: script=../resources/utils.js
// META: script=/common/get-host-info.sub.js
+// META: script=resources/corspreflight.js
-function headerNames(headers)
-{
- let names = [];
- for (let header of headers)
- names.push(header[0].toLowerCase());
- return names
-}
-
-/*
- 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, safeHeaders) {
- return promise_test(function(test) {
- var uuid_token = token();
- return fetch(RESOURCES_DIR + "clean-stash.py?token=" + uuid_token).then(function(response) {
- var url = "" + (corsUrl.indexOf("?") === -1 ? "?" : "&");
- var urlParameters = "token=" + uuid_token + "&max_age=0";
- var requestInit = {"mode": "cors", "method": method};
- var requestHeaders = [];
- if (headers)
- requestHeaders.push.apply(requestHeaders, headers);
- if (safeHeaders)
- requestHeaders.push.apply(requestHeaders, safeHeaders);
- requestInit["headers"] = requestHeaders;
-
- if (allowed) {
- urlParameters += "&allow_methods=" + method + "&control_request_headers";
- if (headers) {
- //Make the server allow the headers
- urlParameters += "&allow_headers=" + headerNames(headers).join("%20%2C");
- }
- 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").toLowerCase().split(",");
- for (var i in actualHeaders)
- actualHeaders[i] = actualHeaders[i].trim();
- for (var header of headers)
- assert_in_array(header[0].toLowerCase(), actualHeaders, "Preflight asked permission for header: " + header);
-
- let accessControlAllowHeaders = headerNames(headers).sort().join(",");
- assert_equals(resp.headers.get("x-control-request-headers"), accessControlAllowHeaders, "Access-Control-Allow-Headers value");
- return fetch(RESOURCES_DIR + "clean-stash.py?token=" + uuid_token);
- } else {
- assert_equals(resp.headers.get("x-control-request-headers"), null, "Access-Control-Request-Headers should be omitted")
- }
- });
- } else {
- return promise_rejects(test, new TypeError(), fetch(url + urlParameters, requestInit)).then(function(){
- return fetch(RESOURCES_DIR + "clean-stash.py?token=" + uuid_token);
- });
- }
- });
- }, desc);
-}
-
var corsUrl = get_host_info().HTTP_REMOTE_ORIGIN + dirname(location.pathname) + RESOURCES_DIR + "preflight.py";
corsPreflight("CORS [DELETE], server allows", corsUrl, "DELETE", true);
Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/resources/corspreflight.js (from rev 238663, trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight.any.js) (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/resources/corspreflight.js (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/resources/corspreflight.js 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1,58 @@
+function headerNames(headers) {
+ let names = [];
+ for (let header of headers) {
+ names.push(header[0].toLowerCase());
+ }
+ return names;
+}
+
+/*
+ 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, safeHeaders) {
+ return promise_test(function(test) {
+ var uuid_token = token();
+ return fetch(RESOURCES_DIR + "clean-stash.py?token=" + uuid_token).then(function(response) {
+ var url = "" + (corsUrl.indexOf("?") === -1 ? "?" : "&");
+ var urlParameters = "token=" + uuid_token + "&max_age=0";
+ var requestInit = {"mode": "cors", "method": method};
+ var requestHeaders = [];
+ if (headers)
+ requestHeaders.push.apply(requestHeaders, headers);
+ if (safeHeaders)
+ requestHeaders.push.apply(requestHeaders, safeHeaders);
+ requestInit["headers"] = requestHeaders;
+
+ if (allowed) {
+ urlParameters += "&allow_methods=" + method + "&control_request_headers";
+ if (headers) {
+ //Make the server allow the headers
+ urlParameters += "&allow_headers=" + headerNames(headers).join("%20%2C");
+ }
+ 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").toLowerCase().split(",");
+ for (var i in actualHeaders)
+ actualHeaders[i] = actualHeaders[i].trim();
+ for (var header of headers)
+ assert_in_array(header[0].toLowerCase(), actualHeaders, "Preflight asked permission for header: " + header);
+
+ let accessControlAllowHeaders = headerNames(headers).sort().join(",");
+ assert_equals(resp.headers.get("x-control-request-headers"), accessControlAllowHeaders, "Access-Control-Allow-Headers value");
+ return fetch(RESOURCES_DIR + "clean-stash.py?token=" + uuid_token);
+ } else {
+ assert_equals(resp.headers.get("x-control-request-headers"), null, "Access-Control-Request-Headers should be omitted")
+ }
+ });
+ } else {
+ return promise_rejects(test, new TypeError(), fetch(url + urlParameters, requestInit)).then(function(){
+ return fetch(RESOURCES_DIR + "clean-stash.py?token=" + uuid_token);
+ });
+ }
+ });
+ }, desc);
+}
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/resources/not-cors-safelisted.json (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/resources/not-cors-safelisted.json (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/resources/not-cors-safelisted.json 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1,11 @@
+[
+ ["accept", "\""],
+ ["accept", "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678"],
+ ["accept-language", "\u0001"],
+ ["accept-language", "@"],
+ ["content-language", "\u0001"],
+ ["content-language", "@"],
+ ["content-type", "text/html"],
+ ["content-type", "text/plain; long=0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901"],
+ ["test", "hi"]
+]
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/resources/w3c-import.log (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/resources/w3c-import.log (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/resources/w3c-import.log 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1,18 @@
+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the WPT github:
+ https://github.com/web-platform-tests/wpt
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/resources/corspreflight.js
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/resources/not-cors-safelisted.json
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/sandboxed-iframe-expected.txt (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/sandboxed-iframe-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/sandboxed-iframe-expected.txt 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1,6 @@
+
+
+Harness Error (TIMEOUT), message = null
+
+TIMEOUT CORS with sandboxed iframe Test timed out
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/sandboxed-iframe.html (0 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/sandboxed-iframe.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/sandboxed-iframe.html 2018-11-29 10:30:29 UTC (rev 238664)
@@ -0,0 +1,14 @@
+<!doctype html>
+<html>
+<script src=""
+<script src=""
+<iframe sandbox="allow-scripts" src=""
+<script>
+promise_test(async (t) => {
+ const message = await new Promise((resolve) => {
+ window.addEventListener('message', e => resolve(e.data));
+ });
+ assert_equals(message, 'PASS');
+}, 'CORS with sandboxed iframe');
+</script>
+</html>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/w3c-import.log (238663 => 238664)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/w3c-import.log 2018-11-29 10:19:56 UTC (rev 238663)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/w3c-import.log 2018-11-29 10:30:29 UTC (rev 238664)
@@ -1,7 +1,7 @@
The tests in this directory were imported from the W3C repository.
Do NOT modify these tests directly in WebKit.
Instead, create a pull request on the WPT github:
- https://github.com/w3c/web-platform-tests
+ https://github.com/web-platform-tests/wpt
Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
@@ -15,19 +15,15 @@
------------------------------------------------------------------------
List of files:
/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-basic.any.js
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-redirect.any.js
/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies.any.js
-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star-worker.html
-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.html
-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.js
-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering-worker.html
-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.html
-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.js
-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins-worker.html
-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.html
-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.js
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-expose-star.sub.any.js
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering.sub.any.js
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins.sub.any.js
/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-no-preflight.any.js
/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-origin.any.js
/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-cache.any.js
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-not-cors-safelisted.any.js
/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-redirect.any.js
/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-referrer.any.js
/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-star.any.js
@@ -36,3 +32,4 @@
/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-redirect-credentials.any.js
/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-redirect-preflight.any.js
/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-redirect.any.js
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/sandboxed-iframe.html