tor-browser

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

idlharness.https.any.js (1438B)


      1 // META: global=window,worker
      2 // META: timeout=long
      3 // META: script=/resources/WebIDLParser.js
      4 // META: script=/resources/idlharness.js
      5 // META: script=/service-workers/service-worker/resources/test-helpers.sub.js
      6 'use strict';
      7 
      8 // https://cookiestore.spec.whatwg.org/
      9 
     10 idl_test(
     11  ['cookiestore'],
     12  ['service-workers', 'html', 'dom'],
     13  async (idl_array, t) => {
     14    const isServiceWorker = 'ServiceWorkerGlobalScope' in self
     15      && self instanceof ServiceWorkerGlobalScope;
     16 
     17    if (isServiceWorker) {
     18      idl_array.add_objects({
     19        ExtendableCookieChangeEvent: [
     20            'new ExtendableCookieChangeEvent("cookiechange")'],
     21        ServiceWorkerGlobalScope: ['self'],
     22      });
     23    } else if (self.GLOBAL.isWindow()) {
     24      const registration = await service_worker_unregister_and_register(
     25          t, 'resources/empty_sw.js', 'resources/does/not/exist');
     26      t.add_cleanup(() => registration.unregister());
     27 
     28      // Global property referenced by idl_array.add_objects().
     29      self.registration = registration;
     30 
     31      idl_array.add_objects({
     32        CookieChangeEvent: ['new CookieChangeEvent("change")'],
     33        Window: ['self'],
     34      });
     35    }
     36 
     37    if (isServiceWorker || self.GLOBAL.isWindow()) {
     38      idl_array.add_objects({
     39        CookieStore: ['self.cookieStore'],
     40        CookieStoreManager: ['self.registration.cookies'],
     41        ServiceWorkerRegistration: ['self.registration'],
     42      });
     43    }
     44  }
     45 );