tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

controller-on-disconnect.https.html (1297B)


      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.sub.js"></script>
      6 <body>
      7 <script>
      8 promise_test(function(t) {
      9    var url = 'resources/empty-worker.js';
     10    var scope = 'resources/blank.html';
     11    var registration;
     12    var controller;
     13    var frame;
     14    return service_worker_unregister_and_register(t, url, scope)
     15      .then(function(swr) {
     16          t.add_cleanup(function() {
     17              return service_worker_unregister(t, scope);
     18            });
     19 
     20          registration = swr;
     21          return wait_for_state(t, registration.installing, 'activated');
     22        })
     23      .then(function() {
     24          return with_iframe(scope)
     25        })
     26      .then(function(f) {
     27          frame = f;
     28          var w = frame.contentWindow;
     29          var swc = w.navigator.serviceWorker;
     30          assert_true(swc.controller instanceof w.ServiceWorker,
     31                      'controller should be a ServiceWorker object');
     32 
     33          frame.remove();
     34 
     35          assert_equals(swc.controller, null,
     36                        'disconnected frame should not be controlled');
     37        });
     38 }, 'controller is cleared on disconnected window');
     39 </script>
     40 </body>