| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="/resources/testharness.js"></script> | 2 <script src="/resources/testharness.js"></script> |
| 3 <script src="/resources/testharnessreport.js"></script> | 3 <script src="/resources/testharnessreport.js"></script> |
| 4 <script src="/preload/resources/preload_helper.js"></script> |
| 4 <script src="../service-workers/service-worker/resources/test-helpers.sub.js"></
script> | 5 <script src="../service-workers/service-worker/resources/test-helpers.sub.js"></
script> |
| 5 <script> | 6 <script> |
| 6 async_test(function(t) { | 7 async_test(function(t) { |
| 7 var worker_url = 'resources/fetch-destination-worker.js'; | 8 var worker_url = 'resources/fetch-destination-worker.js'; |
| 8 var scope = 'resources/empty.html'; | 9 var scope = 'resources/empty.html'; |
| 9 var registration; | 10 var registration; |
| 11 verifyPreloadAndRTSupport(); |
| 10 | 12 |
| 11 service_worker_unregister_and_register(t, worker_url, scope) | 13 service_worker_unregister_and_register(t, worker_url, scope) |
| 12 .then(t.step_func(function(r) { | 14 .then(t.step_func(function(r) { |
| 13 registration = r; | 15 registration = r; |
| 14 return wait_for_state(t, r.installing, 'activated'); | 16 return wait_for_state(t, r.installing, 'activated'); |
| 15 })) | 17 })) |
| 16 .then(t.step_func(function() { | 18 .then(t.step_func(function() { |
| 17 return with_iframe(scope); | 19 return with_iframe(scope); |
| 18 })) | 20 })) |
| 19 .then(t.step_func(function(frame) { | 21 .then(t.step_func(function(frame) { |
| 20 var link = frame.contentWindow.document.createElement("link"); | 22 var link = frame.contentWindow.document.createElement("link"); |
| 21 link.as = "fetch"; | 23 link.as = "fetch"; |
| 22 link.href = "resources/dummy.xml"; | 24 link.href = "resources/dummy.xml"; |
| 23 link.rel = "preload"; | 25 link.rel = "preload"; |
| 24 link.addEventListener("load", t.step_func_done(function() { registrati
on.unregister(); })); | 26 link.addEventListener("load", t.step_func_done(function() { registrati
on.unregister(); })); |
| 25 link.addEventListener("error", t.step_func_done(function() { | 27 link.addEventListener("error", t.step_func_done(function() { |
| 26 registration.unregister(); | 28 registration.unregister(); |
| 27 assert_unreached("Fetch destination preload errored"); | 29 assert_unreached("Fetch destination preload errored"); |
| 28 })); | 30 })); |
| 29 frame.contentWindow.document.body.appendChild(link); | 31 frame.contentWindow.document.body.appendChild(link); |
| 30 })) | 32 })) |
| 31 .catch(unreached_rejection(t)); | 33 .catch(unreached_rejection(t)); |
| 32 }, 'Fetch destination preload'); | 34 }, 'Fetch destination preload'); |
| 33 </script> | 35 </script> |
| OLD | NEW |