How can I keep AddOn preferences when switching from "Temporary AddOn" test version back to installed signed version?

For testing a new version of my AddOn, I need to use the same browser profile where I’m also using the latest signed “production” version.

Switching to the test version is easy … “Load Temporary AddOn” on the about:debugging page. After that, the AddOn preferences are still there. The problem is when I finished testing and want to switch back. By clicking “Remove” on the debugging page, it re-enables the production version but also deletes all preferences. Losing all preferences (my AddOn has lots of things to configure) is a major annoyance.

So how can I keep preferences when removing the “Temporary” version?

I think restarting Firefox will restore the original version without loosing data.

But, I think there is a corner case, if you release new version and you have temporary version running, the update will replace the temporary but it will also disappear after restarting Firefox.

Another more reliable and secure variant (especially when it comes to things like storage migrations in your extension and such) would be to use web-ext run with --firefox-profile (but not with --keep-profile-changes - see also https://extensionworkshop.com/documentation/develop/web-ext-command-reference/). This will create a copy of your profile for the one run, so you have all your data you’d have in your normal profile, but you are not modifying it. That way, even if the extension makes changes to things like its storage schema your profile will keep working with the release version.

1 Like

This worked (almost). The preferences were kept, but it was the new preferences. I changed some during testing, and after Firefox restart, the changes were still there.
But that’s OK. Now that I know it, I can be careful about it.

Thank you very much.

I’ll give it a try next time. For now, I’m totally happy with the solution of juraj.masiar

Thank you very much.