[GTK][WPE] Fix BubblewrapLauncher clang warnings
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / fetch / api / cors / cors-expose-star.js
1 if (this.document === undefined) {
2   importScripts("/resources/testharness.js");
3   importScripts("../resources/utils.js");
4 }
5
6 const url = "http://{{host}}:{{ports[http][1]}}" + dirname(location.pathname) + RESOURCES_DIR + "top.txt",
7       sharedHeaders = "?pipe=header(Access-Control-Expose-Headers,*)|header(Test,X)|header(Set-Cookie,X)|header(*,whoa)|"
8
9 promise_test(() => {
10   const headers = "header(Access-Control-Allow-Origin,*)"
11   return fetch(url + sharedHeaders + headers).then(resp => {
12     assert_equals(resp.status, 200)
13     assert_equals(resp.type , "cors")
14     assert_equals(resp.headers.get("test"), "X")
15     assert_equals(resp.headers.get("set-cookie"), null)
16     assert_equals(resp.headers.get("*"), "whoa")
17   })
18 }, "Basic Access-Control-Expose-Headers: * support")
19
20 promise_test(() => {
21   const origin = location.origin, // assuming an ASCII origin
22         headers = "header(Access-Control-Allow-Origin," + origin + ")|header(Access-Control-Allow-Credentials,true)"
23   return fetch(url + sharedHeaders + headers, { credentials:"include" }).then(resp => {
24     assert_equals(resp.status, 200)
25     assert_equals(resp.type , "cors")
26     assert_equals(resp.headers.get("content-type"), "text/plain") // safelisted
27     assert_equals(resp.headers.get("test"), null)
28     assert_equals(resp.headers.get("set-cookie"), null)
29     assert_equals(resp.headers.get("*"), "whoa")
30   })
31 }, "* for credentialed fetches only matches literally")
32
33 promise_test(() => {
34   const headers =  "header(Access-Control-Allow-Origin,*)|header(Access-Control-Expose-Headers,set-cookie\\,*)"
35   return fetch(url + sharedHeaders + headers).then(resp => {
36     assert_equals(resp.status, 200)
37     assert_equals(resp.type , "cors")
38     assert_equals(resp.headers.get("test"), "X")
39     assert_equals(resp.headers.get("set-cookie"), null)
40     assert_equals(resp.headers.get("*"), "whoa")
41   })
42 }, "* can be one of several values")
43
44 done();