Ci.nsISupports) { args = args.wrappedJSObject; } let observer = new ResizeObserver(() => { window.sizeToContent(); }); observer.observe(this._wiz); customElements.whenDefined("migration-wizard").then(() => { if (args.options?.skipSourceSelection) { // This is an automigration for a profile refresh, so begin migration // automatically once ready. this.doProfileRefresh( args.options.migratorKey, args.options.migrator, args.options.profileId ); } else { this._wiz.requestState(); } }); }, handleEvent(event) { switch (event.type) { case "load": { this.onLoad(); break; } case "keypress": { if (event.keyCode == KeyEvent.DOM_VK_ESCAPE) { window.close(); } break; } case "MigrationWizard:Close": { window.close(); break; } } }, async doProfileRefresh(migratorKey, migrator, profileId) { let profile = { id: profileId }; let resourceTypeData = await migrator.getMigrateData(profile); let resourceTypeStrs = []; for (let type in lazy.MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES) { if (resourceTypeData & lazy.MigrationUtils.resourceTypes[type]) { resourceTypeStrs.push( lazy.MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES[type] ); } } this._wiz.doAutoImport(migratorKey, profile, resourceTypeStrs); this._wiz.addEventListener( "MigrationWizard:DoneMigration", () => { setTimeout(() => { window.close(); }, 5000); }, { once: true } ); }, }; MigrationDialog.init(); PK