OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Service Worker: the fallback behavior of FetchEvent</title> | 2 <title>Service Worker: the fallback behavior of FetchEvent</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 <script> | 7 <script> |
8 | 8 |
9 function assert_resolves(promise, description) { | 9 function assert_resolves(promise, description) { |
10 return new Promise(function(resolve, reject) { | 10 return new Promise(function(resolve, reject) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 worker = registration.installing; | 59 worker = registration.installing; |
60 return wait_for_state(t, worker, 'activated'); | 60 return wait_for_state(t, worker, 'activated'); |
61 }) | 61 }) |
62 .then(function() { return with_iframe(SCOPE); }) | 62 .then(function() { return with_iframe(SCOPE); }) |
63 .then(function(f) { | 63 .then(function(f) { |
64 frame = f; | 64 frame = f; |
65 return check_urls( | 65 return check_urls( |
66 worker, | 66 worker, |
67 [{ | 67 [{ |
68 url: host_info['HTTP_ORIGIN'] + '/serviceworker/' + SCOPE, | 68 url: host_info['HTTP_ORIGIN'] + '/serviceworker/' + SCOPE, |
69 mode: 'same-origin' | 69 mode: 'navigate' |
70 }], | 70 }], |
71 'The SW must intercept the request for a main resourc.'); | 71 'The SW must intercept the request for a main resourc.'); |
72 }) | 72 }) |
73 .then(function() { | 73 .then(function() { |
74 return assert_resolves( | 74 return assert_resolves( |
75 frame.contentWindow.xhr(BASE_URL), | 75 frame.contentWindow.xhr(BASE_URL), |
76 'SW fallbacked same origin XHR should succeed.'); | 76 'SW fallbacked same origin XHR should succeed.'); |
77 }) | 77 }) |
78 .then(function() { | 78 .then(function() { |
79 return check_urls( | 79 return check_urls( |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 'The SW must intercept only the first request for image ' + | 277 'The SW must intercept only the first request for image ' + |
278 'resource which is redirected to CORS-supported other origin.'); | 278 'resource which is redirected to CORS-supported other origin.'); |
279 }) | 279 }) |
280 .then(function() { | 280 .then(function() { |
281 frame.remove(); | 281 frame.remove(); |
282 service_worker_unregister_and_done(t, SCOPE); | 282 service_worker_unregister_and_done(t, SCOPE); |
283 }) | 283 }) |
284 .catch(unreached_rejection(t)); | 284 .catch(unreached_rejection(t)); |
285 }, 'Verify the fallback behavior of FetchEvent'); | 285 }, 'Verify the fallback behavior of FetchEvent'); |
286 </script> | 286 </script> |
OLD | NEW |