mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 630889 - textarea.rows and textarea.cols should be unsigned long and limited to only non-negative numbers greater than zero. r=smaug
This commit is contained in:
parent
4f8c7dcfa9
commit
9c1ffb2319
@ -456,13 +456,13 @@ nsHTMLTextAreaElement::IsHTMLFocusable(PRBool aWithMouse,
|
||||
|
||||
NS_IMPL_STRING_ATTR(nsHTMLTextAreaElement, AccessKey, accesskey)
|
||||
NS_IMPL_BOOL_ATTR(nsHTMLTextAreaElement, Autofocus, autofocus)
|
||||
NS_IMPL_INT_ATTR_DEFAULT_VALUE(nsHTMLTextAreaElement, Cols, cols, 20)
|
||||
NS_IMPL_UINT_ATTR_NON_ZERO_DEFAULT_VALUE(nsHTMLTextAreaElement, Cols, cols, DEFAULT_COLS)
|
||||
NS_IMPL_BOOL_ATTR(nsHTMLTextAreaElement, Disabled, disabled)
|
||||
NS_IMPL_NON_NEGATIVE_INT_ATTR(nsHTMLTextAreaElement, MaxLength, maxlength)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLTextAreaElement, Name, name)
|
||||
NS_IMPL_BOOL_ATTR(nsHTMLTextAreaElement, ReadOnly, readonly)
|
||||
NS_IMPL_BOOL_ATTR(nsHTMLTextAreaElement, Required, required)
|
||||
NS_IMPL_INT_ATTR_DEFAULT_VALUE(nsHTMLTextAreaElement, Rows, rows, 2)
|
||||
NS_IMPL_UINT_ATTR_NON_ZERO_DEFAULT_VALUE(nsHTMLTextAreaElement, Rows, rows, DEFAULT_ROWS_TEXTAREA)
|
||||
NS_IMPL_INT_ATTR(nsHTMLTextAreaElement, TabIndex, tabindex)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLTextAreaElement, Wrap, wrap)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLTextAreaElement, Placeholder, placeholder)
|
||||
@ -641,12 +641,9 @@ nsHTMLTextAreaElement::ParseAttribute(PRInt32 aNamespaceID,
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aAttribute == nsGkAtoms::maxlength) {
|
||||
return aResult.ParseNonNegativeIntValue(aValue);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::cols) {
|
||||
return aResult.ParseIntWithBounds(aValue, 0);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::rows) {
|
||||
return aResult.ParseIntWithBounds(aValue, 0);
|
||||
} else if (aAttribute == nsGkAtoms::cols ||
|
||||
aAttribute == nsGkAtoms::rows) {
|
||||
return aResult.ParsePositiveIntValue(aValue);
|
||||
}
|
||||
}
|
||||
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
|
||||
|
@ -255,6 +255,7 @@ _TEST_FILES = \
|
||||
test_bug622558.html \
|
||||
test_bug622597.html \
|
||||
test_bug636336.html \
|
||||
test_bug630889.html \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
|
28
content/html/content/test/test_bug630889.html
Normal file
28
content/html/content/test/test_bug630889.html
Normal file
@ -0,0 +1,28 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=630889
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 630889</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="reflect.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=630889">Mozilla Bug 630889</a>
|
||||
<p id="display"></p>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 630889 **/
|
||||
|
||||
var textarea = document.createElement('textarea');
|
||||
reflectUnsignedInt(textarea, "rows", true, 2);
|
||||
reflectUnsignedInt(textarea, "cols", true, 20);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -50,18 +50,18 @@
|
||||
* http://www.whatwg.org/specs/web-apps/current-work/
|
||||
*/
|
||||
|
||||
[scriptable, uuid(a6cf9094-15b3-11d2-932e-00805f8add32)]
|
||||
[scriptable, uuid(7a403df9-8911-499b-afbf-98a1bbc20dd1)]
|
||||
interface nsIDOMHTMLTextAreaElement : nsIDOMHTMLElement
|
||||
{
|
||||
// Modified in DOM Level 2:
|
||||
attribute DOMString defaultValue;
|
||||
readonly attribute nsIDOMHTMLFormElement form;
|
||||
attribute DOMString accessKey;
|
||||
attribute long cols;
|
||||
attribute unsigned long cols;
|
||||
attribute boolean disabled;
|
||||
attribute DOMString name;
|
||||
attribute boolean readOnly;
|
||||
attribute long rows;
|
||||
attribute unsigned long rows;
|
||||
attribute long tabIndex;
|
||||
readonly attribute DOMString type;
|
||||
attribute DOMString value;
|
||||
|
Loading…
Reference in New Issue
Block a user