OLD | NEW |
1 if (self.importScripts) { | 1 if (self.importScripts) { |
2 importScripts('../resources/fetch-test-helpers.js'); | 2 importScripts('../resources/fetch-test-helpers.js'); |
3 importScripts('/serviceworker/resources/fetch-access-control-util.js'); | 3 importScripts('/serviceworker/resources/fetch-access-control-util.js'); |
4 } | 4 } |
5 | 5 |
6 var TEST_TARGETS = [ | 6 var TEST_TARGETS = [ |
7 // CORS test | 7 // CORS test |
8 [OTHER_BASE_URL + 'method=GET&headers=CUSTOM', | 8 [OTHER_BASE_URL + 'method=GET&headers=CUSTOM', |
9 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque], | 9 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque], |
10 onlyOnServiceWorkerProxiedTest([methodIsGET, noCustomHeader, authCheck2])], | 10 onlyOnServiceWorkerProxiedTest([methodIsGET, noCustomHeader, authCheck2])], |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 [OTHER_BASE_URL + 'mode=cors&method=GET&headers=CUSTOM2&ACAOrigin=*&PACAOrigin
=*&PACAHeaders=x-servicEworker-u, x-servicEworker-ua, x-servicewOrker-test, x-sE
rviceworker-s, x-sErviceworker-v&PreflightTest=200', | 124 [OTHER_BASE_URL + 'mode=cors&method=GET&headers=CUSTOM2&ACAOrigin=*&PACAOrigin
=*&PACAHeaders=x-servicEworker-u, x-servicEworker-ua, x-servicewOrker-test, x-sE
rviceworker-s, x-sErviceworker-v&PreflightTest=200', |
125 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | 125 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
126 [methodIsGET, hasCustomHeader2]], | 126 [methodIsGET, hasCustomHeader2]], |
127 [OTHER_BASE_URL + 'mode=cors&method=GET&headers=CUSTOM2&ACAOrigin=*&PACAOrigin
=*&PACAHeaders=x-servicewOrker-test&PreflightTest=200', | 127 [OTHER_BASE_URL + 'mode=cors&method=GET&headers=CUSTOM2&ACAOrigin=*&PACAOrigin
=*&PACAHeaders=x-servicewOrker-test&PreflightTest=200', |
128 [fetchRejected]], | 128 [fetchRejected]], |
129 | 129 |
130 // Test request headers sent in CORS preflight requests. | 130 // Test request headers sent in CORS preflight requests. |
131 [OTHER_BASE_URL + 'mode=cors&method=GET&headers=CUSTOM&ACAOrigin=*&PACAOrigin=
*&PACAHeaders=x-serviceworker-test&PreflightTest=200&PACRMethod=GET&PACRHeaders=
x-serviceworker-test', | 131 [OTHER_BASE_URL + 'mode=cors&method=GET&headers=CUSTOM&ACAOrigin=*&PACAOrigin=
*&PACAHeaders=x-serviceworker-test&PreflightTest=200&PACRMethod=GET&PACRHeaders=
x-serviceworker-test', |
132 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | 132 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
133 [methodIsGET, hasCustomHeader]], | 133 [methodIsGET, hasCustomHeader]], |
134 // FIXME: https://crbug.com/452391 | 134 // Test Access-Control-Request-Headers is sorted https://crbug.com/452391 |
135 // [OTHER_BASE_URL + 'mode=cors&method=GET&headers=CUSTOM2&ACAOrigin=*&PACAOri
gin=*&PACAHeaders=x-servicEworker-u, x-servicEworker-ua, x-servicewOrker-test, x
-sErviceworker-s, x-sErviceworker-v&PreflightTest=200&PACRMethod=GET&PACRHeaders
=x-serviceworker-s, x-serviceworker-test, x-serviceworker-u, x-serviceworker-ua,
x-serviceworker-v', | 135 [OTHER_BASE_URL + 'mode=cors&method=GET&headers=CUSTOM2&ACAOrigin=*&PACAOrigin
=*&PACAHeaders=x-servicEworker-u, x-servicEworker-ua, x-servicewOrker-test, x-sE
rviceworker-s, x-sErviceworker-v&PreflightTest=200&PACRMethod=GET&PACRHeaders=x-
serviceworker-s, x-serviceworker-test, x-serviceworker-u, x-serviceworker-ua, x-
serviceworker-v', |
136 // [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | 136 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
137 // [methodIsGET, hasCustomHeader2]], | 137 [methodIsGET, hasCustomHeader2]], |
138 | 138 |
139 // method=POST | 139 // method=POST |
140 | 140 |
141 // CORS check | 141 // CORS check |
142 // https://fetch.spec.whatwg.org/#concept-cors-check | 142 // https://fetch.spec.whatwg.org/#concept-cors-check |
143 // Tests for Access-Control-Allow-Origin header. | 143 // Tests for Access-Control-Allow-Origin header. |
144 [OTHER_BASE_URL + 'mode=cors&method=POST', | 144 [OTHER_BASE_URL + 'mode=cors&method=POST', |
145 [fetchRejected]], | 145 [fetchRejected]], |
146 [OTHER_BASE_URL + 'mode=cors&method=POST&ACAOrigin=*', | 146 [OTHER_BASE_URL + 'mode=cors&method=POST&ACAOrigin=*', |
147 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | 147 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 [OTHER_BASE_URL + 'mode=cors&method=POST&headers=CUSTOM2&ACAOrigin=*&PACAOrigi
n=*&PACAHeaders=x-servicEworker-u, x-servicEworker-ua, x-servicewOrker-test, x-s
Erviceworker-s, x-sErviceworker-v&PreflightTest=200', | 228 [OTHER_BASE_URL + 'mode=cors&method=POST&headers=CUSTOM2&ACAOrigin=*&PACAOrigi
n=*&PACAHeaders=x-servicEworker-u, x-servicEworker-ua, x-servicewOrker-test, x-s
Erviceworker-s, x-sErviceworker-v&PreflightTest=200', |
229 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | 229 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
230 [methodIsPOST, hasCustomHeader2]], | 230 [methodIsPOST, hasCustomHeader2]], |
231 [OTHER_BASE_URL + 'mode=cors&method=POST&headers=CUSTOM2&ACAOrigin=*&PACAOrigi
n=*&PACAHeaders=x-servicewOrker-test&PreflightTest=200', | 231 [OTHER_BASE_URL + 'mode=cors&method=POST&headers=CUSTOM2&ACAOrigin=*&PACAOrigi
n=*&PACAHeaders=x-servicewOrker-test&PreflightTest=200', |
232 [fetchRejected]], | 232 [fetchRejected]], |
233 | 233 |
234 // Test request headers sent in CORS preflight requests. | 234 // Test request headers sent in CORS preflight requests. |
235 [OTHER_BASE_URL + 'mode=cors&method=POST&headers=CUSTOM&ACAOrigin=*&PACAOrigin
=*&PACAHeaders=x-serviceworker-test&PreflightTest=200&PACRMethod=POST&PACRHeader
s=x-serviceworker-test', | 235 [OTHER_BASE_URL + 'mode=cors&method=POST&headers=CUSTOM&ACAOrigin=*&PACAOrigin
=*&PACAHeaders=x-serviceworker-test&PreflightTest=200&PACRMethod=POST&PACRHeader
s=x-serviceworker-test', |
236 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | 236 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
237 [methodIsPOST, hasCustomHeader]], | 237 [methodIsPOST, hasCustomHeader]], |
238 // FIXME: https://crbug.com/452391 | 238 // Test Access-Control-Request-Headers is sorted https://crbug.com/452391 |
239 // [OTHER_BASE_URL + 'mode=cors&method=POST&headers=CUSTOM2&ACAOrigin=*&PACAOr
igin=*&PACAHeaders=x-servicEworker-u, x-servicEworker-ua, x-servicewOrker-test,
x-sErviceworker-s, x-sErviceworker-v&PreflightTest=200&PACRMethod=POST&PACRHeade
rs=x-serviceworker-s, x-serviceworker-test, x-serviceworker-u, x-serviceworker-u
a, x-serviceworker-v', | 239 [OTHER_BASE_URL + 'mode=cors&method=POST&headers=CUSTOM2&ACAOrigin=*&PACAOrigi
n=*&PACAHeaders=x-servicEworker-u, x-servicEworker-ua, x-servicewOrker-test, x-s
Erviceworker-s, x-sErviceworker-v&PreflightTest=200&PACRMethod=POST&PACRHeaders=
x-serviceworker-s, x-serviceworker-test, x-serviceworker-u, x-serviceworker-ua,
x-serviceworker-v', |
240 // [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | 240 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
241 // [methodIsPOST, hasCustomHeader2]], | 241 [methodIsPOST, hasCustomHeader2]], |
242 | 242 |
243 // method=PUT | 243 // method=PUT |
244 | 244 |
245 // CORS check | 245 // CORS check |
246 // https://fetch.spec.whatwg.org/#concept-cors-check | 246 // https://fetch.spec.whatwg.org/#concept-cors-check |
247 // Tests for Access-Control-Allow-Origin header. | 247 // Tests for Access-Control-Allow-Origin header. |
248 // CORS preflight fetch | 248 // CORS preflight fetch |
249 // https://fetch.spec.whatwg.org/#cors-preflight-fetch | 249 // https://fetch.spec.whatwg.org/#cors-preflight-fetch |
250 // Tests for Access-Control-Allow-Methods header. | 250 // Tests for Access-Control-Allow-Methods header. |
251 // Tests for Access-Control-Allow-Headers header. | 251 // Tests for Access-Control-Allow-Headers header. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 [OTHER_BASE_URL + 'mode=cors&method=PUT&headers=CUSTOM2&ACAOrigin=*&PACAOrigin
=*&PACAMethods=PUT&PACAHeaders=x-servicEworker-u, x-servicEworker-ua, x-servicew
Orker-test, x-sErviceworker-s, x-sErviceworker-v&PreflightTest=200', | 339 [OTHER_BASE_URL + 'mode=cors&method=PUT&headers=CUSTOM2&ACAOrigin=*&PACAOrigin
=*&PACAMethods=PUT&PACAHeaders=x-servicEworker-u, x-servicEworker-ua, x-servicew
Orker-test, x-sErviceworker-s, x-sErviceworker-v&PreflightTest=200', |
340 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | 340 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
341 [methodIsPUT, hasCustomHeader2]], | 341 [methodIsPUT, hasCustomHeader2]], |
342 [OTHER_BASE_URL + 'mode=cors&method=PUT&headers=CUSTOM2&ACAOrigin=*&PACAOrigin
=*&PACAMethods=PUT&PACAHeaders=x-servicewOrker-test&PreflightTest=200', | 342 [OTHER_BASE_URL + 'mode=cors&method=PUT&headers=CUSTOM2&ACAOrigin=*&PACAOrigin
=*&PACAMethods=PUT&PACAHeaders=x-servicewOrker-test&PreflightTest=200', |
343 [fetchRejected]], | 343 [fetchRejected]], |
344 | 344 |
345 // Test request headers sent in CORS preflight requests. | 345 // Test request headers sent in CORS preflight requests. |
346 [OTHER_BASE_URL + 'mode=cors&method=PUT&headers=CUSTOM&ACAOrigin=*&PACAOrigin=
*&PACAMethods=PUT&PACAHeaders=x-serviceworker-test&PreflightTest=200&PACRMethod=
PUT&PACRHeaders=x-serviceworker-test', | 346 [OTHER_BASE_URL + 'mode=cors&method=PUT&headers=CUSTOM&ACAOrigin=*&PACAOrigin=
*&PACAMethods=PUT&PACAHeaders=x-serviceworker-test&PreflightTest=200&PACRMethod=
PUT&PACRHeaders=x-serviceworker-test', |
347 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | 347 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
348 [methodIsPUT, hasCustomHeader]], | 348 [methodIsPUT, hasCustomHeader]], |
349 // FIXME: https://crbug.com/452391 | 349 // Test Access-Control-Request-Headers is sorted https://crbug.com/452391 |
350 // [OTHER_BASE_URL + 'mode=cors&method=PUT&headers=CUSTOM2&ACAOrigin=*&PACAOri
gin=*&PACAMethods=PUT&PACAHeaders=x-servicEworker-u, x-servicEworker-ua, x-servi
cewOrker-test, x-sErviceworker-s, x-sErviceworker-v&PreflightTest=200&PACRMethod
=PUT&PACRHeaders=x-serviceworker-s, x-serviceworker-test, x-serviceworker-u, x-s
erviceworker-ua, x-serviceworker-v', | 350 [OTHER_BASE_URL + 'mode=cors&method=PUT&headers=CUSTOM2&ACAOrigin=*&PACAOrigin
=*&PACAMethods=PUT&PACAHeaders=x-servicEworker-u, x-servicEworker-ua, x-servicew
Orker-test, x-sErviceworker-s, x-sErviceworker-v&PreflightTest=200&PACRMethod=PU
T&PACRHeaders=x-serviceworker-s, x-serviceworker-test, x-serviceworker-u, x-serv
iceworker-ua, x-serviceworker-v', |
351 // [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | 351 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
352 // [methodIsPUT, hasCustomHeader2]], | 352 [methodIsPUT, hasCustomHeader2]], |
353 | 353 |
354 // method=XXX | 354 // method=XXX |
355 | 355 |
356 // CORS check | 356 // CORS check |
357 // https://fetch.spec.whatwg.org/#concept-cors-check | 357 // https://fetch.spec.whatwg.org/#concept-cors-check |
358 // Tests for Access-Control-Allow-Origin header. | 358 // Tests for Access-Control-Allow-Origin header. |
359 // CORS preflight fetch | 359 // CORS preflight fetch |
360 // https://fetch.spec.whatwg.org/#cors-preflight-fetch | 360 // https://fetch.spec.whatwg.org/#cors-preflight-fetch |
361 // Tests for Access-Control-Allow-Methods header. | 361 // Tests for Access-Control-Allow-Methods header. |
362 // Tests for Access-Control-Allow-Headers header. | 362 // Tests for Access-Control-Allow-Headers header. |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 [OTHER_BASE_URL + 'mode=cors&method=XXX&headers=CUSTOM2&ACAOrigin=*&PACAOrigin
=*&PACAMethods=XXX&PACAHeaders=x-servicEworker-u, x-servicEworker-ua, x-servicew
Orker-test, x-sErviceworker-s, x-sErviceworker-v&PreflightTest=200', | 451 [OTHER_BASE_URL + 'mode=cors&method=XXX&headers=CUSTOM2&ACAOrigin=*&PACAOrigin
=*&PACAMethods=XXX&PACAHeaders=x-servicEworker-u, x-servicEworker-ua, x-servicew
Orker-test, x-sErviceworker-s, x-sErviceworker-v&PreflightTest=200', |
452 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | 452 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
453 [methodIsXXX, hasCustomHeader2]], | 453 [methodIsXXX, hasCustomHeader2]], |
454 [OTHER_BASE_URL + 'mode=cors&method=XXX&headers=CUSTOM2&ACAOrigin=*&PACAOrigin
=*&PACAMethods=XXX&PACAHeaders=x-servicewOrker-test&PreflightTest=200', | 454 [OTHER_BASE_URL + 'mode=cors&method=XXX&headers=CUSTOM2&ACAOrigin=*&PACAOrigin
=*&PACAMethods=XXX&PACAHeaders=x-servicewOrker-test&PreflightTest=200', |
455 [fetchRejected]], | 455 [fetchRejected]], |
456 | 456 |
457 // Test request headers sent in CORS preflight requests. | 457 // Test request headers sent in CORS preflight requests. |
458 [OTHER_BASE_URL + 'mode=cors&method=XXX&headers=CUSTOM&ACAOrigin=*&PACAOrigin=
*&PACAMethods=XXX&PACAHeaders=x-serviceworker-test&PreflightTest=200&PACRMethod=
XXX&PACRHeaders=x-serviceworker-test', | 458 [OTHER_BASE_URL + 'mode=cors&method=XXX&headers=CUSTOM&ACAOrigin=*&PACAOrigin=
*&PACAMethods=XXX&PACAHeaders=x-serviceworker-test&PreflightTest=200&PACRMethod=
XXX&PACRHeaders=x-serviceworker-test', |
459 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | 459 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
460 [methodIsXXX, hasCustomHeader]], | 460 [methodIsXXX, hasCustomHeader]], |
461 // FIXME: https://crbug.com/452391 | 461 // Test Access-Control-Request-Headers is sorted https://crbug.com/452391 |
462 // [OTHER_BASE_URL + 'mode=cors&method=XXX&headers=CUSTOM2&ACAOrigin=*&PACAOri
gin=*&PACAMethods=XXX&PACAHeaders=x-servicEworker-u, x-servicEworker-ua, x-servi
cewOrker-test, x-sErviceworker-s, x-sErviceworker-v&PreflightTest=200&PACRMethod
=XXX&PACRHeaders=x-serviceworker-s, x-serviceworker-test, x-serviceworker-u, x-s
erviceworker-ua, x-serviceworker-v', | 462 [OTHER_BASE_URL + 'mode=cors&method=XXX&headers=CUSTOM2&ACAOrigin=*&PACAOrigin
=*&PACAMethods=XXX&PACAHeaders=x-servicEworker-u, x-servicEworker-ua, x-servicew
Orker-test, x-sErviceworker-s, x-sErviceworker-v&PreflightTest=200&PACRMethod=XX
X&PACRHeaders=x-serviceworker-s, x-serviceworker-test, x-serviceworker-u, x-serv
iceworker-ua, x-serviceworker-v', |
463 // [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | 463 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
464 // [methodIsXXX, hasCustomHeader2]], | 464 [methodIsXXX, hasCustomHeader2]], |
465 ]; | 465 ]; |
466 | 466 |
467 if (self.importScripts) { | 467 if (self.importScripts) { |
468 executeTests(TEST_TARGETS); | 468 executeTests(TEST_TARGETS); |
469 done(); | 469 done(); |
470 } | 470 } |
OLD | NEW |