Closed Bug 123027 Opened 23 years ago Closed 11 years ago

Verifier for prefs.js

Categories

(Core :: Preferences: Backend, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED INCOMPLETE
Future

People

(Reporter: d_king, Unassigned)

References

Details

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.7+) Gecko/20020123
BuildID:    2002012304

From experience I've seen in other bugs, it would be nice if Mozilla had a way
to automatically (or manually) verify the contents of prefs.js. This would
prevent a rogue setting causing Mozilla to crash or do strange things.

Note: I probably got the Component setting all wrong, but I wasn't sure what
something like this would come under.
This is kind of what I was trying to suggest in bug 111684. This bug has a
better suggestion though. 

The bug that prompted this had GetLocalizedUnicodePref being called on a
prefname whose value in prefs.js was "".  Should't prefs throw an error on stuff
like that?  (since a localized pref needs to have a uri to the properties file....)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Yes, if a Mozilla process reads something from prefs.js and gets something
unexpected/invalid, it should produce an error rather than continuing on.

This may be a better idea (although affecting more code) than writing some
seperate process to verify everything. For code to self-verify what it gets from
prefs.js is, IMHO, better programming practice.

I don't know enough about the Mozilla codebase or the various things that can be
in prefs.js to be able to suggest which method is easier. I do realise, however,
that both options (fixed existing code or a seperate verifier) are big tasks so
I wouldn't expect to see this for a while.
A localized unichar pref gets it *default* value from a properties file. A value
of "" in prefs.js is perfectly valid as it would be the user set value.
If "" is a valid setting, then there is a problem as a "" breaks Javascript
external files. It may be valid, but it sure doesn't work as intended.

However, that is seperate from this bug, and I would suggest mentioning that in
Bug #118404. This bug is all about any invalid values in prefs.js
"" is a valid value syntactically for a localized pref.  It is not a valid value
semantically for the charset pref, but there is no way of knowing that except by
knowing what the pref will be used for in Mozilla.

I think the suggestion is to have something that's almost a separate appliaction
that does semantic checking for all the prefs (and thus has knowledge of what
all the prefs are used for).  This checker would, for example, flag as invalid
values for prefs that are supposed to be filenames that point to nonexistent
files....
OS: Windows 98 → All
Hardware: PC → All
*** Bug 118495 has been marked as a duplicate of this bug. ***
Taking some of Brian's bugs.
Assignee: bnesse → ccarlen
Target Milestone: --- → Future
Hmmm, with "about:config" working, could that code be used to verify prefs.js?
*** Bug 195230 has been marked as a duplicate of this bug. ***
Assignee: ccarlen → nobody
QA Contact: bugzilla → prefs
QA Contact: preferences → preferences-backend
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.