Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
-
CI results over the last 21 days6,575Runs99.98%Pass0Failures1Timeouts0Crashes0Skips
Runs with issues per day (up to 0.1%) Oct 2Oct 22- Timeouts
- This test runs only with pattern: os != 'android'
- Manifest: browser/components/profiles/tests/unit/xpcshell.toml
/* Any copyright is dedicated to the Public Domain.
"use strict";
add_task(async function test_uninit_during_init() {
startProfileService();
let ProfilesDatastoreService = getProfilesDatastoreService();
await ProfilesDatastoreService.init();
let storeID = await ProfilesDatastoreService.storeID;
Assert.ok(storeID, "Should have a store ID");
await ProfilesDatastoreService.uninit();
// Stall the datastore's IOUtils.makeDirectory call so that uninit is called
// while init is still in progress.
let moduleGlobal = Cu.getGlobalForObject(ProfilesDatastoreService);
let realMakeDirectory = moduleGlobal.IOUtils.makeDirectory;
let sawMakeDirectory = false;
let { promise: gate, resolve: releaseGate } = Promise.withResolvers();
moduleGlobal.IOUtils.makeDirectory = async (...args) => {
sawMakeDirectory = true;
await gate;
return realMakeDirectory.apply(moduleGlobal.IOUtils, args);
};
let connectionPromise;
let uninitPromise;
try {
connectionPromise = ProfilesDatastoreService.getConnection();
Assert.ok(sawMakeDirectory, "Init should be waiting on makeDirectory");
uninitPromise = ProfilesDatastoreService.uninit();
} finally {
releaseGate();
moduleGlobal.IOUtils.makeDirectory = realMakeDirectory;
}
let connection = await connectionPromise;
await uninitPromise;
Assert.ok(
connection._connectionData._identifier.startsWith(`${storeID}.sqlite`),
"Should have opened the database for the real store ID"
);
Assert.ok(
!ProfilesDatastoreService.initialized,
"Service should not be initialized"
);
Assert.throws(
() => connection.execute("SELECT 1"),
/Connection is not open/,
"Connection should have been closed"
);
});