| 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/test-helpers.js?pipe=sub"></script> | 5 <script src="resources/test-helpers.js?pipe=sub"></script> |
| 6 <script> | 6 <script> |
| 7 var expected_urls = []; | 7 var expected_urls = []; |
| 8 | 8 |
| 9 function xhr_fail_test(frame, url) { | 9 function xhr_fail_test(frame, url) { |
| 10 expected_urls.push(url); | 10 expected_urls.push(url); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 var BASE_URL = host_info['HTTP_ORIGIN'] + | 39 var BASE_URL = host_info['HTTP_ORIGIN'] + |
| 40 '/serviceworker/resources/fetch-access-control.php?'; | 40 '/serviceworker/resources/fetch-access-control.php?'; |
| 41 var OTHER_BASE_URL = host_info['HTTP_REMOTE_ORIGIN'] + | 41 var OTHER_BASE_URL = host_info['HTTP_REMOTE_ORIGIN'] + |
| 42 '/serviceworker/resources/fetch-access-control.php?'; | 42 '/serviceworker/resources/fetch-access-control.php?'; |
| 43 var REDIRECT_URL = host_info['HTTP_ORIGIN'] + | 43 var REDIRECT_URL = host_info['HTTP_ORIGIN'] + |
| 44 '/serviceworker/resources/redirect.php?Redirect='; | 44 '/serviceworker/resources/redirect.php?Redirect='; |
| 45 var frame; | 45 var frame; |
| 46 var worker; | 46 var worker; |
| 47 service_worker_unregister_and_register(t, SCRIPT, SCOPE) | 47 service_worker_unregister_and_register(t, SCRIPT, SCOPE) |
| 48 .then(function(registration) { | 48 .then(function(registration) { |
| 49 return wait_for_update(t, registration); | 49 worker = registration.installing; |
| 50 }) | 50 return wait_for_state(t, worker, 'activated'); |
| 51 .then(function(sw) { | |
| 52 worker = sw; | |
| 53 return wait_for_state(t, sw, 'activated'); | |
| 54 }) | 51 }) |
| 55 .then(function() { return with_iframe(SCOPE); }) | 52 .then(function() { return with_iframe(SCOPE); }) |
| 56 .then(function(f) { | 53 .then(function(f) { |
| 57 frame = f; | 54 frame = f; |
| 58 return xhr_succeed_test(frame, BASE_URL); | 55 return xhr_succeed_test(frame, BASE_URL); |
| 59 }) | 56 }) |
| 60 .then(function(f) { | 57 .then(function(f) { |
| 61 return xhr_fail_test(frame, OTHER_BASE_URL); | 58 return xhr_fail_test(frame, OTHER_BASE_URL); |
| 62 }) | 59 }) |
| 63 .then(function(f) { | 60 .then(function(f) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 'to the ServiceWorker must be correct.'); | 102 'to the ServiceWorker must be correct.'); |
| 106 assert_equals(requests[i + 1].mode, 'cors', | 103 assert_equals(requests[i + 1].mode, 'cors', |
| 107 'The mode of the request which was passed from XHR ' + | 104 'The mode of the request which was passed from XHR ' + |
| 108 'to the ServiceWorker must be cors.'); | 105 'to the ServiceWorker must be cors.'); |
| 109 } | 106 } |
| 110 service_worker_unregister_and_done(t, SCOPE); | 107 service_worker_unregister_and_done(t, SCOPE); |
| 111 }) | 108 }) |
| 112 .catch(unreached_rejection(t)); | 109 .catch(unreached_rejection(t)); |
| 113 }, 'Verify the fallback behavior of FetchEvent'); | 110 }, 'Verify the fallback behavior of FetchEvent'); |
| 114 </script> | 111 </script> |
| OLD | NEW |