Closed Bug 555711 Opened 15 years ago Closed 15 years ago

nsAttrValue::ParseNonNegativeIntValue should return PR_FALSE when the value is not valid

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: mounir, Assigned: mounir)

Details

Attachments

(1 file, 2 obsolete files)

Attached patch Patch v0.1 (obsolete) — Splinter Review
At the moment, if the value could not be parsed, it returns PR_FALSE but if the value is not valid (< 0), it is returning PR_TRUE. This can lead to issues like we got in bug 551846 (see comments 27 and 29). NS_IMPL_NON_NEGATIVE_INT_ATTR_DEFAULT_VALUE should manage the default value alone we do not need to manage that in the parsing function. "content/html/content/test/test_bug536891.html" is the test to check regressions.
Attachment #435613 - Flags: review?(Olli.Pettay)
Comment on attachment 435613 [details] [diff] [review] Patch v0.1 Could you update test_bug536891.html to test also that getAttribute does the right thing. Something like : >+ var nonNumericValue = 'non-numerical-value'; >+ element.setAttribute('maxLength', nonNumericValue); >- element.setAttribute('maxLength', 'non-numerical-value'); > is(element.maxLength, -1, "non-numerical value should be considered invalid and represented as -1"); >+ is(element.getAttribute('maxlength'), nonNumericValue, "getAttribute should "); If you add that to the test, r=me.
Attachment #435613 - Flags: review?(Olli.Pettay) → review+
Attached patch Patch v0.1.1 (obsolete) — Splinter Review
r=smaug Boris, may you sr this small patch ?
Attachment #435613 - Attachment is obsolete: true
Attachment #435957 - Flags: superreview?(bzbarsky)
Olli, can we consider your previous review as an sr or I need to wait from a sr even for a so small patch ? It looks like everyone is busy with reviews....
Comment on attachment 435957 [details] [diff] [review] Patch v0.1.1 I don't think this small patches (which aren't really API changes) need sr.
Attachment #435957 - Flags: superreview?(bzbarsky) → superreview+
Keywords: checkin-needed
Comment on attachment 435957 [details] [diff] [review] Patch v0.1.1 fwiw, the test changes don't make sense. The getAttribute test should be for -2147483648, not for "non-numerical-value". The code change looks fine to me, though.
Attached patch Patcd v0.1.2Splinter Review
r=smaug I think no additional tests was actually needed. The change has been made for negative value and the tests are already checking getAttribute for '-15'. No need to use PR_INT32_MIN. Still waiting for checkin.
Attachment #435957 - Attachment is obsolete: true
Could someone checkin this patch before it bitrots ?
Status hasn't been updated.
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: