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

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

Issue 1665533003: Set the request mode and the credentials mode of FetchEvent in the service worker correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/thorough/redirect.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/thorough/redirect.js b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/thorough/redirect.js
index f34a736a9dcb0373b96b9a047296e58eb66cb79b..7f33e95b817d440bddb5505df85ce0ef1982c2ce 100644
--- a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/thorough/redirect.js
+++ b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/thorough/redirect.js
@@ -59,76 +59,77 @@ var TEST_TARGETS = [
// Do not redirect for other status even if Location header exists.
[REDIRECT_URL + encodeURIComponent(BASE_URL) +
- '&mode=same-origin&method=POST&Status=201&NoRedirectTest=true',
+ '&mode=same-origin&credentials=same-origin&method=POST&Status=201&' +
+ 'NoRedirectTest=true',
[fetchResolved, hasBody, typeBasic],
[checkJsonpNoRedirect]],
[REDIRECT_URL + encodeURIComponent(BASE_URL) +
- '&mode=same-origin&method=PUT',
+ '&mode=same-origin&credentials=same-origin&method=PUT',
[fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
[methodIsPUT, authCheck1]],
[REDIRECT_URL + encodeURIComponent(BASE_URL) +
- '&mode=cors&method=GET&headers=CUSTOM',
+ '&mode=cors&credentials=same-origin&method=GET&headers=CUSTOM',
[fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
[methodIsGET, hasCustomHeader, authCheck1]],
// Redirect: same origin -> other origin
[REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) +
- '&mode=same-origin&method=GET',
+ '&mode=same-origin&credentials=same-origin&method=GET',
[fetchRejected]],
[REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) +
- '&mode=same-origin&method=POST',
+ '&mode=same-origin&credentials=same-origin&method=POST',
[fetchRejected]],
[REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) +
- '&mode=same-origin&method=PUT',
+ '&mode=same-origin&credentials=same-origin&method=PUT',
[fetchRejected]],
[REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) +
- '&mode=cors&method=GET',
+ '&mode=cors&credentials=same-origin&method=GET',
[fetchRejected]],
[REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) +
- '&mode=cors&method=PUT',
+ '&mode=cors&credentials=same-origin&method=PUT',
[fetchRejected]],
[REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + '&ACAOrigin=*') +
- '&mode=cors&method=GET',
+ '&mode=cors&credentials=same-origin&method=GET',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[methodIsGET, authCheckNone]],
[REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + '&ACAOrigin=*') +
- '&mode=cors&method=PUT',
+ '&mode=cors&credentials=same-origin&method=PUT',
[fetchRejected]],
[REDIRECT_URL +
encodeURIComponent(OTHER_BASE_URL + '&ACAOrigin=*&ACAMethods=PUT') +
- '&mode=cors&method=PUT',
+ '&mode=cors&credentials=same-origin&method=PUT',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[methodIsPUT, noCustomHeader, authCheckNone]],
// Status code tests for mode="cors"
// The 301 redirect response MAY change the request method from POST to GET.
[REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + '&ACAOrigin=*') +
- '&mode=cors&method=POST&Status=301',
+ '&mode=cors&credentials=same-origin&method=POST&Status=301',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[methodIsGET]],
// The 302 redirect response MAY change the request method from POST to GET.
[REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + '&ACAOrigin=*') +
- '&mode=cors&method=POST&Status=302',
+ '&mode=cors&credentials=same-origin&method=POST&Status=302',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[methodIsGET]],
// GET method must be used for 303 redirect.
[REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + '&ACAOrigin=*') +
- '&mode=cors&method=POST&Status=303',
+ '&mode=cors&credentials=same-origin&method=POST&Status=303',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[methodIsGET]],
// The 307 redirect response MUST NOT change the method.
[REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + '&ACAOrigin=*') +
- '&mode=cors&method=POST&Status=307',
+ '&mode=cors&credentials=same-origin&method=POST&Status=307',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[methodIsPOST]],
// The 308 redirect response MUST NOT change the method.
// FIXME: disabled due to https://crbug.com/451938
// [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + '&ACAOrigin=*') +
- // '&mode=cors&method=POST&Status=308',
+ // '&mode=cors&credentials=same-origin&method=POST&Status=308',
// [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
// [methodIsPOST]],
@@ -138,54 +139,54 @@ var TEST_TARGETS = [
OTHER_BASE_URL +
'&ACAOrigin=' + BASE_ORIGIN +
'&ACEHeaders=Content-Length, X-ServiceWorker-ServerHeader') +
- '&mode=cors&method=GET',
+ '&mode=cors&credentials=same-origin&method=GET',
[fetchResolved, hasContentLength, hasServerHeader, hasBody, typeCors],
[methodIsGET, authCheckNone]],
// Redirect: other origin -> same origin
[OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) +
- '&mode=same-origin&method=GET',
+ '&mode=same-origin&credentials=same-origin&method=GET',
[fetchRejected]],
[OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) +
- '&mode=same-origin&method=POST',
+ '&mode=same-origin&credentials=same-origin&method=POST',
[fetchRejected]],
[OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) +
- '&mode=cors&method=GET',
+ '&mode=cors&credentials=same-origin&method=GET',
[fetchRejected]],
[OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) +
- '&mode=cors&method=GET&ACAOrigin=*',
+ '&mode=cors&credentials=same-origin&method=GET&ACAOrigin=*',
[fetchRejected]],
[OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL + 'ACAOrigin=*') +
- '&mode=cors&method=GET&ACAOrigin=*',
+ '&mode=cors&credentials=same-origin&method=GET&ACAOrigin=*',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[methodIsGET, authCheckNone]],
// Status code tests for mode="cors"
// The 301 redirect response MAY change the request method from POST to GET.
[OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL + 'ACAOrigin=*') +
- '&mode=cors&method=post&ACAOrigin=*&Status=301',
+ '&mode=cors&credentials=same-origin&method=post&ACAOrigin=*&Status=301',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[methodIsGET]],
// The 302 redirect response MAY change the request method from POST to GET.
[OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL + 'ACAOrigin=*') +
- '&mode=cors&method=post&ACAOrigin=*&Status=302',
+ '&mode=cors&credentials=same-origin&method=post&ACAOrigin=*&Status=302',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[methodIsGET]],
// GET method must be used for 303 redirect.
[OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL + 'ACAOrigin=*') +
- '&mode=cors&method=post&ACAOrigin=*&Status=303',
+ '&mode=cors&credentials=same-origin&method=post&ACAOrigin=*&Status=303',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[methodIsGET]],
// The 307 redirect response MUST NOT change the method.
[OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL + 'ACAOrigin=*') +
- '&mode=cors&method=post&ACAOrigin=*&Status=307',
+ '&mode=cors&credentials=same-origin&method=post&ACAOrigin=*&Status=307',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[methodIsPOST]],
// The 308 redirect response MUST NOT change the method.
// FIXME: disabled due to https://crbug.com/451938
// [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL + 'ACAOrigin=*') +
- // '&mode=cors&method=post&ACAOrigin=*&Status=308',
+ // '&mode=cors&credentials=same-origin&method=post&ACAOrigin=*&Status=308',
// [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
// [methodIsPOST]],
@@ -194,14 +195,14 @@ var TEST_TARGETS = [
// Custom method
[OTHER_REDIRECT_URL +
encodeURIComponent(BASE_URL + 'ACAOrigin=*&ACAMethods=PUT') +
- '&mode=cors&method=PUT&ACAOrigin=*&ACAMethods=PUT',
+ '&mode=cors&credentials=same-origin&method=PUT&ACAOrigin=*&ACAMethods=PUT',
[fetchRejected]],
// Custom header
[OTHER_REDIRECT_URL +
encodeURIComponent(
BASE_URL +
'ACAOrigin=' + BASE_ORIGIN + '&ACAHeaders=x-serviceworker-test') +
- '&mode=cors&method=GET&headers=CUSTOM&ACAOrigin=*',
+ '&mode=cors&credentials=same-origin&method=GET&headers=CUSTOM&ACAOrigin=*',
[fetchRejected]],
// Redirect: other origin -> other origin
@@ -209,55 +210,57 @@ var TEST_TARGETS = [
'&mode=same-origin&method=GET',
[fetchRejected]],
[OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) +
- '&mode=cors&method=GET',
+ '&mode=cors&credentials=same-origin&method=GET',
[fetchRejected]],
[OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) +
- '&mode=cors&method=GET&ACAOrigin=*',
+ '&mode=cors&credentials=same-origin&method=GET&ACAOrigin=*',
[fetchRejected]],
[OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + 'ACAOrigin=*') +
- '&mode=cors&method=GET&ACAOrigin=*',
+ '&mode=cors&credentials=same-origin&method=GET&ACAOrigin=*',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[methodIsGET, authCheckNone]],
[OTHER_REDIRECT_URL +
encodeURIComponent(OTHER_BASE_URL + 'ACAOrigin=' + BASE_ORIGIN + '') +
- '&mode=cors&method=GET&ACAOrigin=*',
+ '&mode=cors&credentials=same-origin&method=GET&ACAOrigin=*',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[methodIsGET, authCheckNone]],
[OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + 'ACAOrigin=*') +
- '&mode=cors&method=GET&ACAOrigin=' + BASE_ORIGIN + '',
+ '&mode=cors&credentials=same-origin&method=GET' +
+ '&ACAOrigin=' + BASE_ORIGIN + '',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[methodIsGET, authCheckNone]],
[OTHER_REDIRECT_URL +
encodeURIComponent(OTHER_BASE_URL + 'ACAOrigin=' + BASE_ORIGIN + '') +
- '&mode=cors&method=GET&ACAOrigin=' + BASE_ORIGIN + '',
+ '&mode=cors&credentials=same-origin&method=GET' +
+ '&ACAOrigin=' + BASE_ORIGIN + '',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[methodIsGET, authCheckNone]],
// Status code tests for mode="cors"
// The 301 redirect response MAY change the request method from POST to GET.
[OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + 'ACAOrigin=*') +
- '&mode=cors&method=POST&ACAOrigin=*&Status=301',
+ '&mode=cors&credentials=same-origin&method=POST&ACAOrigin=*&Status=301',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[methodIsGET]],
// The 302 redirect response MAY change the request method from POST to GET.
[OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + 'ACAOrigin=*') +
- '&mode=cors&method=POST&ACAOrigin=*&Status=302',
+ '&mode=cors&credentials=same-origin&method=POST&ACAOrigin=*&Status=302',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[methodIsGET]],
// GET method must be used for 303 redirect.
[OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + 'ACAOrigin=*') +
- '&mode=cors&method=POST&ACAOrigin=*&Status=303',
+ '&mode=cors&credentials=same-origin&method=POST&ACAOrigin=*&Status=303',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[methodIsGET]],
// The 307 redirect response MUST NOT change the method.
[OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + 'ACAOrigin=*') +
- '&mode=cors&method=POST&ACAOrigin=*&Status=307',
+ '&mode=cors&credentials=same-origin&method=POST&ACAOrigin=*&Status=307',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[methodIsPOST]],
// The 308 redirect response MUST NOT change the method.
// FIXME: disabled due to https://crbug.com/451938
// [OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + 'ACAOrigin=*') +
- // '&mode=cors&method=POST&ACAOrigin=*&Status=308',
+ // '&mode=cors&credentials=same-origin&method=POST&ACAOrigin=*&Status=308',
// [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
// [methodIsPOST]],
@@ -265,7 +268,7 @@ var TEST_TARGETS = [
[OTHER_REDIRECT_URL +
encodeURIComponent(OTHER_BASE_URL +
'ACAOrigin=*&ACEHeaders=X-ServiceWorker-ServerHeader') +
- '&mode=cors&method=GET&ACAOrigin=*',
+ '&mode=cors&credentials=same-origin&method=GET&ACAOrigin=*',
[fetchResolved, noContentLength, hasServerHeader, hasBody, typeCors],
[methodIsGET, authCheckNone]],
@@ -274,14 +277,14 @@ var TEST_TARGETS = [
// Custom method
[OTHER_REDIRECT_URL +
encodeURIComponent(OTHER_BASE_URL + 'ACAOrigin=*&ACAMethods=PUT') +
- '&mode=cors&method=PUT&ACAOrigin=*&ACAMethods=PUT',
+ '&mode=cors&credentials=same-origin&method=PUT&ACAOrigin=*&ACAMethods=PUT',
[fetchRejected]],
// Custom header
[OTHER_REDIRECT_URL +
encodeURIComponent(
OTHER_BASE_URL +
'ACAOrigin=' + BASE_ORIGIN + '&ACAHeaders=x-serviceworker-test') +
- '&mode=cors&method=GET&headers=CUSTOM' +
+ '&mode=cors&credentials=same-origin&method=GET&headers=CUSTOM' +
'&ACAOrigin=' + BASE_ORIGIN + '&ACAHeaders=x-serviceworker-test',
[fetchRejected]],
];

Powered by Google App Engine
This is Rietveld 408576698