| OLD | NEW |
| 1 if (self.importScripts) { | 1 if (self.importScripts) { |
| 2 importScripts('/resources/testharness.js'); | 2 importScripts('/resources/testharness.js'); |
| 3 importScripts('/serviceworker/resources/test-helpers.js'); | 3 importScripts('/serviceworker/resources/test-helpers.js'); |
| 4 importScripts('/fetch/resources/fetch-test-options.js'); | 4 importScripts('/fetch/resources/fetch-test-options.js'); |
| 5 } | 5 } |
| 6 | 6 |
| 7 function getContentType(headers) { | 7 function getContentType(headers) { |
| 8 var content_type = ''; | 8 var content_type = ''; |
| 9 for (var header of headers) { | 9 for (var header of headers) { |
| 10 if (header[0] == 'content-type') | 10 if (header[0] == 'content-type') |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 .then(t.unreached_func('Test 3: Must be blocked (' + | 180 .then(t.unreached_func('Test 3: Must be blocked (' + |
| 181 mode + ', HTTPS->HTTP->HTTPS)'), | 181 mode + ', HTTPS->HTTP->HTTPS)'), |
| 182 function() {}); | 182 function() {}); |
| 183 }) | 183 }) |
| 184 .then(function() { | 184 .then(function() { |
| 185 // Test 4: Must success. | 185 // Test 4: Must success. |
| 186 // Test that the mixed contents above are not rejected due to | 186 // Test that the mixed contents above are not rejected due to |
| 187 return fetch(HTTPS_REDIRECT_URL + | 187 return fetch(HTTPS_REDIRECT_URL + |
| 188 encodeURIComponent(HTTPS_BASE_URL + 'test4-' + mode), | 188 encodeURIComponent(HTTPS_BASE_URL + 'test4-' + mode), |
| 189 {mode: mode}) | 189 {mode: mode}) |
| 190 .then(function(res) {assert_equals(res.status, 200); }, | 190 .then(function(res) {assert_equals(res.status, mode == 'no-cors' ?
0 : 200); }, |
| 191 t.unreached_func('Test 4: Must success (' + | 191 t.unreached_func('Test 4: Must success (' + |
| 192 mode + ', HTTPS->HTTPS->HTTPS)')); | 192 mode + ', HTTPS->HTTPS->HTTPS)')); |
| 193 }) | 193 }) |
| 194 .then(function() { | 194 .then(function() { |
| 195 // Test 5: Must success if mode is not 'same-origin'. | 195 // Test 5: Must success if mode is not 'same-origin'. |
| 196 // Test that the mixed contents above are not rejected due to | 196 // Test that the mixed contents above are not rejected due to |
| 197 // CORS check. | 197 // CORS check. |
| 198 return fetch(HTTPS_OTHER_REDIRECT_URL + | 198 return fetch(HTTPS_OTHER_REDIRECT_URL + |
| 199 encodeURIComponent(HTTPS_BASE_URL + 'test5-' + mode), | 199 encodeURIComponent(HTTPS_BASE_URL + 'test5-' + mode), |
| 200 {mode: mode}) | 200 {mode: mode}) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 227 {referrer: referrer, referrerPolicy: policy, mode: 'cors'}); | 227 {referrer: referrer, referrerPolicy: policy, mode: 'cors'}); |
| 228 return fetch(new Request(url, request)).then(res => { | 228 return fetch(new Request(url, request)).then(res => { |
| 229 return res.json(); | 229 return res.json(); |
| 230 }).then(json => { | 230 }).then(json => { |
| 231 assert_equals(json.referrer, expected, 'referrer'); | 231 assert_equals(json.referrer, expected, 'referrer'); |
| 232 }); | 232 }); |
| 233 }, | 233 }, |
| 234 `referrer test: url = ${url}, referrer = ${referrer}, policy = ${policy}`); | 234 `referrer test: url = ${url}, referrer = ${referrer}, policy = ${policy}`); |
| 235 } | 235 } |
| 236 } | 236 } |
| OLD | NEW |