tor-browser

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

installing.https.html (1949B)


      1 <!DOCTYPE html>
      2 <title>ServiceWorker: navigator.serviceWorker.installing</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 
      9 const SCRIPT = 'resources/empty-worker.js';
     10 const SCOPE = 'resources/blank.html';
     11 
     12 // "installing" is set
     13 promise_test(async t => {
     14 
     15  t.add_cleanup(async() => {
     16    if (frame)
     17      frame.remove();
     18    if (registration)
     19      await registration.unregister();
     20  });
     21 
     22  await service_worker_unregister(t, SCOPE);
     23  const frame = await with_iframe(SCOPE);
     24  const registration =
     25      await navigator.serviceWorker.register(SCRIPT, {scope: SCOPE});
     26  const container = frame.contentWindow.navigator.serviceWorker;
     27  assert_equals(container.controller, null, 'controller');
     28  assert_equals(registration.active, null, 'registration.active');
     29  assert_equals(registration.waiting, null, 'registration.waiting');
     30  assert_equals(registration.installing.scriptURL, normalizeURL(SCRIPT),
     31                'registration.installing.scriptURL');
     32  // FIXME: Add a test for a frame created after installation.
     33  // Should the existing frame ("frame") block activation?
     34 }, 'installing is set');
     35 
     36 // Tests that The ServiceWorker objects returned from installing attribute getter
     37 // that represent the same service worker are the same objects.
     38 promise_test(async t => {
     39  const registration1 =
     40      await service_worker_unregister_and_register(t, SCRIPT, SCOPE);
     41  const registration2 = await navigator.serviceWorker.getRegistration(SCOPE);
     42  assert_equals(registration1.installing, registration2.installing,
     43                'ServiceWorkerRegistration.installing should return the ' +
     44                'same object');
     45  await registration1.unregister();
     46 }, 'The ServiceWorker objects returned from installing attribute getter that ' +
     47   'represent the same service worker are the same objects');
     48 </script>