| Index: LayoutTests/http/tests/fetch/script-tests/fetch-access-control-redirect-credentials.js
|
| diff --git a/LayoutTests/http/tests/fetch/script-tests/fetch-access-control-redirect-credentials.js b/LayoutTests/http/tests/fetch/script-tests/fetch-access-control-redirect-credentials.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f9845df0c23116753f9844efa231bf974419383e
|
| --- /dev/null
|
| +++ b/LayoutTests/http/tests/fetch/script-tests/fetch-access-control-redirect-credentials.js
|
| @@ -0,0 +1,105 @@
|
| +if (self.importScripts) {
|
| + importScripts('../resources/fetch-test-helpers.js');
|
| + importScripts('/serviceworker/resources/fetch-access-control-util.js');
|
| +}
|
| +
|
| +var TEST_TARGETS = [
|
| + // Redirect: same origin -> same origin
|
| + // Credential test
|
| + [REDIRECT_URL + encodeURIComponent(BASE_URL) +
|
| + '&mode=cors&credentials=omit&method=GET',
|
| + [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
|
| + [methodIsGET, authCheckNone]],
|
| + [REDIRECT_URL + encodeURIComponent(BASE_URL) +
|
| + '&mode=cors&credentials=include&method=GET',
|
| + [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
|
| + [methodIsGET, authCheck1]],
|
| + [REDIRECT_URL + encodeURIComponent(BASE_URL) +
|
| + '&mode=cors&credentials=same-origin&method=GET',
|
| + [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
|
| + [methodIsGET, authCheck1]],
|
| +
|
| + // Redirect: same origin -> other origin
|
| + // Credential test
|
| + [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) +
|
| + '&mode=cors&credentials=omit&method=GET',
|
| + [fetchRejected]],
|
| + [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) +
|
| + '&mode=cors&credentials=include&method=GET',
|
| + [fetchRejected]],
|
| + [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) +
|
| + '&mode=cors&credentials=same-origin&method=GET',
|
| + [fetchRejected]],
|
| +
|
| + [REDIRECT_URL +
|
| + encodeURIComponent(OTHER_BASE_URL + '&ACAOrigin=' + BASE_ORIGIN + '') +
|
| + '&mode=cors&credentials=omit&method=GET',
|
| + [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
|
| + [methodIsGET, authCheckNone]],
|
| + [REDIRECT_URL +
|
| + encodeURIComponent(OTHER_BASE_URL +
|
| + '&ACAOrigin=' + BASE_ORIGIN + '&ACACredentials=true') +
|
| + '&mode=cors&credentials=omit&method=GET',
|
| + [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
|
| + [methodIsGET, authCheckNone]],
|
| +
|
| + [REDIRECT_URL +
|
| + encodeURIComponent(OTHER_BASE_URL + '&ACAOrigin=' + BASE_ORIGIN + '') +
|
| + '&mode=cors&credentials=include&method=GET',
|
| + [fetchRejected]],
|
| + [REDIRECT_URL +
|
| + encodeURIComponent(OTHER_BASE_URL +
|
| + '&ACAOrigin=' + BASE_ORIGIN + '&ACACredentials=true') +
|
| + '&mode=cors&credentials=include&method=GET',
|
| + [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
|
| + [methodIsGET, authCheck2]],
|
| +
|
| + [REDIRECT_URL +
|
| + encodeURIComponent(OTHER_BASE_URL + '&ACAOrigin=' + BASE_ORIGIN + '') +
|
| + '&mode=cors&credentials=same-origin&method=GET',
|
| + [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
|
| + [methodIsGET, authCheckNone]],
|
| + [REDIRECT_URL +
|
| + encodeURIComponent(OTHER_BASE_URL +
|
| + '&ACAOrigin=' + BASE_ORIGIN + '&ACACredentials=true') +
|
| + '&mode=cors&credentials=same-origin&method=GET',
|
| + [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
|
| + [methodIsGET, authCheckNone]],
|
| +
|
| + // Redirect: other origin -> same origin
|
| + // Credentials test
|
| + [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL + 'ACAOrigin=*') +
|
| + '&mode=cors&credentials=omit&method=GET&ACAOrigin=*',
|
| + [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
|
| + [methodIsGET, authCheckNone]],
|
| + [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL + 'ACAOrigin=*') +
|
| + '&mode=cors&credentials=include&method=GET&ACAOrigin=*',
|
| + [fetchRejected]],
|
| + [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL + 'ACAOrigin=*') +
|
| + '&mode=cors&credentials=same-origin&method=GET&ACAOrigin=*',
|
| + [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
|
| + [methodIsGET, authCheckNone]],
|
| + [OTHER_REDIRECT_URL +
|
| + encodeURIComponent(BASE_URL + 'ACAOrigin=null&ACACredentials=true') +
|
| + '&mode=cors&credentials=omit&method=GET' +
|
| + '&ACAOrigin=' + BASE_ORIGIN + '&ACACredentials=true',
|
| + [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
|
| + [methodIsGET, authCheckNone]],
|
| + [OTHER_REDIRECT_URL +
|
| + encodeURIComponent(BASE_URL + 'ACAOrigin=null&ACACredentials=true') +
|
| + '&mode=cors&credentials=include&method=GET' +
|
| + '&ACAOrigin=' + BASE_ORIGIN + '&ACACredentials=true',
|
| + [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
|
| + [methodIsGET, authCheck1]],
|
| + [OTHER_REDIRECT_URL +
|
| + encodeURIComponent(BASE_URL + 'ACAOrigin=null&ACACredentials=true') +
|
| + '&mode=cors&credentials=same-origin&method=GET' +
|
| + '&ACAOrigin=' + BASE_ORIGIN + '&ACACredentials=true',
|
| + [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
|
| + [methodIsGET, authCheckNone]],
|
| +];
|
| +
|
| +if (self.importScripts) {
|
| + executeTests(TEST_TARGETS);
|
| + done();
|
| +}
|
|
|