Chromium Code Reviews| 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 var TEST_TARGETS = [ | 6 var TEST_TARGETS = [ |
| 7 // Redirect: same origin -> same origin | 7 // Redirect: same origin -> same origin |
| 8 [REDIRECT_URL + encodeURIComponent(BASE_URL) + | 8 [REDIRECT_URL + encodeURIComponent(BASE_URL) + |
| 9 '&mode=same-origin&method=GET', | 9 '&mode=same-origin&method=GET', |
| 10 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | 10 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 '&mode=cors&credentials=same-origin&method=post&ACAOrigin=*&Status=307', | 183 '&mode=cors&credentials=same-origin&method=post&ACAOrigin=*&Status=307', |
| 184 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | 184 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
| 185 [methodIsPOST]], | 185 [methodIsPOST]], |
| 186 // The 308 redirect response MUST NOT change the method. | 186 // The 308 redirect response MUST NOT change the method. |
| 187 // FIXME: disabled due to https://crbug.com/451938 | 187 // FIXME: disabled due to https://crbug.com/451938 |
| 188 // [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL + 'ACAOrigin=*') + | 188 // [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL + 'ACAOrigin=*') + |
| 189 // '&mode=cors&credentials=same-origin&method=post&ACAOrigin=*&Status=308', | 189 // '&mode=cors&credentials=same-origin&method=post&ACAOrigin=*&Status=308', |
| 190 // [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | 190 // [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
| 191 // [methodIsPOST]], | 191 // [methodIsPOST]], |
| 192 | 192 |
| 193 // Once CORS preflight flag is set, redirecting to the cross-origin is not | 193 // Requests that require preflight. |
| 194 // allowed. | |
| 195 // Custom method | 194 // Custom method |
| 196 [OTHER_REDIRECT_URL + | 195 [OTHER_BASE_URL + |
|
yhirano
2016/10/27 06:19:44
I'm a bit confused: As you are making redirect + C
Jack Bates
2016/11/03 17:22:03
My mistake. REDIRECT_URL was incorrectly redirecti
| |
| 197 encodeURIComponent(BASE_URL + 'ACAOrigin=*&ACAMethods=PUT') + | 196 encodeURIComponent(BASE_URL + 'ACAOrigin=*&ACAMethods=PUT') + |
| 198 '&mode=cors&credentials=same-origin&method=PUT&ACAOrigin=*&ACAMethods=PUT', | 197 '&mode=cors&credentials=same-origin&method=PUT&ACAOrigin=*&ACAMethods=PUT', |
| 199 [fetchRejected]], | 198 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
| 199 [methodIsPUT]], | |
| 200 // Custom header | 200 // Custom header |
| 201 [OTHER_REDIRECT_URL + | 201 [OTHER_BASE_URL + |
| 202 encodeURIComponent( | 202 encodeURIComponent( |
| 203 BASE_URL + | 203 BASE_URL + |
| 204 'ACAOrigin=' + BASE_ORIGIN + '&ACAHeaders=x-serviceworker-test') + | 204 'ACAOrigin=' + BASE_ORIGIN + '&ACAHeaders=x-serviceworker-test') + |
| 205 '&mode=cors&credentials=same-origin&method=GET&headers=CUSTOM&ACAOrigin=*', | 205 '&mode=cors&credentials=same-origin&method=GET&headers=CUSTOM' + |
| 206 [fetchRejected]], | 206 '&ACAOrigin=*&ACAHeaders=x-serviceworker-test', |
| 207 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | |
| 208 [methodIsGET, hasCustomHeader]], | |
| 207 | 209 |
| 208 // Redirect: other origin -> other origin | 210 // Redirect: other origin -> other origin |
| 209 [OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) + | 211 [OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) + |
| 210 '&mode=same-origin&method=GET', | 212 '&mode=same-origin&method=GET', |
| 211 [fetchRejected]], | 213 [fetchRejected]], |
| 212 [OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) + | 214 [OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) + |
| 213 '&mode=cors&credentials=same-origin&method=GET', | 215 '&mode=cors&credentials=same-origin&method=GET', |
| 214 [fetchRejected]], | 216 [fetchRejected]], |
| 215 [OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) + | 217 [OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) + |
| 216 '&mode=cors&credentials=same-origin&method=GET&ACAOrigin=*', | 218 '&mode=cors&credentials=same-origin&method=GET&ACAOrigin=*', |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 265 // [methodIsPOST]], | 267 // [methodIsPOST]], |
| 266 | 268 |
| 267 // Server header | 269 // Server header |
| 268 [OTHER_REDIRECT_URL + | 270 [OTHER_REDIRECT_URL + |
| 269 encodeURIComponent(OTHER_BASE_URL + | 271 encodeURIComponent(OTHER_BASE_URL + |
| 270 'ACAOrigin=*&ACEHeaders=X-ServiceWorker-ServerHeader') + | 272 'ACAOrigin=*&ACEHeaders=X-ServiceWorker-ServerHeader') + |
| 271 '&mode=cors&credentials=same-origin&method=GET&ACAOrigin=*', | 273 '&mode=cors&credentials=same-origin&method=GET&ACAOrigin=*', |
| 272 [fetchResolved, noContentLength, hasServerHeader, hasBody, typeCors], | 274 [fetchResolved, noContentLength, hasServerHeader, hasBody, typeCors], |
| 273 [methodIsGET, authCheckNone]], | 275 [methodIsGET, authCheckNone]], |
| 274 | 276 |
| 275 // Once CORS preflight flag is set, redirecting to the cross-origin is not | 277 // Requests that require preflight. |
| 276 // allowed. | |
| 277 // Custom method | 278 // Custom method |
| 278 [OTHER_REDIRECT_URL + | 279 [OTHER_BASE_URL + |
| 279 encodeURIComponent(OTHER_BASE_URL + 'ACAOrigin=*&ACAMethods=PUT') + | 280 encodeURIComponent(OTHER_BASE_URL + 'ACAOrigin=*&ACAMethods=PUT') + |
| 280 '&mode=cors&credentials=same-origin&method=PUT&ACAOrigin=*&ACAMethods=PUT', | 281 '&mode=cors&credentials=same-origin&method=PUT&ACAOrigin=*&ACAMethods=PUT', |
| 281 [fetchRejected]], | 282 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
| 283 [methodIsPUT]], | |
| 282 // Custom header | 284 // Custom header |
| 283 [OTHER_REDIRECT_URL + | 285 [OTHER_BASE_URL + |
| 284 encodeURIComponent( | 286 encodeURIComponent( |
| 285 OTHER_BASE_URL + | 287 OTHER_BASE_URL + |
| 286 'ACAOrigin=' + BASE_ORIGIN + '&ACAHeaders=x-serviceworker-test') + | 288 'ACAOrigin=' + BASE_ORIGIN + '&ACAHeaders=x-serviceworker-test') + |
| 287 '&mode=cors&credentials=same-origin&method=GET&headers=CUSTOM' + | 289 '&mode=cors&credentials=same-origin&method=GET&headers=CUSTOM' + |
| 288 '&ACAOrigin=' + BASE_ORIGIN + '&ACAHeaders=x-serviceworker-test', | 290 '&ACAOrigin=' + BASE_ORIGIN + '&ACAHeaders=x-serviceworker-test', |
| 289 [fetchRejected]], | 291 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
| 292 [methodIsGET, hasCustomHeader]], | |
| 290 ]; | 293 ]; |
| 291 | 294 |
| 292 if (self.importScripts) { | 295 if (self.importScripts) { |
| 293 executeTests(TEST_TARGETS); | 296 executeTests(TEST_TARGETS); |
| 294 done(); | 297 done(); |
| 295 } | 298 } |
| OLD | NEW |