OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Service Worker: Navigation redirection</title> | 2 <title>Service Worker: Navigation redirection</title> |
3 <script src="../resources/testharness.js"></script> | 3 <script src="../resources/testharness.js"></script> |
4 <script src="../resources/testharnessreport.js"></script> | 4 <script src="../resources/testharnessreport.js"></script> |
5 <script src="../resources/get-host-info.js?pipe=sub"></script> | 5 <script src="../resources/get-host-info.js?pipe=sub"></script> |
6 <script src="resources/test-helpers.js"></script> | 6 <script src="resources/test-helpers.js"></script> |
7 <body> | 7 <body> |
8 <script> | 8 <script> |
9 | 9 |
10 var host_info = get_host_info(); | 10 var host_info = get_host_info(); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 SCOPE1 + 'sw=gen&url=' + encodeURIComponent(OTHER_ORIGIN_SCOPE), | 253 SCOPE1 + 'sw=gen&url=' + encodeURIComponent(OTHER_ORIGIN_SCOPE), |
254 OTHER_ORIGIN_SCOPE, | 254 OTHER_ORIGIN_SCOPE, |
255 [[SCOPE1 + 'sw=gen&url=' + encodeURIComponent(OTHER_ORIGIN_SCOPE)], | 255 [[SCOPE1 + 'sw=gen&url=' + encodeURIComponent(OTHER_ORIGIN_SCOPE)], |
256 [], | 256 [], |
257 [OTHER_ORIGIN_SCOPE]]); | 257 [OTHER_ORIGIN_SCOPE]]); |
258 }); | 258 }); |
259 }, 'SW-generated redirect to other-origin in-scope.'); | 259 }, 'SW-generated redirect to other-origin in-scope.'); |
260 | 260 |
261 // SW fetched redirect. | 261 // SW fetched redirect. |
262 // SW: event.respondWith(fetch(event.request)); | 262 // SW: event.respondWith(fetch(event.request)); |
263 // TODO(horo): When we change Request.redirect of navigation requests to | |
264 // 'manual', the expected last URL shuold be changed. (crbug.com/510650) | |
265 // Spec Issue: https://github.com/whatwg/fetch/issues/106 | |
266 promise_test(function(t) { | 263 promise_test(function(t) { |
267 return setup_environment(t).then(function() { | 264 return setup_environment(t).then(function() { |
268 return test_redirect( | 265 return test_redirect( |
269 SCOPE1 + 'sw=fetch&url=' + encodeURIComponent(OUT_SCOPE), | 266 SCOPE1 + 'sw=fetch&url=' + encodeURIComponent(OUT_SCOPE), |
270 SCOPE1 + 'sw=fetch&url=' + encodeURIComponent(OUT_SCOPE), | 267 OUT_SCOPE, |
271 [[SCOPE1 + 'sw=fetch&url=' + encodeURIComponent(OUT_SCOPE)], | 268 [[SCOPE1 + 'sw=fetch&url=' + encodeURIComponent(OUT_SCOPE)], |
272 [], | 269 [], |
273 []]); | 270 []]); |
274 }); | 271 }); |
275 }, 'SW-fetched redirect to same-origin out-scope.'); | 272 }, 'SW-fetched redirect to same-origin out-scope.'); |
276 promise_test(function(t) { | 273 promise_test(function(t) { |
277 return setup_environment(t).then(function() { | 274 return setup_environment(t).then(function() { |
278 return test_redirect( | 275 return test_redirect( |
279 SCOPE1 + 'sw=fetch&url=' + encodeURIComponent(SCOPE1), | 276 SCOPE1 + 'sw=fetch&url=' + encodeURIComponent(SCOPE1), |
280 SCOPE1 + 'sw=fetch&url=' + encodeURIComponent(SCOPE1), | 277 SCOPE1, |
281 [[SCOPE1 + 'sw=fetch&url=' + encodeURIComponent(SCOPE1)], [], []]); | 278 [[SCOPE1 + 'sw=fetch&url=' + encodeURIComponent(SCOPE1), SCOPE1], |
| 279 [], |
| 280 []]); |
282 }); | 281 }); |
283 }, 'SW-fetched redirect to same-origin same-scope.'); | 282 }, 'SW-fetched redirect to same-origin same-scope.'); |
284 promise_test(function(t) { | 283 promise_test(function(t) { |
285 return setup_environment(t).then(function() { | 284 return setup_environment(t).then(function() { |
286 return test_redirect( | 285 return test_redirect( |
287 SCOPE1 + 'sw=fetch&url=' + encodeURIComponent(SCOPE2), | 286 SCOPE1 + 'sw=fetch&url=' + encodeURIComponent(SCOPE2), |
288 SCOPE1 + 'sw=fetch&url=' + encodeURIComponent(SCOPE2), | 287 SCOPE2, |
289 [[SCOPE1 + 'sw=fetch&url=' + encodeURIComponent(SCOPE2)], [], []]); | 288 [[SCOPE1 + 'sw=fetch&url=' + encodeURIComponent(SCOPE2)], |
| 289 [SCOPE2], |
| 290 []]); |
290 }); | 291 }); |
291 }, 'SW fetched redirect to same-origin other-scope.'); | 292 }, 'SW-fetched redirect to same-origin other-scope.'); |
| 293 promise_test(function(t) { |
| 294 return setup_environment(t).then(function() { |
| 295 return test_redirect( |
| 296 SCOPE1 + 'sw=fetch&url=' + |
| 297 encodeURIComponent(OTHER_ORIGIN_OUT_SCOPE), |
| 298 OTHER_ORIGIN_OUT_SCOPE, |
| 299 [[SCOPE1 + 'sw=fetch&url=' + |
| 300 encodeURIComponent(OTHER_ORIGIN_OUT_SCOPE)], |
| 301 [], |
| 302 []]); |
| 303 }); |
| 304 }, 'SW-fetched redirect to other-origin out-scope.'); |
| 305 promise_test(function(t) { |
| 306 return setup_environment(t).then(function() { |
| 307 return test_redirect( |
| 308 SCOPE1 + 'sw=fetch&url=' + encodeURIComponent(OTHER_ORIGIN_SCOPE), |
| 309 OTHER_ORIGIN_SCOPE, |
| 310 [[SCOPE1 + 'sw=fetch&url=' + |
| 311 encodeURIComponent(OTHER_ORIGIN_SCOPE)], |
| 312 [], |
| 313 [OTHER_ORIGIN_SCOPE]]); |
| 314 }); |
| 315 }, 'SW-fetched redirect to other-origin in-scope.'); |
292 | 316 |
293 // Opaque redirect. | 317 // Opaque redirect. |
294 // SW: event.respondWith(fetch( | 318 // SW: event.respondWith(fetch( |
295 // new Request(event.request.url, {redirect: 'manual'}))); | 319 // new Request(event.request.url, {redirect: 'manual'}))); |
296 promise_test(function(t) { | 320 promise_test(function(t) { |
297 return setup_environment(t).then(function() { | 321 return setup_environment(t).then(function() { |
298 return test_redirect( | 322 return test_redirect( |
299 SCOPE1 + 'sw=opaque&url=' + encodeURIComponent(OUT_SCOPE), | 323 SCOPE1 + 'sw=opaque&url=' + encodeURIComponent(OUT_SCOPE), |
300 OUT_SCOPE, | 324 OUT_SCOPE, |
301 [[SCOPE1 + 'sw=opaque&url=' + encodeURIComponent(OUT_SCOPE)], | 325 [[SCOPE1 + 'sw=opaque&url=' + encodeURIComponent(OUT_SCOPE)], |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 [[SCOPE1 + 'sw=opaqueThroughCache&url=' + | 438 [[SCOPE1 + 'sw=opaqueThroughCache&url=' + |
415 encodeURIComponent(OTHER_ORIGIN_SCOPE)], | 439 encodeURIComponent(OTHER_ORIGIN_SCOPE)], |
416 [], | 440 [], |
417 [OTHER_ORIGIN_SCOPE]]); | 441 [OTHER_ORIGIN_SCOPE]]); |
418 }); | 442 }); |
419 }, | 443 }, |
420 'Redirect to other-origin in-scope with opaque redirect response which ' + | 444 'Redirect to other-origin in-scope with opaque redirect response which ' + |
421 'is passed through Cache.'); | 445 'is passed through Cache.'); |
422 </script> | 446 </script> |
423 </body> | 447 </body> |
OLD | NEW |