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="/common/get-host-info.sub.js"></script> | 5 <script src="/common/get-host-info.sub.js"></script> |
6 <script src="resources/test-helpers.sub.js"></script> | 6 <script src="resources/test-helpers.sub.js"></script> |
7 <body> | 7 <body> |
8 <script> | 8 <script> |
9 var host_info = get_host_info(); | 9 var host_info = get_host_info(); |
10 | 10 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 SCOPE1 + 'url=' + encodeURIComponent(OUT_SCOPE), | 169 SCOPE1 + 'url=' + encodeURIComponent(OUT_SCOPE), |
170 OUT_SCOPE, | 170 OUT_SCOPE, |
171 [[SCOPE1 + 'url=' + encodeURIComponent(OUT_SCOPE)], [], []]); | 171 [[SCOPE1 + 'url=' + encodeURIComponent(OUT_SCOPE)], [], []]); |
172 }); | 172 }); |
173 }, 'SW-fallbacked redirect to same-origin out-scope.'); | 173 }, 'SW-fallbacked redirect to same-origin out-scope.'); |
174 promise_test(function(t) { | 174 promise_test(function(t) { |
175 return setup_environment(t).then(function() { | 175 return setup_environment(t).then(function() { |
176 return test_redirect( | 176 return test_redirect( |
177 SCOPE1 + 'url=' + encodeURIComponent(SCOPE1), | 177 SCOPE1 + 'url=' + encodeURIComponent(SCOPE1), |
178 SCOPE1, | 178 SCOPE1, |
179 [[SCOPE1 + 'url=' + encodeURIComponent(SCOPE1)], [], []]); | 179 [[SCOPE1 + 'url=' + encodeURIComponent(SCOPE1), SCOPE1], [], []]); |
180 }); | 180 }); |
181 }, 'SW-fallbacked redirect to same-origin same-scope.'); | 181 }, 'SW-fallbacked redirect to same-origin same-scope.'); |
182 promise_test(function(t) { | 182 promise_test(function(t) { |
183 return setup_environment(t).then(function() { | 183 return setup_environment(t).then(function() { |
184 return test_redirect( | 184 return test_redirect( |
185 SCOPE1 + 'url=' + encodeURIComponent(SCOPE2), | 185 SCOPE1 + 'url=' + encodeURIComponent(SCOPE2), |
186 SCOPE2, | 186 SCOPE2, |
187 [[SCOPE1 + 'url=' + encodeURIComponent(SCOPE2)], [], []]); | 187 [[SCOPE1 + 'url=' + encodeURIComponent(SCOPE2)], [SCOPE2], []]); |
188 }); | 188 }); |
189 }, 'SW-fallbacked redirect to same-origin other-scope.'); | 189 }, 'SW-fallbacked redirect to same-origin other-scope.'); |
190 promise_test(function(t) { | 190 promise_test(function(t) { |
191 return setup_environment(t).then(function() { | 191 return setup_environment(t).then(function() { |
192 return test_redirect( | 192 return test_redirect( |
193 SCOPE1 + 'url=' + encodeURIComponent(OTHER_ORIGIN_OUT_SCOPE), | 193 SCOPE1 + 'url=' + encodeURIComponent(OTHER_ORIGIN_OUT_SCOPE), |
194 OTHER_ORIGIN_OUT_SCOPE, | 194 OTHER_ORIGIN_OUT_SCOPE, |
195 [[SCOPE1 + 'url=' + encodeURIComponent(OTHER_ORIGIN_OUT_SCOPE)], | 195 [[SCOPE1 + 'url=' + encodeURIComponent(OTHER_ORIGIN_OUT_SCOPE)], |
196 [], | 196 [], |
197 []]); | 197 []]); |
198 }); | 198 }); |
199 }, 'SW-fallbacked redirect to other-origin out-scope.'); | 199 }, 'SW-fallbacked redirect to other-origin out-scope.'); |
200 promise_test(function(t) { | 200 promise_test(function(t) { |
201 return setup_environment(t).then(function() { | 201 return setup_environment(t).then(function() { |
202 return test_redirect( | 202 return test_redirect( |
203 SCOPE1 + 'url=' + encodeURIComponent(OTHER_ORIGIN_SCOPE), | 203 SCOPE1 + 'url=' + encodeURIComponent(OTHER_ORIGIN_SCOPE), |
204 OTHER_ORIGIN_SCOPE, | 204 OTHER_ORIGIN_SCOPE, |
205 [[SCOPE1 + 'url=' + encodeURIComponent(OTHER_ORIGIN_SCOPE)], | 205 [[SCOPE1 + 'url=' + encodeURIComponent(OTHER_ORIGIN_SCOPE)], |
206 [], | 206 [], |
207 []]); | 207 [OTHER_ORIGIN_SCOPE]]); |
208 }); | 208 }); |
209 }, 'SW-fallbacked redirect to other-origin in-scope.'); | 209 }, 'SW-fallbacked redirect to other-origin in-scope.'); |
210 | 210 |
211 // SW generated redirect. | 211 // SW generated redirect. |
212 // SW: event.respondWith(Response.redirect(params['url'])); | 212 // SW: event.respondWith(Response.redirect(params['url'])); |
213 promise_test(function(t) { | 213 promise_test(function(t) { |
214 return setup_environment(t).then(function() { | 214 return setup_environment(t).then(function() { |
215 return test_redirect( | 215 return test_redirect( |
216 SCOPE1 + 'sw=gen&url=' + encodeURIComponent(OUT_SCOPE), | 216 SCOPE1 + 'sw=gen&url=' + encodeURIComponent(OUT_SCOPE), |
217 OUT_SCOPE, | 217 OUT_SCOPE, |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 return setup_environment(t).then(function() { | 365 return setup_environment(t).then(function() { |
366 return test_redirect( | 366 return test_redirect( |
367 SCOPE1 + 'sw=opaque&url=' + encodeURIComponent(OTHER_ORIGIN_SCOPE), | 367 SCOPE1 + 'sw=opaque&url=' + encodeURIComponent(OTHER_ORIGIN_SCOPE), |
368 OTHER_ORIGIN_SCOPE, | 368 OTHER_ORIGIN_SCOPE, |
369 [[SCOPE1 + 'sw=opaque&url=' + | 369 [[SCOPE1 + 'sw=opaque&url=' + |
370 encodeURIComponent(OTHER_ORIGIN_SCOPE)], | 370 encodeURIComponent(OTHER_ORIGIN_SCOPE)], |
371 [], | 371 [], |
372 [OTHER_ORIGIN_SCOPE]]); | 372 [OTHER_ORIGIN_SCOPE]]); |
373 }); | 373 }); |
374 }, 'Redirect to other-origin in-scope with opaque redirect response.'); | 374 }, 'Redirect to other-origin in-scope with opaque redirect response.'); |
| 375 promise_test(function(t) { |
| 376 return setup_environment(t).then(function() { |
| 377 return test_redirect( |
| 378 SCOPE1 + 'sw=opaque&noLocationRedirect', |
| 379 SCOPE1 + 'sw=opaque&noLocationRedirect', |
| 380 [[SCOPE1 + 'sw=opaque&noLocationRedirect'], |
| 381 [], |
| 382 []]); |
| 383 }); |
| 384 }, 'No location redirect response.'); |
375 | 385 |
376 // Opaque redirect passed through Cache. | 386 // Opaque redirect passed through Cache. |
377 // SW responds with an opaque redirectresponse from the Cache API. | 387 // SW responds with an opaque redirectresponse from the Cache API. |
378 promise_test(function(t) { | 388 promise_test(function(t) { |
379 return setup_environment(t).then(function() { | 389 return setup_environment(t).then(function() { |
380 return test_redirect( | 390 return test_redirect( |
381 SCOPE1 + 'sw=opaqueThroughCache&url=' + | 391 SCOPE1 + 'sw=opaqueThroughCache&url=' + |
382 encodeURIComponent(OUT_SCOPE), | 392 encodeURIComponent(OUT_SCOPE), |
383 OUT_SCOPE, | 393 OUT_SCOPE, |
384 [[SCOPE1 + 'sw=opaqueThroughCache&url=' + | 394 [[SCOPE1 + 'sw=opaqueThroughCache&url=' + |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 encodeURIComponent(OTHER_ORIGIN_SCOPE), | 448 encodeURIComponent(OTHER_ORIGIN_SCOPE), |
439 OTHER_ORIGIN_SCOPE, | 449 OTHER_ORIGIN_SCOPE, |
440 [[SCOPE1 + 'sw=opaqueThroughCache&url=' + | 450 [[SCOPE1 + 'sw=opaqueThroughCache&url=' + |
441 encodeURIComponent(OTHER_ORIGIN_SCOPE)], | 451 encodeURIComponent(OTHER_ORIGIN_SCOPE)], |
442 [], | 452 [], |
443 [OTHER_ORIGIN_SCOPE]]); | 453 [OTHER_ORIGIN_SCOPE]]); |
444 }); | 454 }); |
445 }, | 455 }, |
446 'Redirect to other-origin in-scope with opaque redirect response which ' + | 456 'Redirect to other-origin in-scope with opaque redirect response which ' + |
447 'is passed through Cache.'); | 457 'is passed through Cache.'); |
| 458 promise_test(function(t) { |
| 459 return setup_environment(t).then(function() { |
| 460 return test_redirect( |
| 461 SCOPE1 + 'sw=opaqueThroughCache&noLocationRedirect', |
| 462 SCOPE1 + 'sw=opaqueThroughCache&noLocationRedirect', |
| 463 [[SCOPE1 + 'sw=opaqueThroughCache&noLocationRedirect'], |
| 464 [], |
| 465 []]); |
| 466 }); |
| 467 }, 'No location redirect response via Cache.'); |
448 </script> | 468 </script> |
449 </body> | 469 </body> |
OLD | NEW |