mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 555711 - nsAttrValue::ParseNonNegativeIntValue should return PR_FALSE when the value is not valid, r=smaug
This commit is contained in:
parent
bfe7cc152d
commit
2a7d18aaa1
@ -1069,13 +1069,11 @@ nsAttrValue::ParseNonNegativeIntValue(const nsAString& aString)
|
||||
PRInt32 ec;
|
||||
PRBool strict;
|
||||
PRInt32 originalVal = StringToInteger(aString, &strict, &ec);
|
||||
if (NS_FAILED(ec)) {
|
||||
if (NS_FAILED(ec) || originalVal < 0) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRInt32 val = PR_MAX(originalVal, -1);
|
||||
strict = strict && (originalVal == val);
|
||||
SetIntValueAndType(val, eInteger, strict ? nsnull : &aString);
|
||||
SetIntValueAndType(originalVal, eInteger, nsnull);
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -244,10 +244,9 @@ public:
|
||||
* Parse a string value into a non-negative integer.
|
||||
* This method follows the rules for parsing non-negative integer from:
|
||||
* http://dev.w3.org/html5/spec/infrastructure.html#rules-for-parsing-non-negative-integers
|
||||
* If the parsed value is negative, the value will be set to -1.
|
||||
*
|
||||
* @param aString the string to parse
|
||||
* @return whether the value could be parsed
|
||||
* @param aString the string to parse
|
||||
* @return whether the value is valid
|
||||
*/
|
||||
PRBool ParseNonNegativeIntValue(const nsAString& aString);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user