[Project_owners] shared profiles

Patrick Brunschwig patrick.brunschwig at gmx.net
Fri Jul 30 23:32:15 EDT 2004

Brian King wrote:
> On 30.7.2004 14:55, Patrick Brunschwig wrote:
>> All settings in user.js are just the delta to the default prefs. As long
>> as the default is not overwritten, they are always automatically taken
>> from ...\defaults\pref. Using the clearUserPref function, you can reset
>> a user defined setting to te default. I.e. you don't need to do anything
>> specifically to use settings from the defaults.
>> Of course, a user cannot modify any settings in the defaults, but you
>> can copy any file with any settings into the folder and it will be
>> respected. This is e.g. what the shellblock XPI does to block shell://
>> links.
> Ok, I understand that you can place a file, say 'myapp.js' in
> defaults/pref/ and they will be picked up.
> But how do you write to that file exclusively when calling setPref,
> instead of the profile 'prefs.js'? The only related API call I see is
> nsIPref:savePrefFile(in nsIFile aFile), but this appears to write *all*
> current preferences. I just want to do it on a one by one basis for
> certain prefs.

You can't do that directly. But I think it would not be very difficult
to create your own function which can write a file into that folder.
It's not much more than this:
  for (...) {
    write('pref("'+thePref+'", '+ theValue + ');');


More information about the Project_owners mailing list