In the past it was possible to set up Firefox and Thunderbird with prefs in users.js but it appears that prefs for addons are no longer saved in prefs.js. Where are they saved and is it possible to programmatically alter them?
As a WebExtension (which is what the extension system on Firefox is called internally) you manage your own settings, or really, arbitrary data with a storage API. You can either use a web storage API or https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/storage/. You can store anything that the respective storage solution can serialize in them. And extensions can alter their own storage, of course.
For influencable settings, extensions can use “managed” storage: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/storage/managed
Thanks for that @freaktechnik. Looks really good!
I tried it and the error console said, Error: Managed storage manifest not found.
I created the key with AutoIT using RegWrite and the key HKLM64. Is this enough to put it in the right place? I created the key with normal regwrite and key HKLM and that made no difference. Could it be a problem having both keys present? I thought Firefox just wouldn’t see the wrong one?
I put the path, ie C:\Users… Favourite\ where the file is - then I tried adding the full path… Nothing worked.
Thanks for your time.
Further to the previous entry…
I discovered that the path has to be the whole path.
I discovered that AutoIT has to run as a 64 bit version and then the key works… I guess this is obvious to all of you… it wasn’t to me. I’m still testing what happens if I run a 32 bit Firefox on a 64 bit machine…
It’s a bit unclear how your 2 last comments are related to your original post and the response made by Martin.
Saving/reading preferences from an add-on is not supposed to deal with Windows registry or require any tool like AutoIT unless you are in a very specific context that you did not describe here.
storage.managed requires a manifest similar to native messaging and its location is provided via registry on windows.
Oh, got it now thanks
So now the testing is finished and it seems the key has to be in the 64 bit place even when the FF is 32 bit. This may seem obvious but I recently discovered that localisation is governed by the language of TB not by the language of the machine.
Also I discovered that AutoIT HKLM64 does work but I just needed to reload the addon to have that recognised… It’s good to remember that reloading and even restarting is sometimes needed when testing addons…
it sounds fast as though as if it would be worthwhile to write a blog on this topic and leave a link here