tor-browser

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

test_databaseWorkStarted.js (1089B)


      1 /**
      2 * Any copyright is dedicated to the Public Domain.
      3 * http://creativecommons.org/publicdomain/zero/1.0/
      4 */
      5 
      6 const { PrincipalUtils } = ChromeUtils.importESModule(
      7  "resource://testing-common/dom/quota/test/modules/PrincipalUtils.sys.mjs"
      8 );
      9 const { IndexedDBUtils } = ChromeUtils.importESModule(
     10  "resource://testing-common/dom/indexedDB/test/modules/IndexedDBUtils.sys.mjs"
     11 );
     12 const { TestUtils } = ChromeUtils.importESModule(
     13  "resource://testing-common/TestUtils.sys.mjs"
     14 );
     15 
     16 /* exported testSteps */
     17 async function testSteps() {
     18  const principal = PrincipalUtils.createPrincipal("https://example.com");
     19  const name = "test_databaseWorkStarted.js";
     20 
     21  info("Starting database opening");
     22 
     23  const openPromise = (async function () {
     24    const request = indexedDB.openForPrincipal(principal, name);
     25    const promise = IndexedDBUtils.requestFinished(request);
     26    return promise;
     27  })();
     28 
     29  info("Waiting for database work to start");
     30 
     31  await TestUtils.topicObserved("IndexedDB::DatabaseWorkStarted");
     32 
     33  info("Waiting for database to finish opening");
     34 
     35  await openPromise;
     36 }