tor-browser

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

cookieStoreManager_getSubscriptions_empty.https.any.js (1188B)


      1 // META: title=Cookie Store API: ServiceWorker without cookie change subscriptions
      2 // META: global=window,serviceworker
      3 // META: script=/service-workers/service-worker/resources/test-helpers.sub.js
      4 
      5 'use strict';
      6 
      7 promise_test(async testCase => {
      8  if (self.GLOBAL.isWindow()) {
      9    const registration = await service_worker_unregister_and_register(
     10        testCase, 'resources/empty_sw.js', 'resources/does/not/exist');
     11    testCase.add_cleanup(() => registration.unregister());
     12 
     13    // Wait for this service worker to become active before snapshotting the
     14    // subscription state, for consistency with other tests.
     15    await wait_for_state(testCase, registration.installing, 'activated');
     16 
     17    self.registration = registration;
     18  } else {
     19    // Wait for this service worker to become active before snapshotting the
     20    // subscription state, for consistency with other tests.
     21    await new Promise(resolve => {
     22      self.addEventListener('activate', event => { resolve(); });
     23    });
     24  }
     25 
     26  const subscriptions = await registration.cookies.getSubscriptions();
     27  assert_equals(subscriptions.length, 0);
     28 }, 'getSubscriptions returns an empty array when there are no subscriptions');