Refresh WPT tests up to 98ec1ad
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Jul 2016 16:08:56 +0000 (16:08 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Jul 2016 16:08:56 +0000 (16:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=159879

Patch by Youenn Fablet <youennf@gmail.com> on 2016-07-19
Reviewed by Alex Christensen.

This refresh concerns fetch API tests with a number of test fixes.
Rebasing both window and worker expectations.

* resources/TestRepositories:
* web-platform-tests/fetch/api/basic/mode-same-origin-expected.txt:
* web-platform-tests/fetch/api/basic/mode-same-origin-worker-expected.txt:
* web-platform-tests/fetch/api/basic/mode-same-origin-worker.html:
* web-platform-tests/fetch/api/basic/mode-same-origin.html:
* web-platform-tests/fetch/api/basic/mode-same-origin.js:
* web-platform-tests/fetch/api/cors/cors-basic-worker.html:
* web-platform-tests/fetch/api/cors/cors-basic.html:
* web-platform-tests/fetch/api/cors/cors-basic.js:
(cors):
* web-platform-tests/fetch/api/cors/cors-cookies-expected.txt:
* web-platform-tests/fetch/api/cors/cors-cookies-worker-expected.txt:
* web-platform-tests/fetch/api/cors/cors-cookies-worker.html:
* web-platform-tests/fetch/api/cors/cors-cookies.html:
* web-platform-tests/fetch/api/cors/cors-cookies.js:
(corsCookies):
* web-platform-tests/fetch/api/cors/cors-no-preflight-worker.html:
* web-platform-tests/fetch/api/cors/cors-no-preflight.html:
* web-platform-tests/fetch/api/cors/cors-no-preflight.js:
(corsNoPreflight):
* web-platform-tests/fetch/api/cors/cors-origin-worker.html:
* web-platform-tests/fetch/api/cors/cors-origin.html:
* web-platform-tests/fetch/api/cors/cors-origin.js:
(corsOrigin):
* web-platform-tests/fetch/api/cors/cors-preflight-redirect-worker.html:
* web-platform-tests/fetch/api/cors/cors-preflight-redirect.html:
* web-platform-tests/fetch/api/cors/cors-preflight-redirect.js:
* web-platform-tests/fetch/api/cors/cors-preflight-referrer-expected.txt:
* web-platform-tests/fetch/api/cors/cors-preflight-referrer-worker-expected.txt:
* web-platform-tests/fetch/api/cors/cors-preflight-referrer-worker.html:
* web-platform-tests/fetch/api/cors/cors-preflight-referrer.html:
* web-platform-tests/fetch/api/cors/cors-preflight-referrer.js:
(corsPreflightReferrer):
* web-platform-tests/fetch/api/cors/cors-preflight-status-worker.html:
* web-platform-tests/fetch/api/cors/cors-preflight-status.html:
* web-platform-tests/fetch/api/cors/cors-preflight-status.js:
* web-platform-tests/fetch/api/cors/cors-redirect-credentials.html:
* web-platform-tests/fetch/api/cors/cors-redirect-credentials.js:
* web-platform-tests/fetch/api/cors/cors-redirect-worker.html:
* web-platform-tests/fetch/api/cors/cors-redirect.html:
* web-platform-tests/fetch/api/cors/cors-redirect.js:
* web-platform-tests/fetch/api/request/request-cache.html:
* web-platform-tests/fetch/api/request/resources/w3c-import.log:
* web-platform-tests/fetch/api/resources/get-host-info.sub.js: Added.
(get_host_info):
* web-platform-tests/fetch/api/resources/utils.js:
(validateBufferFromString):
* web-platform-tests/fetch/api/resources/w3c-import.log:
* web-platform-tests/fetch/api/response/response-clone-expected.txt:
* web-platform-tests/fetch/api/response/response-clone.html:
* web-platform-tests/fetch/api/response/response-consume-stream-expected.txt:

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

45 files changed:
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/resources/TestRepositories
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin-worker-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin-worker.html
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin.html
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin.js
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-basic-worker.html
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-basic.html
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-basic.js
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-worker-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-worker.html
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies.html
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies.js
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-no-preflight-worker.html
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-no-preflight.html
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-no-preflight.js
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-origin-worker.html
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-origin.html
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-origin.js
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-redirect-worker.html
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-redirect.html
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-redirect.js
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-referrer-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-referrer-worker-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-referrer-worker.html
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-referrer.html
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-referrer.js
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-status-worker.html
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-status.html
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-status.js
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-redirect-credentials.html
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-redirect-credentials.js
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-redirect-worker.html
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-redirect.html
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-redirect.js
LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache.html
LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/w3c-import.log
LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/get-host-info.sub.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/utils.js
LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/w3c-import.log
LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone.html
LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-stream-expected.txt

index fa0a1e7ed67c3eb36776efdd6a257782ab0e6ba5..8b6bc414cb3828f80b4b2c6bf55c772dbf9d9d78 100644 (file)
@@ -1,3 +1,65 @@
+2016-07-19  Youenn Fablet  <youennf@gmail.com>
+
+        Refresh WPT tests up to 98ec1ad
+        https://bugs.webkit.org/show_bug.cgi?id=159879
+
+        Reviewed by Alex Christensen.
+
+        This refresh concerns fetch API tests with a number of test fixes.
+        Rebasing both window and worker expectations.
+
+        * resources/TestRepositories:
+        * web-platform-tests/fetch/api/basic/mode-same-origin-expected.txt:
+        * web-platform-tests/fetch/api/basic/mode-same-origin-worker-expected.txt:
+        * web-platform-tests/fetch/api/basic/mode-same-origin-worker.html:
+        * web-platform-tests/fetch/api/basic/mode-same-origin.html:
+        * web-platform-tests/fetch/api/basic/mode-same-origin.js:
+        * web-platform-tests/fetch/api/cors/cors-basic-worker.html:
+        * web-platform-tests/fetch/api/cors/cors-basic.html:
+        * web-platform-tests/fetch/api/cors/cors-basic.js:
+        (cors):
+        * web-platform-tests/fetch/api/cors/cors-cookies-expected.txt:
+        * web-platform-tests/fetch/api/cors/cors-cookies-worker-expected.txt:
+        * web-platform-tests/fetch/api/cors/cors-cookies-worker.html:
+        * web-platform-tests/fetch/api/cors/cors-cookies.html:
+        * web-platform-tests/fetch/api/cors/cors-cookies.js:
+        (corsCookies):
+        * web-platform-tests/fetch/api/cors/cors-no-preflight-worker.html:
+        * web-platform-tests/fetch/api/cors/cors-no-preflight.html:
+        * web-platform-tests/fetch/api/cors/cors-no-preflight.js:
+        (corsNoPreflight):
+        * web-platform-tests/fetch/api/cors/cors-origin-worker.html:
+        * web-platform-tests/fetch/api/cors/cors-origin.html:
+        * web-platform-tests/fetch/api/cors/cors-origin.js:
+        (corsOrigin):
+        * web-platform-tests/fetch/api/cors/cors-preflight-redirect-worker.html:
+        * web-platform-tests/fetch/api/cors/cors-preflight-redirect.html:
+        * web-platform-tests/fetch/api/cors/cors-preflight-redirect.js:
+        * web-platform-tests/fetch/api/cors/cors-preflight-referrer-expected.txt:
+        * web-platform-tests/fetch/api/cors/cors-preflight-referrer-worker-expected.txt:
+        * web-platform-tests/fetch/api/cors/cors-preflight-referrer-worker.html:
+        * web-platform-tests/fetch/api/cors/cors-preflight-referrer.html:
+        * web-platform-tests/fetch/api/cors/cors-preflight-referrer.js:
+        (corsPreflightReferrer):
+        * web-platform-tests/fetch/api/cors/cors-preflight-status-worker.html:
+        * web-platform-tests/fetch/api/cors/cors-preflight-status.html:
+        * web-platform-tests/fetch/api/cors/cors-preflight-status.js:
+        * web-platform-tests/fetch/api/cors/cors-redirect-credentials.html:
+        * web-platform-tests/fetch/api/cors/cors-redirect-credentials.js:
+        * web-platform-tests/fetch/api/cors/cors-redirect-worker.html:
+        * web-platform-tests/fetch/api/cors/cors-redirect.html:
+        * web-platform-tests/fetch/api/cors/cors-redirect.js:
+        * web-platform-tests/fetch/api/request/request-cache.html:
+        * web-platform-tests/fetch/api/request/resources/w3c-import.log:
+        * web-platform-tests/fetch/api/resources/get-host-info.sub.js: Added.
+        (get_host_info):
+        * web-platform-tests/fetch/api/resources/utils.js:
+        (validateBufferFromString):
+        * web-platform-tests/fetch/api/resources/w3c-import.log:
+        * web-platform-tests/fetch/api/response/response-clone-expected.txt:
+        * web-platform-tests/fetch/api/response/response-clone.html:
+        * web-platform-tests/fetch/api/response/response-consume-stream-expected.txt:
+
 2016-07-19  Youenn Fablet  <youenn@apple.com>
 
         [Streams API] Make ReadableStream properties not enumerable
index 5d2f7f922bdfadf8e697e8914f494b6134ef3b83..12dc839c4956751da405a249081647df48d4cac0 100644 (file)
@@ -15,7 +15,7 @@
     {
         "name": "web-platform-tests",
         "url": "https://github.com/w3c/web-platform-tests.git", 
-        "revision": "c875b42",
+        "revision": "98ec1ad",
         "paths_to_skip": [
             "conformance-checkers",
             "docs",
index 9c3ae3004af8cb272b34d9151b83db5378326e1d..86260c828e6c01d53a36d348055e52f5ba97d736 100644 (file)
@@ -2,5 +2,5 @@
 PASS Fetch ../resources/top.txt with same-origin mode 
 PASS Fetch http://localhost:8800/fetch/api/resources/top.txt with same-origin mode 
 PASS Fetch https://localhost:9443/fetch/api/resources/top.txt with same-origin mode 
-PASS Fetch http://www.localhost:8800/fetch/api/resources/top.txt with same-origin mode 
+PASS Fetch http://127.0.0.1:8800/fetch/api/resources/top.txt with same-origin mode 
 
index 9c3ae3004af8cb272b34d9151b83db5378326e1d..86260c828e6c01d53a36d348055e52f5ba97d736 100644 (file)
@@ -2,5 +2,5 @@
 PASS Fetch ../resources/top.txt with same-origin mode 
 PASS Fetch http://localhost:8800/fetch/api/resources/top.txt with same-origin mode 
 PASS Fetch https://localhost:9443/fetch/api/resources/top.txt with same-origin mode 
-PASS Fetch http://www.localhost:8800/fetch/api/resources/top.txt with same-origin mode 
+PASS Fetch http://127.0.0.1:8800/fetch/api/resources/top.txt with same-origin mode 
 
index 0c62472aaf184197a85b75a91541e18d15f234b6..cc39af3cb7595089d2b02a7f22e8bce88ebfebf5 100644 (file)
@@ -11,7 +11,7 @@
   </head>
   <body>
     <script>
-      fetch_tests_from_worker(new Worker("mode-same-origin.js?pipe=sub"));
+      fetch_tests_from_worker(new Worker("mode-same-origin.js"));
     </script>
   </body>
-</html>
\ No newline at end of file
+</html>
index d94832a2aa06e597d12fbbaf7cb15cf5f5b5dc13..a81f8657f99f2d38ee7f90c722f1087aeddb7c8d 100644 (file)
@@ -11,6 +11,7 @@
   </head>
   <body>
     <script src="../resources/utils.js"></script>
-    <script src="mode-same-origin.js?pipe=sub"></script>
+    <script src="../resources/get-host-info.sub.js"></script>
+    <script src="mode-same-origin.js"></script>
   </body>
-</html>
\ No newline at end of file
+</html>
index c00d96fad32e9f86aebafb27a7124c2162ff0fc5..ba3cb392b32c5df5e5b2f0b0a326b6eba3a9f937 100644 (file)
@@ -1,6 +1,7 @@
 if (this.document === undefined) {
   importScripts("/resources/testharness.js");
   importScripts("../resources/utils.js");
+  importScripts("../resources/get-host-info.sub.js")
 }
 
 function fetchSameOrigin(url, shouldPass) {
@@ -15,10 +16,12 @@ function fetchSameOrigin(url, shouldPass) {
   }, "Fetch "+ url + " with same-origin mode");
 }
 
+var host_info = get_host_info();
+
 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);
+fetchSameOrigin(host_info.HTTP_ORIGIN + "/fetch/api/resources/top.txt", true);
+fetchSameOrigin(host_info.HTTPS_ORIGIN + "/fetch/api/resources/top.txt", false);
+fetchSameOrigin(host_info.HTTP_REMOTE_ORIGIN + "/fetch/api/resources/top.txt", false);
 
 done();
 
index 97e173c15226f7b73125417d81119865a8deda64..2373bf710b5329ef432d35965a99111e814f686b 100644 (file)
@@ -13,7 +13,7 @@
   </head>
   <body>
     <script>
-      fetch_tests_from_worker(new Worker("cors-basic.js?pipe=sub"));
+      fetch_tests_from_worker(new Worker("cors-basic.js"));
     </script>
   </body>
-</html>
\ No newline at end of file
+</html>
index 4aa38f75b85b7ea7f79ce1df362fafd15d96dc57..a7df4e682c98d67baef85cda8d3dae83bdc82ffe 100644 (file)
@@ -13,6 +13,7 @@
   </head>
   <body>
     <script src="../resources/utils.js"></script>
-    <script src="cors-basic.js?pipe=sub"></script>
+    <script src="../resources/get-host-info.sub.js"></script>
+    <script src="cors-basic.js"></script>
   </body>
-</html>
\ No newline at end of file
+</html>
index 8ee783f610a44b41a9ebe7f810bd50f8a87bdd35..ec06b4c8a852c72de0b5522e29d9733187c557ac 100644 (file)
@@ -1,17 +1,11 @@
 if (this.document === undefined) {
   importScripts("/resources/testharness.js");
   importScripts("../resources/utils.js");
+  importScripts("../resources/get-host-info.sub.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);
+function cors(desc, origin) {
+  var url = origin + dirname(location.pathname);
   var urlParameters = "?pipe=header(Access-Control-Allow-Origin,*)";
 
   promise_test(function(test) {
@@ -36,10 +30,12 @@ function cors(desc, scheme, subdomain, port) {
   }, desc + " [cors mode]");
 }
 
-cors("Same domain different port", "http", undefined, "{{ports[http][1]}}");
-cors("Same domain different protocol different port", "https", undefined, "{{ports[https][0]}}");
-cors("Cross domain basic usage", "http", "www1");
-cors("Cross domain different port", "http", "www1", "{{ports[http][1]}}");
-cors("Cross domain different protocol", "https", "www1", "{{ports[https][0]}}");
+var host_info = get_host_info();
+
+cors("Same domain different port", host_info.HTTP_ORIGIN_WITH_DIFFERENT_PORT);
+cors("Same domain different protocol different port", host_info.HTTPS_ORIGIN);
+cors("Cross domain basic usage", host_info.HTTP_REMOTE_ORIGIN);
+cors("Cross domain different port", host_info.HTTP_REMOTE_ORIGIN_WITH_DIFFERENT_PORT);
+cors("Cross domain different protocol", host_info.HTTPS_REMOTE_ORIGIN);
 
 done();
index 11623e6bdf3bff4fcb25e29ae5590043a7b532b4..d454a40d1cb5bfc741c4197a7459abbcda461ec3 100644 (file)
@@ -3,6 +3,6 @@ FAIL Omit mode: no cookie sent assert_false: Request should have no cookie expec
 FAIL Include mode: 1 cookie promise_test: Unhandled rejection with value: object "TypeError: Type error"
 FAIL Include mode: local cookies are not sent with remote request promise_test: Unhandled rejection with value: object "TypeError: Type error"
 FAIL Include mode: remote cookies are not sent with local request promise_test: Unhandled rejection with value: object "TypeError: Type error"
-FAIL Include mode: remote cookies are not sent with other remote request promise_test: Unhandled rejection with value: object "TypeError: Type error"
 FAIL Same-origin mode: cookies are discarded in cors request promise_test: Unhandled rejection with value: object "TypeError: Type error"
+FAIL Include mode: remote cookies are not sent with other remote request promise_test: Unhandled rejection with value: object "TypeError: Type error"
 
index 11623e6bdf3bff4fcb25e29ae5590043a7b532b4..d454a40d1cb5bfc741c4197a7459abbcda461ec3 100644 (file)
@@ -3,6 +3,6 @@ FAIL Omit mode: no cookie sent assert_false: Request should have no cookie expec
 FAIL Include mode: 1 cookie promise_test: Unhandled rejection with value: object "TypeError: Type error"
 FAIL Include mode: local cookies are not sent with remote request promise_test: Unhandled rejection with value: object "TypeError: Type error"
 FAIL Include mode: remote cookies are not sent with local request promise_test: Unhandled rejection with value: object "TypeError: Type error"
-FAIL Include mode: remote cookies are not sent with other remote request promise_test: Unhandled rejection with value: object "TypeError: Type error"
 FAIL Same-origin mode: cookies are discarded in cors request promise_test: Unhandled rejection with value: object "TypeError: Type error"
+FAIL Include mode: remote cookies are not sent with other remote request promise_test: Unhandled rejection with value: object "TypeError: Type error"
 
index fd79aad8f056abebb886fb019102ec37738fe400..c0738e571d7529e23cc6d91e31c7fc3d80a189e2 100644 (file)
@@ -12,7 +12,7 @@
   </head>
   <body>
     <script>
-      fetch_tests_from_worker(new Worker("cors-cookies.js?pipe=sub"));
+      fetch_tests_from_worker(new Worker("cors-cookies.js"));
     </script>
   </body>
-</html>
\ No newline at end of file
+</html>
index 8fb6a7c0cd7d49243b0eb79c3e669837b41d4bf9..27fa82b045d46be837e5febfccfb4f78016800dd 100644 (file)
@@ -12,6 +12,7 @@
   </head>
   <body>
     <script src="../resources/utils.js"></script>
-    <script src="cors-cookies.js?pipe=sub"></script>
+    <script src="../resources/get-host-info.sub.js"></script>
+    <script src="cors-cookies.js"></script>
   </body>
-</html>
\ No newline at end of file
+</html>
index 64bc2cc32f483fb12894141cd237deff86965f9c..b31622c2dca86734cd958cd4b10088151369dbab 100644 (file)
@@ -1,11 +1,12 @@
 if (this.document === undefined) {
   importScripts("/resources/testharness.js");
   importScripts("../resources/utils.js");
+  importScripts("../resources/get-host-info.sub.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";
+function corsCookies(desc, baseURL1, baseURL2, credentialsMode, cookies) {
+  var urlSetCookie = baseURL1 + dirname(location.pathname) + RESOURCES_DIR + "top.txt";
+  var urlCheckCookies = baseURL2 + 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)";
@@ -29,7 +30,7 @@ function corsCookies(desc, domain1, domain2, credentialsMode, cookies) {
     }).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) {
+      if (credentialsMode === "include" && baseURL1 === baseURL2) {
         assert_equals(resp.headers.get("x-request-cookie") , cookies.join("; "), "Request includes cookie(s)");
       }
       else {
@@ -44,15 +45,16 @@ function corsCookies(desc, domain1, domain2, credentialsMode, cookies) {
   }, desc);
 }
 
-var local = "{{host}}";
-var remote = "www.{{host}}";
-var remote1 = "www1.{{host}}";
+var local = get_host_info().HTTP_ORIGIN;
+var remote = get_host_info().HTTP_REMOTE_ORIGIN;
+// FIXME: otherRemote might not be accessible on some test environments.
+var otherRemote = "www." + local;
 
 corsCookies("Omit mode: no cookie sent", local, local, "omit", ["g=7"]);
 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("Include mode: remote cookies are not sent with other remote request", remote, otherRemote, "include", ["e=5"]);
 
 done();
index c6402ada09318b30a4d0e590f3c4d7fd0f5b10fd..b65a73e07008280dfa9e1cb7162d4d8220dbe654 100644 (file)
@@ -14,7 +14,7 @@
   </head>
   <body>
     <script>
-      fetch_tests_from_worker(new Worker("cors-no-preflight.js?pipe=sub"));
+      fetch_tests_from_worker(new Worker("cors-no-preflight.js"));
     </script>
   </body>
-</html>
\ No newline at end of file
+</html>
index 3ff5c97eac697fe2a3b785c315cf43d826f03022..f334a09672411e9ad3c99750c553a1b47f3fdb8b 100644 (file)
@@ -15,6 +15,7 @@
   <body>
     <script src="/common/utils.js"></script>
     <script src="../resources/utils.js"></script>
-    <script src="cors-no-preflight.js?pipe=sub"></script>
+    <script src="../resources/get-host-info.sub.js"></script>
+    <script src="cors-no-preflight.js"></script>
   </body>
-</html>
\ No newline at end of file
+</html>
index 8d932cc38bc716d32be04d32089aa10e78bf3bf7..21649ef93968c31ff70cfb51a0948711be52681e 100644 (file)
@@ -1,19 +1,14 @@
 if (this.document === undefined) {
-  importScripts("/resources/testharness.js");
   importScripts("/common/utils.js");
+  importScripts("/resources/testharness.js");
   importScripts("../resources/utils.js");
+  importScripts("../resources/get-host-info.sub.js")
 }
 
-function corsNoPreflight(desc, scheme, subdomain, port, method, headerName, headerValue) {
-  if (!port)
-    port = location.port;
-  if (subdomain)
-    subdomain = subdomain + ".";
-  else
-    subdomain = "";
+function corsNoPreflight(desc, baseURL, method, headerName, headerValue) {
 
   var uuid_token = token();
-  var url = scheme + "://" + subdomain + "{{host}}" + ":" + port + dirname(location.pathname) + RESOURCES_DIR + "preflight.py";
+  var url = baseURL + dirname(location.pathname) + RESOURCES_DIR + "preflight.py";
   var urlParameters = "?token=" + uuid_token + "&max_age=0";
   var requestInit = {"mode": "cors", "method": method, "headers":{}};
   if (headerName)
@@ -29,22 +24,22 @@ function corsNoPreflight(desc, scheme, subdomain, port, method, headerName, head
     });
   }, 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");
+var host_info = get_host_info();
+
+corsNoPreflight("Cross domain basic usage [GET]", host_info.HTTP_REMOTE_ORIGIN, "GET");
+corsNoPreflight("Same domain different port [GET]", host_info.HTTP_ORIGIN_WITH_DIFFERENT_ORIGIN, "GET");
+corsNoPreflight("Cross domain different port [GET]", host_info.HTTP_REMOTE_ORIGIN_WITH_DIFFERENT_ORIGIN, "GET");
+corsNoPreflight("Cross domain different protocol [GET]", host_info.HTTPS_REMOTE_ORIGIN, "GET");
+corsNoPreflight("Same domain different protocol different port [GET]", host_info.HTTPS_ORIGIN, "GET");
+corsNoPreflight("Cross domain [POST]", host_info.HTTP_REMOTE_ORIGIN, "POST");
+corsNoPreflight("Cross domain [HEAD]", host_info.HTTP_REMOTE_ORIGIN, "HEAD");
+corsNoPreflight("Cross domain [GET] [Accept: */*]", host_info.HTTP_REMOTE_ORIGIN, "GET" , "Accept", "*/*");
+corsNoPreflight("Cross domain [GET] [Accept-Language: fr]", host_info.HTTP_REMOTE_ORIGIN, "GET" , "Accept-Language", "fr");
+corsNoPreflight("Cross domain [GET] [Content-Language: fr]", host_info.HTTP_REMOTE_ORIGIN, "GET" , "Content-Language", "fr");
+corsNoPreflight("Cross domain [GET] [Content-Type: application/x-www-form-urlencoded]", host_info.HTTP_REMOTE_ORIGIN, "GET" , "Content-Type", "application/x-www-form-urlencoded");
+corsNoPreflight("Cross domain [GET] [Content-Type: multipart/form-data]", host_info.HTTP_REMOTE_ORIGIN, "GET" , "Content-Type", "multipart/form-data");
+corsNoPreflight("Cross domain [GET] [Content-Type: text/plain]", host_info.HTTP_REMOTE_ORIGIN, "GET" , "Content-Type", "text/plain");
+corsNoPreflight("Cross domain [GET] [Content-Type: text/plain;charset=utf-8]", host_info.HTTP_REMOTE_ORIGIN, "GET" , "Content-Type", "text/plain;charset=utf-8");
 
 done();
index f6145e6e3e1a3be1f3bb0472a36ee2aefeb15301..e59a0b0bdec94d2846a5d0337255c3b010f11309 100644 (file)
@@ -13,7 +13,7 @@
   </head>
   <body>
     <script>
-      fetch_tests_from_worker(new Worker("cors-origin.js?pipe=sub"));
+      fetch_tests_from_worker(new Worker("cors-origin.js"));
     </script>
   </body>
-</html>
\ No newline at end of file
+</html>
index de7a0552accb28aa730eaa496bb649619a2861dd..f1b64ee3c6446beb3150b4a91a7012b9b274750a 100644 (file)
@@ -14,6 +14,7 @@
   <body>
     <script src="/common/utils.js"></script>
     <script src="../resources/utils.js"></script>
-    <script src="cors-origin.js?pipe=sub"></script>
+    <script src="../resources/get-host-info.sub.js"></script>
+    <script src="cors-origin.js"></script>
   </body>
-</html>
\ No newline at end of file
+</html>
index 36052742a5fa3431ef0a3682b35d1dc007ed0a10..890c7c0efa95869f21ce7b1904d0b957c54c9189 100644 (file)
@@ -1,23 +1,18 @@
 if (this.document === undefined) {
+  importScripts("/common/utils.js");
   importScripts("/resources/testharness.js");
   importScripts("../resources/utils.js");
-  importScripts("/common/utils.js");
+  importScripts("../resources/get-host-info.sub.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 = "";
+function corsOrigin(desc, baseURL, method, origin, shouldPass) {
   if (!origin)
-    origin = scheme + "://" + subdomain + "{{host}}" + ":" + port;
+    origin = baseURL;
 
   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 url = baseURL + dirname(location.pathname) + RESOURCES_DIR + "preflight.py";
   var requestInit = {"mode": "cors", "method": method};
 
   promise_test(function(test) {
@@ -34,28 +29,28 @@ function corsOrigin(desc, scheme, subdomain, port, method, origin, shouldPass) {
   }, desc);
 
 }
-var port = "{{ports[http][0]}}";
-var port2 = "{{ports[http][1]}}";
-var httpsPort = "{{ports[https][0]}}";
+
+var host_info = get_host_info();
+
 /* 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);
+var origin = host_info.HTTP_ORIGIN;
+
+corsOrigin("Cross domain different subdomain [origin OK]", host_info.HTTP_REMOTE_ORIGIN, "GET", origin, true);
+corsOrigin("Cross domain different subdomain [origin KO]", host_info.HTTP_REMOTE_ORIGIN, "GET", undefined, false);
+corsOrigin("Same domain different port [origin OK]", host_info.HTTP_ORIGIN_WITH_DIFFERENT_PORT, "GET", origin, true);
+corsOrigin("Same domain different port [origin KO]", host_info.HTTP_ORIGIN_WITH_DIFFERENT_PORT, "GET", undefined, false);
+corsOrigin("Cross domain different port [origin OK]", host_info.HTTP_REMOTE_ORIGIN_WITH_DIFFERENT_PORT, "GET", origin, true);
+corsOrigin("Cross domain different port [origin KO]", host_info.HTTP_REMOTE_ORIGIN_WITH_DIFFERENT_PORT, "GET", undefined, false);
+corsOrigin("Cross domain different protocol [origin OK]", host_info.HTTPS_REMOTE_ORIGIN, "GET", origin, true);
+corsOrigin("Cross domain different protocol [origin KO]", host_info.HTTPS_REMOTE_ORIGIN, "GET", undefined, false);
+corsOrigin("Same domain different protocol different port [origin OK]", host_info.HTTPS_ORIGIN, "GET", origin, true);
+corsOrigin("Same domain different protocol different port [origin KO]", host_info.HTTPS_ORIGIN, "GET", undefined, false);
+corsOrigin("Cross domain [POST] [origin OK]", host_info.HTTP_REMOTE_ORIGIN, "POST", origin, true);
+corsOrigin("Cross domain [POST] [origin KO]", host_info.HTTP_REMOTE_ORIGIN, "POST", undefined, false);
+corsOrigin("Cross domain [HEAD] [origin OK]", host_info.HTTP_REMOTE_ORIGIN, "HEAD", origin, true);
+corsOrigin("Cross domain [HEAD] [origin KO]", host_info.HTTP_REMOTE_ORIGIN, "HEAD", undefined, false);
+corsOrigin("CORS preflight [PUT] [origin OK]", host_info.HTTP_REMOTE_ORIGIN, "PUT", origin, true);
+corsOrigin("CORS preflight [PUT] [origin KO]", host_info.HTTP_REMOTE_ORIGIN, "PUT", undefined, false);
+corsOrigin("Allowed origin: \"\" [origin KO]", host_info.HTTP_REMOTE_ORIGIN, "GET", "" , false);
 
 done();
index 663f5d655c133d67b73edaf5cf81f7fc71c58a72..24066c08d8da9947be11955268616e2a6a9ed4b0 100644 (file)
@@ -12,7 +12,7 @@
   </head>
   <body>
     <script>
-      fetch_tests_from_worker(new Worker("cors-preflight-redirect.js?pipe=sub"));
+      fetch_tests_from_worker(new Worker("cors-preflight-redirect.js"));
     </script>
   </body>
-</html>
\ No newline at end of file
+</html>
index 6f136af76be9bf86a1219a851126d7ee33ca492e..6b6e13723526ca5b38e9142902b8c272afaf4ae4 100644 (file)
@@ -13,6 +13,7 @@
   <body>
     <script src="/common/utils.js"></script>
     <script src="../resources/utils.js"></script>
-    <script src="cors-preflight-redirect.js?pipe=sub"></script>
+    <script src="../resources/get-host-info.sub.js"></script>
+    <script src="cors-preflight-redirect.js"></script>
   </body>
-</html>
\ No newline at end of file
+</html>
index 52a7bca3cd71335727ade98000ea6e4463911f8c..fca3bb3ed5436f594f35bb5af1a45afc85114867 100644 (file)
@@ -2,6 +2,7 @@ if (this.document === undefined) {
   importScripts("/resources/testharness.js");
   importScripts("../resources/utils.js");
   importScripts("/common/utils.js");
+  importScripts("../resources/get-host-info.sub.js");
 }
 
 function corsPreflightRedirect(desc, redirectUrl, redirectLocation, redirectStatus, redirectPreflight) {
@@ -27,8 +28,8 @@ function corsPreflightRedirect(desc, redirectUrl, redirectLocation, redirectStat
   }, 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";
+var redirectUrl = get_host_info().HTTP_REMOTE_ORIGIN + dirname(location.pathname) + RESOURCES_DIR + "redirect.py";
+var locationUrl =  get_host_info().HTTP_REMOTE_ORIGIN + dirname(location.pathname) + RESOURCES_DIR + "preflight.py";
 
 for (var code of [301, 302, 303, 307, 308]) {
   /* preflight should not follow the redirection */
index de10ef2964b2942a4f1dd87650606823573cd2ac..2a2344ed93be1018755610e654a623127ef60037 100644 (file)
@@ -1,7 +1,9 @@
 
-PASS Referrer policy: no-referrer 
-PASS Referrer policy: "" 
-PASS Referrer policy: origin 
-PASS Referrer policy: origin-when-cross-origin 
-PASS Referrer policy: unsafe-url 
+Harness Error (TIMEOUT), message = null
+
+FAIL Referrer policy: no-referrer assert_equals: Clean stash response's status is 200 expected 200 but got 500
+TIMEOUT Referrer policy: "" Test timed out
+TIMEOUT Referrer policy: origin Test timed out
+TIMEOUT Referrer policy: origin-when-cross-origin Test timed out
+TIMEOUT Referrer policy: unsafe-url Test timed out
 
index de10ef2964b2942a4f1dd87650606823573cd2ac..2a2344ed93be1018755610e654a623127ef60037 100644 (file)
@@ -1,7 +1,9 @@
 
-PASS Referrer policy: no-referrer 
-PASS Referrer policy: "" 
-PASS Referrer policy: origin 
-PASS Referrer policy: origin-when-cross-origin 
-PASS Referrer policy: unsafe-url 
+Harness Error (TIMEOUT), message = null
+
+FAIL Referrer policy: no-referrer assert_equals: Clean stash response's status is 200 expected 200 but got 500
+TIMEOUT Referrer policy: "" Test timed out
+TIMEOUT Referrer policy: origin Test timed out
+TIMEOUT Referrer policy: origin-when-cross-origin Test timed out
+TIMEOUT Referrer policy: unsafe-url Test timed out
 
index 4ed9072fb5121445a498ab75422183538dcc7155..6913c7e69b445a56511f6890683441339e47fc34 100644 (file)
@@ -12,7 +12,7 @@
   </head>
   <body>
     <script>
-      fetch_tests_from_worker(new Worker("cors-preflight-referrer.js?pipe=sub"));
+      fetch_tests_from_worker(new Worker("cors-preflight-referrer.js"));
     </script>
   </body>
-</html>
\ No newline at end of file
+</html>
index a399a051cb1e5289944b742491b0921ce6b79019..08ef962eb8479eb0615a0c9a525866caf6154d6c 100644 (file)
@@ -13,6 +13,7 @@
   <body>
     <script src="/common/utils.js"></script>
     <script src="../resources/utils.js"></script>
-    <script src="cors-preflight-referrer.js?pipe=sub"></script>
+    <script src="../resources/get-host-info.sub.js"></script>
+    <script src="cors-preflight-referrer.js"></script>
   </body>
-</html>
\ No newline at end of file
+</html>
index 2abda364fe494011f6e2b92f07facea4fc239736..40e4a7f79012a93fcb15431fc29849a16e1d28aa 100644 (file)
@@ -15,7 +15,7 @@ function corsPreflightReferrer(desc, corsUrl, referrerPolicy, expectedReferrer)
   urlParameters += "&allow_headers=x-force-preflight";
 
   promise_test(function(test) {
-    fetch(RESOURCES_DIR + "clean-stash.py?token=" + uuid_token).then(function(resp) {
+    return 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");
@@ -27,7 +27,7 @@ function corsPreflightReferrer(desc, corsUrl, referrerPolicy, expectedReferrer)
   }, desc);
 }
 
-var corsUrl = "http://www1.{{host}}:{{ports[http][0]}}" + dirname(location.pathname) + RESOURCES_DIR + "preflight.py";
+var corsUrl = "http://{{host}}:{{ports[http][1]}}" + dirname(location.pathname) + RESOURCES_DIR + "preflight.py";
 var origin = "http://{{host}}:{{ports[http][0]}}";
 
 corsPreflightReferrer("Referrer policy: no-referrer", corsUrl, "no-referrer", "");
index 7650c37d1ea37311a87b14226681b14d433269c2..281d7739697369a42a72d8efd7949d93e9287a4a 100644 (file)
@@ -12,7 +12,7 @@
   </head>
   <body>
     <script>
-      fetch_tests_from_worker(new Worker("cors-preflight-status.js?pipe=sub"));
+      fetch_tests_from_worker(new Worker("cors-preflight-status.js"));
     </script>
   </body>
-</html>
\ No newline at end of file
+</html>
index bc11fb755e6be35514d5016bacb7877a4d262f5a..c3a34eac192f8a78ed88cb13bf0aac145ab06f1f 100644 (file)
@@ -12,6 +12,7 @@
   <body>
     <script src="/common/utils.js"></script>
     <script src="../resources/utils.js"></script>
-    <script src="cors-preflight-status.js?pipe=sub"></script>
+    <script src="../resources/get-host-info.sub.js"></script>
+    <script src="cors-preflight-status.js"></script>
   </body>
-</html>
\ No newline at end of file
+</html>
index 07bd23c9003234ebdd5ed8d3cbdba5b5a275747f..414abbe5a2d4f62ed43d85cd6aa33ae2aeff3f82 100644 (file)
@@ -2,6 +2,7 @@ if (this.document === undefined) {
   importScripts("/resources/testharness.js");
   importScripts("../resources/utils.js");
   importScripts("/common/utils.js");
+  importScripts("../resources/get-host-info.sub.js");
 }
 
 /* Check preflight is ok if status is ok status (200  to 299)*/
@@ -31,7 +32,7 @@ function corsPreflightStatus(desc, corsUrl, preflightStatus) {
   }, desc);
 }
 
-var corsUrl = "http://www1.{{host}}:{{ports[http][0]}}" + dirname(location.pathname) + RESOURCES_DIR + "preflight.py";
+var corsUrl = get_host_info().HTTP_REMOTE_ORIGIN + 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,
index 2491f692d10a06cbcd005518191e1f69d644a9ba..d1130239e2b6b96e8a84e2c0ce4d48bc27c137a0 100644 (file)
@@ -10,6 +10,7 @@
   </head>
   <body>
     <script src="../resources/utils.js"></script>
-    <script src="cors-redirect-credentials.js?pipe=sub"></script>
+    <script src="../resources/get-host-info.sub.js"></script>
+    <script src="cors-redirect-credentials.js"></script>
   </body>
-</html>
\ No newline at end of file
+</html>
index 5ffd9451736b15098f95605372084102bd772bff..7add3479afd8f648a49d486e56f3e0d7596fdf51 100644 (file)
@@ -1,6 +1,7 @@
 if (this.document === undefined) {
   importScripts("/resources/testharness.js");
   importScripts("../resources/utils.js");
+  importScripts("../resources/get-host-info.sub.js")
 }
 
 function corsRedirectCredentials(desc, redirectUrl, redirectLocation, redirectStatus, locationCredentials) {
@@ -19,12 +20,14 @@ function corsRedirectCredentials(desc, redirectUrl, redirectLocation, redirectSt
 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://{{host}}:{{ports[http][1]}}" + redirPath;
+var host_info = get_host_info();
 
-var localLocation = "http://{{host}}:{{ports[http][0]}}" + preflightPath;
-var remoteLocation = "http://{{host}}:{{ports[http][1]}}" + preflightPath;
-var remoteLocation2 = "http://www.{{host}}:{{ports[http][0]}}" + preflightPath;
+var localRedirect = host_info.HTTP_ORIGIN + redirPath;
+var remoteRedirect = host_info.HTTP_ORIGIN_WITH_DIFFERENT_PORT + redirPath;
+
+var localLocation = host_info.HTTP_ORIGIN + preflightPath;
+var remoteLocation = host_info.HTTP_ORIGIN_WITH_DIFFERENT_PORT + preflightPath;
+var remoteLocation2 = host_info.HTTP_REMOTE_ORIGIN + 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");
index bf7bd965272a846d92bfa469deb4bc4e52190493..9f8dfb022b7d8cc9d1954eeac7a49b3282975a76 100644 (file)
@@ -11,7 +11,7 @@
   </head>
   <body>
     <script>
-      fetch_tests_from_worker(new Worker("cors-redirect.js?pipe=sub"));
+      fetch_tests_from_worker(new Worker("cors-redirect.js"));
     </script>
   </body>
-</html>
\ No newline at end of file
+</html>
index f88eacf7bc57f8753161123a934066243620bf10..2a610ab18798ec2f4adfc8ae355675b483631954 100644 (file)
@@ -12,6 +12,7 @@
   <body>
     <script src="/common/utils.js"></script>
     <script src="../resources/utils.js"></script>
-    <script src="cors-redirect.js?pipe=sub"></script>
+    <script src="../resources/get-host-info.sub.js"></script>
+    <script src="cors-redirect.js"></script>
   </body>
-</html>
\ No newline at end of file
+</html>
index a818054ab102d9304ca8b08bc0575a04511eccfe..c46cb510b295eb5fe106fe259676a21264c2ceec 100644 (file)
@@ -2,6 +2,7 @@ if (this.document === undefined) {
   importScripts("/resources/testharness.js");
   importScripts("/common/utils.js");
   importScripts("../resources/utils.js");
+  importScripts("../resources/get-host-info.sub.js");
 }
 
 function corsRedirect(desc, redirectUrl, redirectLocation, redirectStatus, expectedOrigin) {
@@ -27,12 +28,14 @@ function corsRedirect(desc, redirectUrl, redirectLocation, redirectStatus, expec
 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 host_info = get_host_info();
 
-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;
+var localRedirect = host_info.HTTP_ORIGIN + redirPath;
+var remoteRedirect = host_info.HTTP_REMOTE_ORIGIN + redirPath;
+
+var localLocation = host_info.HTTP_ORIGIN + preflightPath;
+var remoteLocation = host_info.HTTP_REMOTE_ORIGIN + preflightPath;
+var remoteLocation2 = host_info.HTTP_ORIGIN_WITH_DIFFERENT_PORT + preflightPath;
 
 for (var code of [301, 302, 303, 307, 308]) {
   corsRedirect("Redirect " + code + ": cors to same cors", remoteRedirect, remoteLocation, code, location.origin);
index 9e9b8f4ed8ddeab8897ba9751318a541b95f032a..b1f389c5da4c4789549dd31e1111e611134fb7ee 100644 (file)
@@ -8,7 +8,7 @@
     <script src="/resources/testharness.js"></script>
     <script src="/resources/testharnessreport.js"></script>
     <script src="/common/utils.js"></script>
-    <script src="resources/get-host-info.sub.js"></script>
+    <script src="../resources/get-host-info.sub.js"></script>
   </head>
   <body>
     <script>
index c092823000ed08f0beaefb17041de82931b99262..1ddeea002c9f912e35e289b5dc4a2b75daa191ca 100644 (file)
@@ -16,4 +16,3 @@ None
 ------------------------------------------------------------------------
 List of files:
 /LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/cache.py
-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/get-host-info.sub.js
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/get-host-info.sub.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/get-host-info.sub.js
new file mode 100644 (file)
index 0000000..7e97d43
--- /dev/null
@@ -0,0 +1,36 @@
+// This file is duplicated verbatim from:
+// service-workers/service-worker/resources/get-host-info.sub.js
+// with the rationale that:
+// - it's better to not reinvent this
+// - at the same time, referencing tests deep inside a sibling test group is
+//   not a great idea and copying the file is the lesser evil.
+function get_host_info() {
+  var ORIGINAL_HOST = '127.0.0.1';
+  var REMOTE_HOST = 'localhost';
+  var UNAUTHENTICATED_HOST = 'example.test';
+  var HTTP_PORT = 8000;
+  var HTTP_PORT2 = 8080;
+  var HTTPS_PORT = 8443;
+  try {
+    // In W3C test, we can get the hostname and port number in config.json
+    // using wptserve's built-in pipe.
+    // http://wptserve.readthedocs.org/en/latest/pipes.html#built-in-pipes
+    HTTP_PORT = eval('{{ports[http][0]}}');
+    HTTP_PORT2 = eval('{{ports[http][1]}}');
+    HTTPS_PORT = eval('{{ports[https][0]}}');
+    ORIGINAL_HOST = eval('\'{{host}}\'');
+    REMOTE_HOST = (ORIGINAL_HOST === 'localhost') ? '127.0.0.1' : ('www1.' + ORIGINAL_HOST);
+  } catch (e) {
+  }
+  return {
+    HTTP_ORIGIN: 'http://' + ORIGINAL_HOST + ':' + HTTP_PORT,
+    HTTPS_ORIGIN: 'https://' + ORIGINAL_HOST + ':' + HTTPS_PORT,
+    HTTPS_ORIGIN_WITH_CREDS: 'https://foo:bar@' + ORIGINAL_HOST + ':' + HTTPS_PORT,
+    HTTP_ORIGIN_WITH_DIFFERENT_PORT: 'http://' + ORIGINAL_HOST + ':' + HTTP_PORT2,
+    HTTP_REMOTE_ORIGIN: 'http://' + REMOTE_HOST + ':' + HTTP_PORT,
+    HTTP_REMOTE_ORIGIN_WITH_DIFFERENT_PORT: 'http://' + REMOTE_HOST + ':' + HTTP_PORT2,
+    HTTPS_REMOTE_ORIGIN: 'https://' + REMOTE_HOST + ':' + HTTPS_PORT,
+    HTTPS_REMOTE_ORIGIN_WITH_CREDS: 'https://foo:bar@' + REMOTE_HOST + ':' + HTTPS_PORT,
+    UNAUTHENTICATED_ORIGIN: 'http://' + UNAUTHENTICATED_HOST + ':' + HTTP_PORT
+  };
+}
index a0235fef99f096f78f895953bae99788222333e1..2eb8353fe1f244f504be7169339f2735a551a7dc 100644 (file)
@@ -53,7 +53,7 @@ function stringToArray(str) {
 
 function validateBufferFromString(buffer, expectedValue, message)
 {
-  return assert_array_equals(new Uint8Array(buffer), stringToArray(expectedValue), message);
+  return assert_array_equals(new Uint8Array(buffer !== undefined ? buffer : []), stringToArray(expectedValue), message);
 }
 
 function validateStreamFromString(reader, expectedValue, retrievedArrayBuffer) {
index cfc5cdc85f27edc1521856a412653564070ec384..1ffc65acf130034908543e586ede5656bf3d8f80 100644 (file)
@@ -18,6 +18,7 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/authentication.py
 /LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/clean-stash.py
 /LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/data.json
+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/get-host-info.sub.js
 /LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/inspect-headers.py
 /LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/method.py
 /LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/preflight.py
index 2986d8707e62db9a4aa6becfd1b78553903bb6f8..0b0d167b3085bea150e3f1c0a5fc0f72e1a7e999 100644 (file)
@@ -3,5 +3,5 @@ PASS Check Response's clone with default values, without body
 PASS Check Response's clone has the expected attribute values 
 PASS Check orginal response's body after cloning 
 PASS Check cloned response's body 
-FAIL Cannot clone a disturbed response assert_true: response is disturbed expected true got false
+PASS Cannot clone a disturbed response 
 
index 2d36d97685dc693cc5c042e034851261db1023f8..88b93458b13a9650c26cc24e7a27f4c5baec4d27 100644 (file)
@@ -54,7 +54,7 @@
       }, "Check cloned response's body");
 
       promise_test(function(test) {
-        var disturbedResponse = new Response();
+        var disturbedResponse = new Response("data");
         return disturbedResponse.text().then(function() {
             assert_true(disturbedResponse.bodyUsed, "response is disturbed");
             assert_throws(new TypeError() , function() { disturbedResponse.clone(); },
index f6dd7d26992c1f5644c896d968966bf91b74f559..01a3bd00b10c7d55f66950a3220123528fa8e69e 100644 (file)
@@ -1,6 +1,6 @@
 
 PASS Read empty text response's body as readableStream 
-FAIL Read empty blob response's body as readableStream promise_test: Unhandled rejection with value: object "TypeError: Invalid array length argument"
+PASS Read empty blob response's body as readableStream 
 PASS Read blob response's body as readableStream 
 PASS Read text response's body as readableStream 
 FAIL Read form data response's body as readableStream promise_test: Unhandled rejection with value: "not implemented"