2 <title>Service Worker: Controller on reload
</title>
3 <script src=
"../resources/testharness.js"></script>
4 <script src=
"../resources/testharnessreport.js"></script>
5 <script src=
"resources/test-helpers.js"></script>
8 promise_test(function(t
) {
9 var scope
= 'resources/blank.html';
11 return service_worker_unregister(t
, scope
)
13 return with_iframe(scope
);
17 return frame
.contentWindow
.navigator
.serviceWorker
.register(
18 'resources/empty-worker.js', {scope
: scope
});
20 .then(function(registration
) {
21 return wait_for_state(t
, registration
.installing
, 'activated');
24 var w
= frame
.contentWindow
;
25 assert_equals(w
.navigator
.serviceWorker
.controller
, null,
26 'controller should be null until the document is ' +
28 return new Promise(function(resolve
) {
29 frame
.onload = function() { resolve(); }
34 var w
= frame
.contentWindow
;
36 w
.navigator
.serviceWorker
.controller
instanceof w
.ServiceWorker
,
37 'controller should be a ServiceWorker object upon reload');
39 service_worker_unregister_and_done(t
, scope
);
41 }, 'controller is set upon reload after registration');