OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset="utf-8"> |
| 3 <script src="../resources/testharness.js"></script> |
| 4 <script src="../resources/testharnessreport.js"></script> |
| 5 <script src="../resources/get-host-info.js?pipe=sub"></script> |
| 6 <script src="resources/test-helpers.js"></script> |
| 7 <title>Page Title</title> |
| 8 <body></body> |
| 9 <script> |
| 10 var host_info = get_host_info(); |
| 11 |
| 12 var saw_message = new Promise(resolve => { |
| 13 window.addEventListener('message', e => resolve(e.data)); |
| 14 }); |
| 15 |
| 16 // This test registers a service worker, then creates an in-scope |
| 17 // https iframe inside an insecure http iframe. The in-scope iframe |
| 18 // communicates whether it has a controller to the top-level frame. |
| 19 promise_test(t => { |
| 20 var script = 'resources/empty-worker.js'; |
| 21 var scope = 'resources/insecure-inscope'; |
| 22 return service_worker_unregister_and_register(t, script, scope) |
| 23 .then(reg => { |
| 24 add_completion_callback(() => reg.unregister()); |
| 25 return wait_for_state(t, reg.installing, 'activated'); |
| 26 }) |
| 27 .then(() => { |
| 28 var url = host_info.UNAUTHENTICATED_ORIGIN + |
| 29 '/serviceworker/resources/insecure-parent.html'; |
| 30 return with_iframe(url); |
| 31 }) |
| 32 .then(() => saw_message) |
| 33 .then(data => assert_equals(data, 'PASS')); |
| 34 }, 'Service worker does not control the subframe of an insecure frame'); |
| 35 </script> |
OLD | NEW |