OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Service Worker: FetchEvent for HTMLImports</title> | 2 <title>Service Worker: FetchEvent for HTMLImports</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="/common/get-host-info.sub.js"></script> |
6 <script src="resources/test-helpers.js"></script> | 6 <script src="resources/test-helpers.sub.js"></script> |
7 <script> | 7 <script> |
8 async_test(function(t) { | 8 async_test(function(t) { |
9 var SCOPE = 'resources/fetch-request-html-imports-iframe.html'; | 9 var SCOPE = 'resources/fetch-request-html-imports-iframe.html'; |
10 var SCRIPT = 'resources/fetch-request-html-imports-worker.js'; | 10 var SCRIPT = 'resources/fetch-request-html-imports-worker.js'; |
11 var host_info = get_host_info(); | 11 var host_info = get_host_info(); |
12 service_worker_unregister_and_register(t, SCRIPT, SCOPE) | 12 service_worker_unregister_and_register(t, SCRIPT, SCOPE) |
13 .then(function(registration) { | 13 .then(function(registration) { |
14 return wait_for_state(t, registration.installing, 'activated'); | 14 return wait_for_state(t, registration.installing, 'activated'); |
15 }) | 15 }) |
16 .then(function() { return with_iframe(SCOPE); }) | 16 .then(function() { return with_iframe(SCOPE); }) |
17 .then(function(frame) { | 17 .then(function(frame) { |
| 18 t.add_cleanup(function() { |
| 19 frame.remove(); |
| 20 }); |
18 var same = frame.contentWindow.document.getElementById("same").import; | 21 var same = frame.contentWindow.document.getElementById("same").import; |
19 var same_same = same.getElementById("same-same").import; | 22 var same_same = same.getElementById("same-same").import; |
20 var same_other = same.getElementById("same-other").import; | 23 var same_other = same.getElementById("same-other").import; |
21 var other = | 24 var other = |
22 frame.contentWindow.document.getElementById("other").import; | 25 frame.contentWindow.document.getElementById("other").import; |
23 var other_same = other.getElementById("other-same").import; | 26 var other_same = other.getElementById("other-same").import; |
24 var other_other = other.getElementById("other-other").import; | 27 var other_other = other.getElementById("other-other").import; |
25 | 28 |
26 assert_equals( | 29 assert_equals( |
27 same.body.innerText, | 30 same.body.innerText, |
(...skipping 24 matching lines...) Expand all Loading... |
52 other_other.body.innerText, | 55 other_other.body.innerText, |
53 'mode=cors credentials=same-origin', | 56 'mode=cors credentials=same-origin', |
54 'The request mode and credentials for other origin HTMLImport ' + | 57 'The request mode and credentials for other origin HTMLImport ' + |
55 'from other origin HTMLImport must be set correctly.'); | 58 'from other origin HTMLImport must be set correctly.'); |
56 | 59 |
57 service_worker_unregister_and_done(t, SCOPE); | 60 service_worker_unregister_and_done(t, SCOPE); |
58 }) | 61 }) |
59 .catch(unreached_rejection(t)); | 62 .catch(unreached_rejection(t)); |
60 }, 'Verify the FetchEvent for HTMLImports'); | 63 }, 'Verify the FetchEvent for HTMLImports'); |
61 </script> | 64 </script> |
OLD | NEW |