Closed
Bug 445049
Opened 16 years ago
Closed 16 years ago
Preference value types are not validated (or converted) before being set
Categories
(Toolkit :: Preferences, defect)
Toolkit
Preferences
Tracking
()
RESOLVED
FIXED
People
(Reporter: iannbugzilla, Assigned: neil)
References
()
Details
(Keywords: regression)
Attachments
(1 file)
767 bytes,
patch
|
Gavin
:
review+
|
Details | Diff | Splinter Review |
If you have a preference of type int, it allows you to set the value to the string for example if it is on a radiogroup, radio buttons only take string values so selecting a radio button will set the preference value to a string rather than int.
I can see this being a problem on radiogroups and menulists but not sure if on anything else.
This probably also affects preferences of different types (bool perhaps) and should look at converting the aValue to the correct type for those ones.
Assignee | ||
Comment 1•16 years ago
|
||
For int types, this is a regression from bug 301837.
bool types still work correctly.
Blocks: 301837
Keywords: regression
Assignee | ||
Comment 2•16 years ago
|
||
I had some other ideas for integer conversions:
parseInt(value, 10) | 0; - casts to PRInt32
value | 0; - casts to PRInt32 and accepts hex input
parseInt(value) | 0; - casts to PRInt32 and accepts hex or octal input
parseInt(value); - accepts hex or octal input
value - 0; - accepts hex input
Comment 3•16 years ago
|
||
>+ return parseInt(value, 10) || 0;
Non-integer input will return the integer it starts with (if any), e.g. parseInt("010busted", 10) will return 10 - is that wanted?
(Yes, I know it did before, too.)
Comment 4•16 years ago
|
||
Comment on attachment 329361 [details] [diff] [review]
Proposed patch (Checkin: Comment 5)
Thankfully the other bit touched by attachment 190281 [details] [diff] [review] has already been fixed.
Attachment #329361 -
Flags: review?(gavin.sharp) → review+
Comment on attachment 329361 [details] [diff] [review]
Proposed patch (Checkin: Comment 5)
http://hg.mozilla.org/mozilla-central/index.cgi/rev/ddd2899d1dbb
Attachment #329361 -
Attachment description: Proposed patch → Proposed patch (Checkin: Comment 5)
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•