Open Bug 236742 Opened 20 years ago Updated 2 years ago

prefs set to default values in prefs.js get deleted (problem when sharing profile across platforms, versions, or debug/opt)

Categories

(Core :: Preferences: Backend, defect)

defect

Tracking

()

People

(Reporter: vdvo, Unassigned)

References

Details

(Whiteboard: [has workaround, see comment #3])

When sharing a profile across two different platforms, the user may want to set
some prefs so that the behaviour is identical on both platforms. For example,
layout.word_select.stop_at_punctuation defaults to true on Windows but false on
Linux - I want to set it to true everywhere. However, once I run Mozilla on
Windows with this setting, it deletes the line from the profile's prefs.js,
because the value matches the platform's default.

I propose that Mozilla should remember whether a pref has been set in the
profile and if it has, save it to the profile's prefs.js whether the value
matches the default or not.

I realize that I could work around the problem by setting the pref in user.js,
but this requires manual editing and it's non-obvious.

This blocks profile portability.
Note to self: bug 97397 seems related, because fixing that would imply that
Mozilla would have to remember where each pref value came from
(default/prefs.js/user.js/netscape.cfg or whatever), and that would facilitate
fixing this: nsPrefService would save a default pref to prefs.js if the
(default) value came from prefs.js.
Summary: prefs set to default values in prefs.js get deleted (problem when sharing profile cross-platform) → prefs set to default values in prefs.js get deleted (problem when sharing profile across platforms, versions, or debug/opt)
Workaround: when you want a pref to be set to some specific value regardless of whether that value is the default or not (or maybe the default is different on different platforms or versions sharing one profile), add a line for it in <profiledir>/user.js . The line can be copied from prefs.js (in the same directory), preferably when the app is not running. C++ or C-style comments can be added at will.

Example:
// disable call-home links
user_pref("browser.send_pings", false);

<profiledir> above should be replaced by the path to your profile directory, see http://kb.mozillazine.org/Profile_folder

user.js may or may not exist in your profile; create it if it doesn't.

Note: If you change your mind about such a pref, changing it back in about:config isn't enough, since user.js is acted upon at every startup. You'll have to change it (or remove it) there too.
Whiteboard: [has workaround, see comment #3]
(Filter "spam" on 'prefs-nobody-20080612'.)
Assignee: prefs → nobody
QA Contact: prefs
QA Contact: preferences → preferences-backend
Bug 1098343 has a partial solution, in which some prefs (the ones that differ between channels) are defined using "sticky_pref" instead of "user_pref".
Depends on: 1098343
(In reply to Jesse Ruderman from comment #6)
> Bug 1098343 has a partial solution

It actually sounds like an outright dupe?
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.