How to lock preferences per-profile (not for all profiles)?
Hello. I managed to lock some preferences as I needed (plugin states as "ask-to-activate", as seen here: https://support.mozilla.org/en-US/questions/1031649), but I decided to create a new profile for my online banking only. I would like to set these same plugins to "always activate" in it, but their states are locked all over the application (even new profiles). How can I lock preferences individually a single profile only?
Semua Balasan (4)
I assume that you would be able to do this by using JavaScript in the mozilla.cfg file to only lock the prefs in specific profiles.
cor-el, thank you for the links, but I didn't find any ready or simple solution and all those javascript instructions aren't that clear for me.
What I thought could be made was putting the mozilla.cfg somewhere inside the profile folder instead of the main Firefox folder (and maybe set that info or path somewhere), so that it gets loaded only when that profile is loaded. Do you think this might be done easily? If not, no problem, really, and thank you anyway.
Note that you may not have to lock the prefs, but that you can set a new default value to use when you haven't changed a pref from the default.
These functions can be used in the mozilla.cfg file:
defaultPref(); // set new default value pref(); // set pref, allow changes in current session lockPref(); // lock pref, disallow changes
You could probably use code like this to check the location of the current profile and only run the code to lock prefs with a specific profile (adjust the RegExp to match the profile name):
profD = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties).get("ProfD", Ci.nsIFile).path; if (/xxxxxxxx[.]default$/.test(profD)){ lockPref("<pref name>", <value>); }
Setting the desired value as the default does not help me, as there are external sources of change, so I have to lock them (I tried).
I'll try the code you sent and will post the results here as soon as I can. Thank you.