Support container.getRegistration() / getRegistrations() inside service workers
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / service-workers / service-worker / skip-waiting-without-using-registration.https.html
1 <!DOCTYPE html>
2 <title>Service Worker: Skip waiting without using registration</title>
3 <script src="/resources/testharness.js"></script>
4 <script src="/resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.sub.js"></script>
6 <script>
7 'use strict';
8
9 promise_test(function(t) {
10     var scope = 'resources/blank.html?skip-waiting-without-using-registration';
11     var url = 'resources/skip-waiting-worker.js';
12     var frame_sw, sw_registration;
13
14     return service_worker_unregister(t, scope)
15       .then(function() {
16           return with_iframe(scope);
17         })
18       .then(function(f) {
19           t.add_cleanup(function() {
20               f.remove();
21             });
22           frame_sw = f.contentWindow.navigator.serviceWorker;
23           assert_equals(frame_sw.controller, null,
24                         'Document controller should be null');
25           return navigator.serviceWorker.register(url, {scope: scope});
26         })
27       .then(function(registration) {
28           sw_registration = registration;
29           return wait_for_state(t, registration.installing, 'activated');
30         })
31       .then(function() {
32           assert_equals(frame_sw.controller, null,
33                         'Document controller should still be null');
34           assert_not_equals(sw_registration.active, null,
35                             'Registration active worker should not be null');
36           fetch_tests_from_worker(sw_registration.active);
37         });
38   }, 'Test skipWaiting while a client is not being controlled');
39
40 </script>