Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/thorough/redirect.js

Issue 2785123002: Make no-location redirect response to be "opaque redirect" when redirect mode is manual. (Closed)
Patch Set: add link to crbug.com/707185 Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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,
11 responseRedirected, checkURLList.bind(self, [BASE_URL])], 11 responseRedirected, checkURLList.bind(self, [BASE_URL])],
12 [methodIsGET, authCheck1]], 12 [methodIsGET, authCheck1]],
13 13
14 // https://fetch.spec.whatwg.org/#concept-http-fetch 14 // https://fetch.spec.whatwg.org/#http-redirect-fetch
15 // Step 4, Case 301/302/303/307/308: 15 // Step 2: If actualResponse’s location URL is null, then return response.
16 // Step 2: If location is null, return response.
17 [REDIRECT_URL + 'noLocation' + 16 [REDIRECT_URL + 'noLocation' +
18 '&mode=same-origin&method=GET&NoRedirectTest=true', 17 '&mode=same-origin&method=GET&NoRedirectTest=true',
19 [fetchResolved, hasBody, typeBasic, responseNotRedirected, 18 [fetchResolved, hasBody, typeBasic, responseNotRedirected,
20 checkURLList.bind(self, [])], 19 checkURLList.bind(self, [])],
21 [checkJsonpNoRedirect]], 20 [checkJsonpNoRedirect]],
22 // Step 5: If locationURL is failure, return a network error. 21 // Step 3: If actualResponse’s location URL is failure, then return a network
22 // error.
23 [REDIRECT_URL + 'http://' + 23 [REDIRECT_URL + 'http://' +
24 '&mode=same-origin&method=GET', 24 '&mode=same-origin&method=GET',
25 [fetchRejected]], 25 [fetchRejected]],
26 26
27 [REDIRECT_URL + encodeURIComponent(BASE_URL) + 27 [REDIRECT_URL + encodeURIComponent(BASE_URL) +
28 '&mode=same-origin&redirectmode=manual&method=GET',
29 [fetchResolved, noBody, typeOpaqueredirect, responseNotRedirected,
30 checkURLList.bind(self, [])],
31 [checkJsonpError]],
32 [REDIRECT_URL + 'noLocation' +
33 '&mode=same-origin&redirectmode=manual&method=GET&NoRedirectTest=true',
34 [fetchResolved, noBody, typeOpaqueredirect, responseNotRedirected,
35 checkURLList.bind(self, [])],
36 [checkJsonpError]],
37 // According to the spec, even if the location URL is invalid, when the
38 // redirect mode is manual, fetch() must resolve with an opaque redirect
39 // filtered response. But currently Chrome handles the invalid location URL in
40 // the browser process as an error. See: crbug.com/707185
41 [REDIRECT_URL + 'http://' +
42 '&mode=same-origin&redirectmode=manual&method=GET&NoRedirectTest=true',
43 [fetchRejected]],
44
45 [REDIRECT_URL + encodeURIComponent(BASE_URL) +
28 '&mode=same-origin&method=GET&headers=CUSTOM', 46 '&mode=same-origin&method=GET&headers=CUSTOM',
29 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic, 47 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic,
30 responseRedirected, checkURLList.bind(self, [BASE_URL])], 48 responseRedirected, checkURLList.bind(self, [BASE_URL])],
31 [methodIsGET, hasCustomHeader, authCheck1]], 49 [methodIsGET, hasCustomHeader, authCheck1]],
32 // Chrome changes the method from POST to GET when it recieves 301 redirect 50 // Chrome changes the method from POST to GET when it recieves 301 redirect
33 // response. See a note in http://tools.ietf.org/html/rfc7231#section-6.4.2 51 // response. See a note in http://tools.ietf.org/html/rfc7231#section-6.4.2
34 [REDIRECT_URL + encodeURIComponent(BASE_URL) + 52 [REDIRECT_URL + encodeURIComponent(BASE_URL) +
35 '&mode=same-origin&method=POST&Status=301', 53 '&mode=same-origin&method=POST&Status=301',
36 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic, 54 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic,
37 responseRedirected, checkURLList.bind(self, [BASE_URL])], 55 responseRedirected, checkURLList.bind(self, [BASE_URL])],
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 '&mode=cors&credentials=same-origin&method=GET&headers=CUSTOM' + 380 '&mode=cors&credentials=same-origin&method=GET&headers=CUSTOM' +
363 '&ACAOrigin=' + BASE_ORIGIN + '&ACAHeaders=x-serviceworker-test', 381 '&ACAOrigin=' + BASE_ORIGIN + '&ACAHeaders=x-serviceworker-test',
364 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], 382 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
365 [methodIsGET, hasCustomHeader, authCheckNone]], 383 [methodIsGET, hasCustomHeader, authCheckNone]],
366 ]; 384 ];
367 385
368 if (self.importScripts) { 386 if (self.importScripts) {
369 executeTests(TEST_TARGETS); 387 executeTests(TEST_TARGETS);
370 done(); 388 done();
371 } 389 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698