Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- Manifest: dom/localstorage/test/unit/xpcshell.toml
/**
* Any copyright is dedicated to the Public Domain.
*/
const { PrincipalUtils } = ChromeUtils.importESModule(
);
const { QuotaUtils } = ChromeUtils.importESModule(
);
const { TestUtils } = ChromeUtils.importESModule(
);
add_task(
{
pref_set: [
["dom.storage.requestFinalization.pauseOnDOMFileThreadMs", 2000],
],
},
async function testSteps() {
info("Testing shutdown requested after starting request finalization");
// We need some existing data on disk, otherwise the preloading won't create
// a datastore in memory that holds a directory lock.
info("Clearing");
{
const request = Services.qms.clear();
await QuotaUtils.requestFinished(request);
}
info("Installing package");
installPackage("somedata_profile");
info("Preloading");
await Services.domStorageManager.preload(principal);
info("Starting database opening");
const openPromise = Services.domStorageManager.preload(principal);
info("Waiting for request finalization to start");
await TestUtils.topicObserved("LocalStorage::RequestFinalizationStarted");
info("Starting shutdown");
Services.startup.advanceShutdownPhase(
Services.startup.SHUTDOWN_PHASE_APPSHUTDOWNQM
);
info("Waiting for database to finish opening");
try {
await openPromise;
ok(false, "Should have thrown");
} catch (e) {
ok(true, "Should have thrown");
Assert.strictEqual(
e.result,
Cr.NS_ERROR_ABORT,
"Threw right result code"
);
}
}
);