OLD | NEW |
1 if (self.importScripts) { | 1 if (self.importScripts) { |
2 importScripts('/fetch/resources/fetch-test-helpers.js'); | 2 importScripts('/fetch/resources/fetch-test-helpers.js'); |
3 importScripts('/fetch/resources/thorough-util.js'); | 3 importScripts('/fetch/resources/thorough-util.js'); |
4 } | 4 } |
5 | 5 |
6 // Tests for CORS preflight fetch (non-simple methods). | 6 // Tests for CORS preflight fetch (non-simple methods). |
7 // Spec: https://fetch.spec.whatwg.org/#cors-preflight-fetch | 7 // Spec: https://fetch.spec.whatwg.org/#cors-preflight-fetch |
8 | 8 |
9 var TEST_TARGETS = []; | 9 var TEST_TARGETS = []; |
10 | 10 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 '&PACAHeaders=x-servicewOrker-test&PreflightTest=200', | 160 '&PACAHeaders=x-servicewOrker-test&PreflightTest=200', |
161 [fetchRejected]], | 161 [fetchRejected]], |
162 | 162 |
163 // Test request headers sent in CORS preflight requests. | 163 // Test request headers sent in CORS preflight requests. |
164 [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method + | 164 [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method + |
165 '&headers=CUSTOM&ACAOrigin=*&PACAOrigin=*&PACAMethods=' + method + | 165 '&headers=CUSTOM&ACAOrigin=*&PACAOrigin=*&PACAMethods=' + method + |
166 '&PACAHeaders=x-serviceworker-test&PACRMethod=' + method + | 166 '&PACAHeaders=x-serviceworker-test&PACRMethod=' + method + |
167 '&PACRHeaders=x-serviceworker-test&PreflightTest=200', | 167 '&PACRHeaders=x-serviceworker-test&PreflightTest=200', |
168 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | 168 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
169 [checkMethod, hasCustomHeader]], | 169 [checkMethod, hasCustomHeader]], |
| 170 |
| 171 // Verify that Access-Control-Request-Headers: is not present in preflight |
| 172 // if its value is the empty list - https://crbug.com/633729 |
| 173 [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method + |
| 174 '&headers=SAFE&ACAOrigin=*&PACAOrigin=*&PACAMethods=' + method + |
| 175 '&PACRHeaders=missing&PACRMethod=' + method + '&PreflightTest=200', |
| 176 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
| 177 [checkMethod]], |
| 178 |
170 // Test Access-Control-Request-Headers is sorted https://crbug.com/452391 | 179 // Test Access-Control-Request-Headers is sorted https://crbug.com/452391 |
171 [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method + | 180 [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method + |
172 '&headers=CUSTOM2&ACAOrigin=*&PACAOrigin=*&PACAMethods=' + method + | 181 '&headers=CUSTOM2&ACAOrigin=*&PACAOrigin=*&PACAMethods=' + method + |
173 '&PACAHeaders=x-servicEworker-u,x-servicEworker-ua,x-servicewOrker-test,x
-sErviceworker-s,x-sErviceworker-v&PACRMethod=' + method + | 182 '&PACAHeaders=x-servicEworker-u,x-servicEworker-ua,x-servicewOrker-test,x
-sErviceworker-s,x-sErviceworker-v&PACRMethod=' + method + |
174 '&PACRHeaders=x-serviceworker-s,x-serviceworker-test,x-serviceworker-u,x-
serviceworker-ua,x-serviceworker-v&PreflightTest=200', | 183 '&PACRHeaders=x-serviceworker-s,x-serviceworker-test,x-serviceworker-u,x-
serviceworker-ua,x-serviceworker-v&PreflightTest=200', |
175 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | 184 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
176 [checkMethod, hasCustomHeader2]]); | 185 [checkMethod, hasCustomHeader2]]); |
177 }); | 186 }); |
178 | 187 |
179 if (self.importScripts) { | 188 if (self.importScripts) { |
180 executeTests(TEST_TARGETS); | 189 executeTests(TEST_TARGETS); |
181 done(); | 190 done(); |
182 } | 191 } |
OLD | NEW |