Bug 1925084 - Lazily init the selectable profiles DB and import the toolkit profile on first load of about:profilemanager. r=niklas

Differential Revision: https://phabricator.services.mozilla.com/D225906
This commit is contained in:
Jared Hirsch
2024-10-22 00:52:49 +00:00
parent 13ca483418
commit 3cb15e2564
2 changed files with 19 additions and 4 deletions

View File

@@ -588,10 +588,11 @@ class SelectableProfileServiceClass {
}
/**
* Create and launch a new SelectableProfile and add it to the group datastore.
* This is an unmanaged profile from the nsToolkitProfile perspective.
* If the user has never created a SelectableProfile before, the group
* datastore will be created and the currently running toolkit profile will
* be added to the datastore.
*/
async createNewProfile() {
async maybeSetupDataStore() {
// Create the profiles db and set the storeID on the toolkit profile if it
// doesn't exist so we can init the service.
await this.maybeCreateProfilesStorePath();
@@ -605,6 +606,20 @@ class SelectableProfileServiceClass {
let originalProfile = await this.#createProfile(path);
this.#currentProfile = originalProfile;
}
}
/**
* Create and launch a new SelectableProfile and add it to the group datastore.
* This is an unmanaged profile from the nsToolkitProfile perspective.
*
* If the user has never created a SelectableProfile before, the group
* datastore will be lazily created and the currently running toolkit profile
* will be added to the datastore along with the newly created profile.
*
* Launches the new SelectableProfile in a new instance after creating it.
*/
async createNewProfile() {
await this.maybeSetupDataStore();
let profile = await this.#createProfile();
this.launchInstance(profile);