We're calling on all EU-based Mozillians with iOS or iPadOS devices to help us monitor Apple’s new browser choice screens. Join the effort to hold Big Tech to account!

Pomoc pśepytaś

Glědajśo se wobšudy pomocy. Njenapominajomy was nigda, telefonowy numer zawołaś, SMS pósłaś abo wósobinske informacije pśeraźiś. Pšosym dajśo suspektnu aktiwitu z pomocu nastajenja „Znjewužywanje k wěsći daś“ k wěsći.

Dalšne informacije

How to lock preferences per-profile (not for all profiles)?

  • 4 wótegrona
  • 1 ma toś ten problem
  • 1 naglěd
  • Slědne wótegrono wót cloudchasingfun

more options

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?

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?

Wšykne wótegrona (4)

more options

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.

more options

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.

more options

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>);
}
more options

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.