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:
@@ -588,10 +588,11 @@ class SelectableProfileServiceClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and launch a new SelectableProfile and add it to the group datastore.
|
* If the user has never created a SelectableProfile before, the group
|
||||||
* This is an unmanaged profile from the nsToolkitProfile perspective.
|
* 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
|
// Create the profiles db and set the storeID on the toolkit profile if it
|
||||||
// doesn't exist so we can init the service.
|
// doesn't exist so we can init the service.
|
||||||
await this.maybeCreateProfilesStorePath();
|
await this.maybeCreateProfilesStorePath();
|
||||||
@@ -605,6 +606,20 @@ class SelectableProfileServiceClass {
|
|||||||
let originalProfile = await this.#createProfile(path);
|
let originalProfile = await this.#createProfile(path);
|
||||||
this.#currentProfile = originalProfile;
|
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();
|
let profile = await this.#createProfile();
|
||||||
this.launchInstance(profile);
|
this.launchInstance(profile);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export class ProfileSelector extends MozLitElement {
|
|||||||
|
|
||||||
this.selectableProfileService = SelectableProfileService;
|
this.selectableProfileService = SelectableProfileService;
|
||||||
|
|
||||||
await this.selectableProfileService.init();
|
await this.selectableProfileService.maybeSetupDataStore();
|
||||||
this.profiles = await this.selectableProfileService.getAllProfiles();
|
this.profiles = await this.selectableProfileService.getAllProfiles();
|
||||||
|
|
||||||
if (!this.profiles.length) {
|
if (!this.profiles.length) {
|
||||||
|
|||||||
Reference in New Issue
Block a user