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(
);
/**
* Stress test for concurrent storage opening and storage preloads with
* simulated artificial failures.
*
* high-load environment by initiating one storage opening in a child process
* and 10 parallel storage preloads. During these operations, artificial
* failures in `QuotaManager::OpenClientDirectory` are triggered with a 20%
* probability, testing the system's serialization of prepare datastore
* operations.
*/
add_task(async function testSteps() {
info("Clearing");
{
const request = Services.qms.clear();
await QuotaUtils.requestFinished(request);
}
info("Installing package");
installPackage("somedata_profile");
await QuotaUtils.withArtificialFailures(
Ci.nsIQuotaArtificialFailure.CATEGORY_OPEN_CLIENT_DIRECTORY,
/* probability */ 20,
Cr.NS_ERROR_FAILURE,
async function () {
const promises = [];
promises.push(run_test_in_child("open_and_multiple_preloads_child.js"));
await do_await_remote_message("LocalStorageTest::ChildReady");
for (let i = 0; i < 10; i++) {
promises.push(Services.domStorageManager.preload(principal));
}
try {
await Promise.allSettled(promises);
} catch (ex) {}
}
);
});