We change $HOME on Linux for various reasons, but this prevents the import procedure from working, plus maybe other disadvantages.
While exploring this might require more time (we have mullvad-browser#170 for it), we can probably adjust the paths Firefox uses for importing the data to use a (different) environment variable.
The migration wizard is implemented on its own in browser/components/migration/content/migration-dialog-window.html and browser/components/migration/content/migration-wizard.mjs.
browser/components/migration/content/migration-wizard-constants.mjs has some interesting constants we could use to find where the checkbox to import stuff are created.
In particular, the resources Firefox can look for are:
history
form data
passwords
bookmarks
payment methods
I think at the moment we want only bookmarks.
The actual migration happens elsewhere, and the communication is done through custom events.
In particular, we're looking for "MigrationWizard:BeginMigration".
Migrators are implemented in a very OOP-fashion.
For example, one file is browser/components/migration/ChromeProfileMigrator.sys.mjs.
Notice the browser/components/migration directory.
I think we're interested especially in the Chromium-based browser and maybe on Firefox.
Maybe at the end of the day writing a new simplified module for handling Firefox would work better, especially since we're interested only in bookmarks at the moment.