Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- Manifest: dom/cache/test/xpcshell/xpcshell.toml
/**
 * Any copyright is dedicated to the Public Domain.
 */
const { PrincipalUtils } = ChromeUtils.importESModule(
);
const { TestUtils } = ChromeUtils.importESModule(
);
add_task(async function testSteps() {
  const name = "test_databaseWorkStarted.js";
  info("Starting database opening");
  const openPromise = new Promise(function (resolve, reject) {
    const sandbox = new Cu.Sandbox(principal, {
      wantGlobalProperties: ["caches"],
    });
    sandbox.resolve = resolve;
    sandbox.reject = reject;
    Cu.evalInSandbox(`caches.open("${name}").then(resolve, reject);`, sandbox);
  });
  info("Waiting for database work to start");
  await TestUtils.topicObserved("CacheAPI::DatabaseWorkStarted");
  info("Waiting for database to finish opening");
  await openPromise;
});