OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <title>Service Worker: Controller on load</title> | |
3 <script src="../resources/testharness.js"></script> | |
4 <script src="../resources/testharnessreport.js"></script> | |
5 <script src="resources/test-helpers.js"></script> | |
6 <body> | |
7 <script> | |
8 var t = async_test('controller is set for a controlled document'); | |
9 t.step(function() { | |
10 var url = 'resources/empty-worker.js'; | |
11 var scope = 'resources/blank.html'; | |
12 service_worker_unregister_and_register(t, url, scope) | |
13 .then(t.step_func(function(registration) { | |
14 return wait_for_state(t, registration.installing, 'activated'); | |
15 })) | |
16 .then(t.step_func(function() { | |
17 return with_iframe(scope); | |
18 })) | |
19 .then(t.step_func(function(frame) { | |
20 var w = frame.contentWindow; | |
21 var controller = w.navigator.serviceWorker.controller; | |
22 assert_true(controller instanceof w.ServiceWorker, | |
23 'controller should be a ServiceWorker object'); | |
24 assert_equals(controller.scriptURL, normalizeURL(url)); | |
25 service_worker_unregister_and_done(t, scope); | |
26 })) | |
27 .catch(unreached_rejection(t)); | |
28 }); | |
29 </script> | |
30 </body> | |
OLD | NEW |