| OLD | NEW |
| (Empty) |
| 1 if (self.importScripts) { | |
| 2 importScripts('../resources/fetch-test-helpers.js'); | |
| 3 importScripts('../resources/fetch-access-control-util.js'); | |
| 4 } | |
| 5 | |
| 6 var TEST_TARGETS = [ | |
| 7 // Redirect: same origin -> same origin | |
| 8 // Credential test | |
| 9 [REDIRECT_URL + encodeURIComponent(BASE_URL) + | |
| 10 '&mode=cors&credentials=omit&method=GET', | |
| 11 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | |
| 12 [methodIsGET, authCheckNone]], | |
| 13 [REDIRECT_URL + encodeURIComponent(BASE_URL) + | |
| 14 '&mode=cors&credentials=include&method=GET', | |
| 15 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | |
| 16 [methodIsGET, authCheck1]], | |
| 17 [REDIRECT_URL + encodeURIComponent(BASE_URL) + | |
| 18 '&mode=cors&credentials=same-origin&method=GET', | |
| 19 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | |
| 20 [methodIsGET, authCheck1]], | |
| 21 | |
| 22 // Redirect: same origin -> other origin | |
| 23 // Credential test | |
| 24 [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) + | |
| 25 '&mode=cors&credentials=omit&method=GET', | |
| 26 [fetchRejected]], | |
| 27 [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) + | |
| 28 '&mode=cors&credentials=include&method=GET', | |
| 29 [fetchRejected]], | |
| 30 [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) + | |
| 31 '&mode=cors&credentials=same-origin&method=GET', | |
| 32 [fetchRejected]], | |
| 33 | |
| 34 [REDIRECT_URL + | |
| 35 encodeURIComponent(OTHER_BASE_URL + '&ACAOrigin=' + BASE_ORIGIN + '') + | |
| 36 '&mode=cors&credentials=omit&method=GET', | |
| 37 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | |
| 38 [methodIsGET, authCheckNone]], | |
| 39 [REDIRECT_URL + | |
| 40 encodeURIComponent(OTHER_BASE_URL + | |
| 41 '&ACAOrigin=' + BASE_ORIGIN + '&ACACredentials=true') + | |
| 42 '&mode=cors&credentials=omit&method=GET', | |
| 43 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | |
| 44 [methodIsGET, authCheckNone]], | |
| 45 | |
| 46 [REDIRECT_URL + | |
| 47 encodeURIComponent(OTHER_BASE_URL + '&ACAOrigin=' + BASE_ORIGIN + '') + | |
| 48 '&mode=cors&credentials=include&method=GET', | |
| 49 [fetchRejected]], | |
| 50 [REDIRECT_URL + | |
| 51 encodeURIComponent(OTHER_BASE_URL + | |
| 52 '&ACAOrigin=' + BASE_ORIGIN + '&ACACredentials=true') + | |
| 53 '&mode=cors&credentials=include&method=GET', | |
| 54 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | |
| 55 [methodIsGET, authCheck2]], | |
| 56 | |
| 57 [REDIRECT_URL + | |
| 58 encodeURIComponent(OTHER_BASE_URL + '&ACAOrigin=' + BASE_ORIGIN + '') + | |
| 59 '&mode=cors&credentials=same-origin&method=GET', | |
| 60 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | |
| 61 [methodIsGET, authCheckNone]], | |
| 62 [REDIRECT_URL + | |
| 63 encodeURIComponent(OTHER_BASE_URL + | |
| 64 '&ACAOrigin=' + BASE_ORIGIN + '&ACACredentials=true') + | |
| 65 '&mode=cors&credentials=same-origin&method=GET', | |
| 66 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | |
| 67 [methodIsGET, authCheckNone]], | |
| 68 | |
| 69 // Redirect: other origin -> same origin | |
| 70 // Credentials test | |
| 71 [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL + 'ACAOrigin=*') + | |
| 72 '&mode=cors&credentials=omit&method=GET&ACAOrigin=*', | |
| 73 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | |
| 74 [methodIsGET, authCheckNone]], | |
| 75 [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL + 'ACAOrigin=*') + | |
| 76 '&mode=cors&credentials=include&method=GET&ACAOrigin=*', | |
| 77 [fetchRejected]], | |
| 78 [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL + 'ACAOrigin=*') + | |
| 79 '&mode=cors&credentials=same-origin&method=GET&ACAOrigin=*', | |
| 80 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | |
| 81 [methodIsGET, authCheckNone]], | |
| 82 [OTHER_REDIRECT_URL + | |
| 83 encodeURIComponent(BASE_URL + 'ACAOrigin=null&ACACredentials=true') + | |
| 84 '&mode=cors&credentials=omit&method=GET' + | |
| 85 '&ACAOrigin=' + BASE_ORIGIN + '&ACACredentials=true', | |
| 86 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | |
| 87 [methodIsGET, authCheckNone]], | |
| 88 [OTHER_REDIRECT_URL + | |
| 89 encodeURIComponent(BASE_URL + 'ACAOrigin=null&ACACredentials=true') + | |
| 90 '&mode=cors&credentials=include&method=GET' + | |
| 91 '&ACAOrigin=' + BASE_ORIGIN + '&ACACredentials=true', | |
| 92 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | |
| 93 [methodIsGET, authCheck1]], | |
| 94 [OTHER_REDIRECT_URL + | |
| 95 encodeURIComponent(BASE_URL + 'ACAOrigin=null&ACACredentials=true') + | |
| 96 '&mode=cors&credentials=same-origin&method=GET' + | |
| 97 '&ACAOrigin=' + BASE_ORIGIN + '&ACACredentials=true', | |
| 98 [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], | |
| 99 [methodIsGET, authCheckNone]], | |
| 100 ]; | |
| 101 | |
| 102 if (self.importScripts) { | |
| 103 executeTests(TEST_TARGETS); | |
| 104 done(); | |
| 105 } | |
| OLD | NEW |