your first code is correct, and should work. you should file a bug: http://bugzilla.mozilla.org/enter_bug.cgi?product=Browser&component=Preferences:%20Backend
Alec Maniac wrote: > Hello Gurus! > > I Have Some Misconception Concerning 'nsIPrefService' And > 'nsIPrefBranch'. When I Try To Work With Prefs In This Fashion (It's In > Pascal, But Idea Is, I Think, Clear): > > > PrefService.GetPrefBranch('intl.charset').SetCharPref('default','windows-1251'); > > PrefService.SavePrefFile; > > I Get My 'Prefs.JS' Looking Like This: > > user_pref("default", "windows-1251"); > > And The Preference Obviously Doesn't Work. Then I've Tried Make It Some > Other Way: > > > PrefService.GetPrefBranch('').SetCharPref('intl.charset.default','windows-1251'); > > PrefService.SavePrefFile; > > And It Was Saved And Worked Just Fine. Is This Second Way Correct Or I > Just Missed Something Using The First One (Which I Like Better)? >