| 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=no-cors&method=GET&headers=CUSTOM', | 9 '&mode=no-cors&method=GET&headers=CUSTOM', |
| 10 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic, | 10 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic, |
| 11 checkURLList.bind(self, [BASE_URL])], | 11 responseRedirected, checkURLList.bind(self, [BASE_URL])], |
| 12 [methodIsGET, noCustomHeader, authCheck1]], | 12 [methodIsGET, noCustomHeader, authCheck1]], |
| 13 | 13 |
| 14 // Redirect: same origin -> other origin | 14 // Redirect: same origin -> other origin |
| 15 [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) + | 15 [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) + |
| 16 '&mode=no-cors&method=GET&headers=CUSTOM', | 16 '&mode=no-cors&method=GET&headers=CUSTOM', |
| 17 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, | 17 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, |
| 18 checkURLList.bind(self, [OTHER_BASE_URL])], | 18 responseNotRedirected, checkURLList.bind(self, [OTHER_BASE_URL])], |
| 19 onlyOnServiceWorkerProxiedTest([methodIsGET, noCustomHeader, authCheck2])], | 19 onlyOnServiceWorkerProxiedTest([methodIsGET, noCustomHeader, authCheck2])], |
| 20 | 20 |
| 21 // Status code tests for mode="no-cors" | 21 // Status code tests for mode="no-cors" |
| 22 // The 301 redirect response changes POST method to GET method. | 22 // The 301 redirect response changes POST method to GET method. |
| 23 [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) + | 23 [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) + |
| 24 '&mode=no-cors&method=POST&Status=301', | 24 '&mode=no-cors&method=POST&Status=301', |
| 25 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, | 25 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, |
| 26 checkURLList.bind(self, [OTHER_BASE_URL])], | 26 responseNotRedirected, checkURLList.bind(self, [OTHER_BASE_URL])], |
| 27 onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck2])], | 27 onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck2])], |
| 28 // The 302 redirect response changes POST method to GET method. | 28 // The 302 redirect response changes POST method to GET method. |
| 29 [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) + | 29 [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) + |
| 30 '&mode=no-cors&method=POST', | 30 '&mode=no-cors&method=POST', |
| 31 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, | 31 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, |
| 32 checkURLList.bind(self, [OTHER_BASE_URL])], | 32 responseNotRedirected, checkURLList.bind(self, [OTHER_BASE_URL])], |
| 33 onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck2])], | 33 onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck2])], |
| 34 // GET method must be used for 303 redirect. | 34 // GET method must be used for 303 redirect. |
| 35 [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) + | 35 [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) + |
| 36 '&mode=no-cors&method=POST&Status=303', | 36 '&mode=no-cors&method=POST&Status=303', |
| 37 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, | 37 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, |
| 38 checkURLList.bind(self, [OTHER_BASE_URL])], | 38 responseNotRedirected, checkURLList.bind(self, [OTHER_BASE_URL])], |
| 39 onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck2])], | 39 onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck2])], |
| 40 // The 307 redirect response doesn't change the method. | 40 // The 307 redirect response doesn't change the method. |
| 41 [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) + | 41 [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) + |
| 42 '&mode=no-cors&method=POST&Status=307', | 42 '&mode=no-cors&method=POST&Status=307', |
| 43 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, | 43 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, |
| 44 checkURLList.bind(self, [OTHER_BASE_URL])], | 44 responseNotRedirected, checkURLList.bind(self, [OTHER_BASE_URL])], |
| 45 onlyOnServiceWorkerProxiedTest([methodIsPOST, authCheck2])], | 45 onlyOnServiceWorkerProxiedTest([methodIsPOST, authCheck2])], |
| 46 // The 308 redirect response doesn't change the method. | 46 // The 308 redirect response doesn't change the method. |
| 47 // FIXME: disabled due to https://crbug.com/451938 | 47 // FIXME: disabled due to https://crbug.com/451938 |
| 48 // [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) + | 48 // [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) + |
| 49 // '&mode=no-cors&method=POST&Status=308', | 49 // '&mode=no-cors&method=POST&Status=308', |
| 50 // [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque], | 50 // [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque], |
| 51 // onlyOnServiceWorkerProxiedTest([methodIsPOST, authCheck2])], | 51 // onlyOnServiceWorkerProxiedTest([methodIsPOST, authCheck2])], |
| 52 | 52 |
| 53 // Redirect: other origin -> same origin | 53 // Redirect: other origin -> same origin |
| 54 [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) + | 54 [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) + |
| 55 '&mode=no-cors&method=GET', | 55 '&mode=no-cors&method=GET', |
| 56 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, | 56 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, |
| 57 checkURLList.bind(self, [BASE_URL])], | 57 responseNotRedirected, checkURLList.bind(self, [BASE_URL])], |
| 58 onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck1])], | 58 onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck1])], |
| 59 [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) + | 59 [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) + |
| 60 '&mode=no-cors&method=GET&headers=CUSTOM', | 60 '&mode=no-cors&method=GET&headers=CUSTOM', |
| 61 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, | 61 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, |
| 62 checkURLList.bind(self, [BASE_URL])], | 62 responseNotRedirected, checkURLList.bind(self, [BASE_URL])], |
| 63 onlyOnServiceWorkerProxiedTest([methodIsGET, noCustomHeader, authCheck1])], | 63 onlyOnServiceWorkerProxiedTest([methodIsGET, noCustomHeader, authCheck1])], |
| 64 | 64 |
| 65 // Status code tests for mode="no-cors" | 65 // Status code tests for mode="no-cors" |
| 66 // The 301 redirect response MAY change the request method from POST to GET. | 66 // The 301 redirect response MAY change the request method from POST to GET. |
| 67 [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) + | 67 [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) + |
| 68 '&mode=no-cors&method=POST&Status=301', | 68 '&mode=no-cors&method=POST&Status=301', |
| 69 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, | 69 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, |
| 70 checkURLList.bind(self, [BASE_URL])], | 70 responseNotRedirected, checkURLList.bind(self, [BASE_URL])], |
| 71 onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck1])], | 71 onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck1])], |
| 72 // The 302 redirect response MAY change the request method from POST to GET. | 72 // The 302 redirect response MAY change the request method from POST to GET. |
| 73 [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) + | 73 [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) + |
| 74 '&mode=no-cors&method=POST', | 74 '&mode=no-cors&method=POST', |
| 75 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, | 75 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, |
| 76 checkURLList.bind(self, [BASE_URL])], | 76 responseNotRedirected, checkURLList.bind(self, [BASE_URL])], |
| 77 onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck1])], | 77 onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck1])], |
| 78 // GET method must be used for 303 redirect. | 78 // GET method must be used for 303 redirect. |
| 79 [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) + | 79 [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) + |
| 80 '&mode=no-cors&method=POST&Status=303', | 80 '&mode=no-cors&method=POST&Status=303', |
| 81 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, | 81 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, |
| 82 checkURLList.bind(self, [BASE_URL])], | 82 responseNotRedirected, checkURLList.bind(self, [BASE_URL])], |
| 83 onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck1])], | 83 onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck1])], |
| 84 // The 307 redirect response MUST NOT change the method. | 84 // The 307 redirect response MUST NOT change the method. |
| 85 [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) + | 85 [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) + |
| 86 '&mode=no-cors&method=POST&Status=307', | 86 '&mode=no-cors&method=POST&Status=307', |
| 87 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, | 87 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, |
| 88 checkURLList.bind(self, [BASE_URL])], | 88 responseNotRedirected, checkURLList.bind(self, [BASE_URL])], |
| 89 onlyOnServiceWorkerProxiedTest([methodIsPOST, authCheck1])], | 89 onlyOnServiceWorkerProxiedTest([methodIsPOST, authCheck1])], |
| 90 // The 308 redirect response MUST NOT change the method. | 90 // The 308 redirect response MUST NOT change the method. |
| 91 // FIXME: disabled due to https://crbug.com/451938 | 91 // FIXME: disabled due to https://crbug.com/451938 |
| 92 // [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) + | 92 // [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) + |
| 93 // '&mode=no-cors&method=POST&Status=308', | 93 // '&mode=no-cors&method=POST&Status=308', |
| 94 // [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque], | 94 // [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque], |
| 95 // onlyOnServiceWorkerProxiedTest([methodIsPOST, authCheck1])], | 95 // onlyOnServiceWorkerProxiedTest([methodIsPOST, authCheck1])], |
| 96 | 96 |
| 97 // Redirect: other origin -> same origin | 97 // Redirect: other origin -> same origin |
| 98 [OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) + | 98 [OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) + |
| 99 '&mode=no-cors&method=GET', | 99 '&mode=no-cors&method=GET', |
| 100 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, | 100 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque, |
| 101 checkURLList.bind(self, [OTHER_BASE_URL])], | 101 responseNotRedirected, checkURLList.bind(self, [OTHER_BASE_URL])], |
| 102 onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck2])], | 102 onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck2])], |
| 103 ]; | 103 ]; |
| 104 | 104 |
| 105 if (self.importScripts) { | 105 if (self.importScripts) { |
| 106 executeTests(TEST_TARGETS); | 106 executeTests(TEST_TARGETS); |
| 107 done(); | 107 done(); |
| 108 } | 108 } |
| OLD | NEW |