当サイトはユーザー体験を改善するためのメンテナンスを実施中に機能が制限される予定です。記事を読んでもあなたの問題が解決せず質問をしたい場合は、Twitter の @FirefoxSupport、Reddit の /r/firefox で、サポートコミュニティが皆さんを助けようと待機しています。

Mozilla サポートの検索

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

詳しく学ぶ

このスレッドはアーカイブに保管されました。 必要であれば新たに質問してください。

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

  • 4 件の返信
  • 1 人がこの問題に困っています
  • 1 回表示
  • 最後の返信者: 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?

すべての返信 (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.