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