Closed
Bug 516217
Opened 17 years ago
Closed 11 years ago
Anything can be entered in the "font-size" field, even non numeric
Categories
(Other Applications Graveyard :: ChatZilla, defect)
Other Applications Graveyard
ChatZilla
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: wormsxulla, Assigned: smartinez11, Mentored)
Details
(Whiteboard: [cz-0.9.92])
Attachments
(2 files, 5 obsolete files)
|
367.12 KB,
image/jpeg
|
Details | |
|
6.40 KB,
patch
|
Gijs
:
review+
|
Details | Diff | Splinter Review |
Careless users could decide to enter anything (alphanumeric, URL...) in the font-size (other...) field, and this confuses ChatZilla - but doesn't prevent it to work.
But the "checked" items in the Menu become a bit inconsistent, see screenshot attached
I meant "doesn't prevent it from working", of course.
Sugnim++
| Assignee | ||
Comment 2•11 years ago
|
||
Taking this bug on!
Updated•11 years ago
|
Assignee: rginda → smartinez11
| Assignee | ||
Comment 3•11 years ago
|
||
Group that worked on this: Sean Martinez, Justin Ross, Claire Buehler, JJ Garcia.
File change - chatzilla.properties
A change to the dialog box to explain that non-numeric inputs will result in a switch to default font-size.
File change - commands.js
Logic change so that non-numeric inputs will result in switch to default font-size.
Comment 4•11 years ago
|
||
Hi Sean,
Thanks for working on this! How did you generate the patch? Normally speaking, assuming you used the copy of chatzilla you got through "hg", you should be able to use either mercurial queues or use "hg diff" or "hg export" to get a readable version of the diff. The attachment ( https://bugzilla.mozilla.org/attachment.cgi?id=8561896 ) isn't readable, unfortunately... not sure what it is?
Flags: needinfo?(smartinez11)
Updated•11 years ago
|
Attachment #8561896 -
Attachment is patch: false
Attachment #8561896 -
Attachment mime type: text/plain → application/zip
| Assignee | ||
Comment 5•11 years ago
|
||
(In reply to :Gijs Kruitbosch from comment #4)
> Hi Sean,
>
> Thanks for working on this! How did you generate the patch? Normally
> speaking, assuming you used the copy of chatzilla you got through "hg", you
> should be able to use either mercurial queues or use "hg diff" or "hg
> export" to get a readable version of the diff. The attachment (
> https://bugzilla.mozilla.org/attachment.cgi?id=8561896 ) isn't readable,
> unfortunately... not sure what it is?
Hhmm, I might have misunderstood what I was supposed to attach. I zipped only the two files that we adjusted and sent that as the attachment along with the explanation. What is proper protocol? The attachment section only allowed one file to add.
Flags: needinfo?(smartinez11)
Comment 6•11 years ago
|
||
(In reply to Sean Martinez from comment #5)
> What is proper protocol? The attachment section only
> allowed one file to add.
Right. If you are at the root of the source tree in a terminal, and assuming you have modifications but did not commit them, you can do:
$ hg commit -m "Bug 516217 - fix numeric fields in the preferences to actually be numeric-only, r?gijs"
$ hg export -r-1
which will dump a "diff" ( http://en.wikipedia.org/wiki/Diff_utility ) to your terminal. You can pipe this to a file, using something like:
$ hg export -r-1 > 516217.patch
and attach the file here.
"hg commit" will create a changeset in your local copy of the source tree; if you want to change that commit to include more changes or change the commit message, you can use "hg commit --amend". -m indicates that the commit message for the changeset should be the string passed in quotes (you can also use -e instead of -m "..." to get your default editor).
"hg export" will export a changeset as a diff, and the -r switch indicates which changeset ("revision", hence -r) to export to a diff. "-1" is a hacky indication of "the topmost changeset", which saves you looking for the ID of that changeset. :-)
I hope that helps, if not, please feel free to needinfo me! :-)
Flags: needinfo?(smartinez11)
| Assignee | ||
Comment 7•11 years ago
|
||
Second attempt at sending patch, as response to Gijs' comment.
Flags: needinfo?(smartinez11)
Comment 8•11 years ago
|
||
Comment on attachment 8563003 [details] [diff] [review]
fix numeric fields in the preferences to actually be numeric-only
Review of attachment 8563003 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks! The patch file is definitely of the form I'd expect now - I'll look at the contents tomorrow. :-)
Attachment #8563003 -
Flags: review?(gijskruitbosch+bugs)
Comment 9•11 years ago
|
||
There are some valid non-numeric font sizes in CSS. Should this text box support them?
Comment 10•11 years ago
|
||
Comment on attachment 8563003 [details] [diff] [review]
fix numeric fields in the preferences to actually be numeric-only
Review of attachment 8563003 [details] [diff] [review]:
-----------------------------------------------------------------
This is a good start! I'd forgotten about this dialog thing in the email I sent to you about this bug... so the bits in here are important.
However... I still think we should update the preference panes as well (see chatzilla > Preferences > global settings > appearance tab):
http://hg.mozilla.org/chatzilla/file/2f6817b26141/xul/content/config.js#l569
and specifically, add a line like:
this.edit.setAttribute("type", "number");
which I *think* should mean that those pref inputs will only accept numbers as input (it'll still let you set non-integer things, like 14.5 or whatever, but I *think* most of the rest of the code will also cope with that, so that should be OK for now).
Does that work, and/or if not, can you let me know what breaks? Note in particular that this will update a lot of other number-pref inputs as well (e.g. the maximum number of messages per view, and so on). It's possible I've forgotten about some pref or other that somehow pretends to be a number and then stops working, but in principle I think it ought to work...
::: locales/en-US/chrome/chatzilla.properties
@@ +1302,4 @@
> msg.fonts.family.pick = Enter the font family you wish to use:
> msg.fonts.size.fmt = Font size is %Spt
> msg.fonts.size.default = Font size is default
> +msg.fonts.size.pick = Enter the font size you wish to use. Note: Non-numeric inputs will result in the default size.
Can you also update pref.font.size.help ? This is the tooltip that appears for the input in the preference panes.
::: xul/content/commands.js
@@ +3980,5 @@
>
> default:
> + if(isNaN(val)) {
> + val = 0;
> + }
Right, I'd not thought about this, so it's a good job you found it and fixed it. Minor style nits here:
- please don't use tabs. Use spaces instead.
- single-line if conditions don't need braces in the chatzilla style (and if code does need braces, the braces go on their own line).
- space after 'if' before the opening '(' of the condition, please.
- indent 4 spaces for bits inside if/else conditions
So, apart from the extra leading spacing to indent this the same way as the other case: blocks in the switch statement, this can be:
if (isNaN(val))
val = 0;
else
val = Number(val);
Attachment #8563003 -
Flags: review?(gijskruitbosch+bugs) → review+
Comment 11•11 years ago
|
||
Comment on attachment 8563003 [details] [diff] [review]
fix numeric fields in the preferences to actually be numeric-only
Whoops, I meant to set feedback+ here (which basically means: the approach is correct, but I'd like to look at the patch again before we land it)
Attachment #8563003 -
Flags: review+ → feedback+
Comment 12•11 years ago
|
||
(In reply to Gryllida from comment #9)
> There are some valid non-numeric font sizes in CSS. Should this text box
> support them?
No, the pref only deals with pt-based font sizes, and overhauling it completely isn't something we should be trying to do here, IMO.
Comment 13•11 years ago
|
||
In case it's not been linked recently, http://www.hacksrus.com/~ginda/pedant.html is the ChatZilla Coding Guidelines we're still trying to follow. :)
| Assignee | ||
Comment 14•11 years ago
|
||
Revised coding standards, adjusted mouse-over text to specify integer values for preference input and added number requirement to preference number dialog boxes as mentioned.
Updated•11 years ago
|
Attachment #8566214 -
Flags: review?(gijskruitbosch+bugs)
Comment 15•11 years ago
|
||
So I've pulled together your two patches and corrected some minor indenting and formatting things. However, a small test reveals that just using input type='number' breaks putting in '-1' in the fields (which works for some things). I didn't realize that using a numeric input actually uses a different XBL binding and so it does some weird stuff... Hmm. I think an adequate solution for now is to just add another line after the setAttribute one you added in config.js, and set the min attribute to -1. If you base it on this patch (and use spaces instead of tabs) then we should be good to go after that\!
Updated•11 years ago
|
Attachment #8563003 -
Attachment is obsolete: true
Updated•11 years ago
|
Attachment #8566214 -
Attachment is obsolete: true
Attachment #8566214 -
Flags: review?(gijskruitbosch+bugs)
Updated•11 years ago
|
Attachment #8566782 -
Flags: feedback+
| Assignee | ||
Comment 16•11 years ago
|
||
Patch adjusted spacing again and added minimum requirement of -1 to "number" text boxes in the preferences tabs.
Attachment #8561896 -
Attachment is obsolete: true
Updated•11 years ago
|
Attachment #8568144 -
Flags: review?(gijskruitbosch+bugs)
Comment 17•11 years ago
|
||
Sean or Claire, can you list the names of your group members who worked on this bug so that you can all get credit in the commit log? :-)
Flags: needinfo?(smartinez11)
Flags: needinfo?(Claire.buehler)
Comment 18•11 years ago
|
||
Updated•11 years ago
|
Attachment #8566782 -
Attachment is obsolete: true
Updated•11 years ago
|
Assignee: smartinez11 → gijskruitbosch+bugs
Status: NEW → ASSIGNED
Updated•11 years ago
|
Attachment #8569771 -
Flags: review+
Updated•11 years ago
|
Attachment #8568144 -
Attachment is obsolete: true
Attachment #8568144 -
Flags: review?(gijskruitbosch+bugs)
Comment 19•11 years ago
|
||
Ugh, bzexport, stealing bugs that I didn't mean to.
Assignee: gijskruitbosch+bugs → smartinez11
Mentor: gijskruitbosch+bugs
| Assignee | ||
Comment 20•11 years ago
|
||
(In reply to :Gijs Kruitbosch from comment #17)
> Sean or Claire, can you list the names of your group members who worked on
> this bug so that you can all get credit in the commit log? :-)
Absolutely! Our group is:
Sean Martinez
Claire Buehler
JJ Garcia
Justin Ross
Flags: needinfo?(smartinez11)
Comment 21•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Flags: needinfo?(Claire.buehler)
Resolution: --- → FIXED
Updated•9 years ago
|
Whiteboard: [cz-0.9.92]
Updated•1 year ago
|
Product: Other Applications → Other Applications Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•