Bug 839171 - Update formMethod reflection to have the empty string as default value (and 'get' as invalid value). r=mounir

This commit is contained in:
Sunny 2013-02-13 10:35:35 -05:00
parent 26622d32d8
commit 998681d532
4 changed files with 12 additions and 89 deletions

View File

@ -119,10 +119,10 @@ HTMLButtonElement::GetForm(nsIDOMHTMLFormElement** aForm)
NS_IMPL_BOOL_ATTR(HTMLButtonElement, Autofocus, autofocus)
NS_IMPL_BOOL_ATTR(HTMLButtonElement, Disabled, disabled)
NS_IMPL_ACTION_ATTR(HTMLButtonElement, FormAction, formaction)
NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(HTMLButtonElement, FormEnctype, formenctype,
kFormDefaultEnctype->tag)
NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(HTMLButtonElement, FormMethod, formmethod,
kFormDefaultMethod->tag)
NS_IMPL_ENUM_ATTR_DEFAULT_MISSING_INVALID_VALUES(HTMLButtonElement, FormEnctype, formenctype,
"", kFormDefaultEnctype->tag)
NS_IMPL_ENUM_ATTR_DEFAULT_MISSING_INVALID_VALUES(HTMLButtonElement, FormMethod, formmethod,
"", kFormDefaultMethod->tag)
NS_IMPL_BOOL_ATTR(HTMLButtonElement, FormNoValidate, formnovalidate)
NS_IMPL_STRING_ATTR(HTMLButtonElement, FormTarget, formtarget)
NS_IMPL_STRING_ATTR(HTMLButtonElement, Name, name)

View File

@ -159,7 +159,6 @@ MOCHITEST_FILES = \
test_bug567938-4.html \
test_bug569955.html \
test_bug573969.html \
test_bug585508.html \
test_bug561640.html \
test_bug566064.html \
test_bug582412-1.html \

View File

@ -40,12 +40,10 @@ reflectLimitedEnumerated({
"text/plain",
],
invalidValues: [ "text/html", "", "tulip" ],
// TODO (Bug 839171):
// defaultValue: {
// invalid: "application/x-www-form-urlencoded",
// missing: "",
// }
defaultValue: "application/x-www-form-urlencoded",
defaultValue: {
invalid: "application/x-www-form-urlencoded",
missing: "",
}
});
// .formMethod
@ -55,12 +53,10 @@ reflectLimitedEnumerated({
validValues: [ "get", "post" ],
invalidValues: [ "put", "", "tulip" ],
unsupportedValues: [ "dialog" ],
// TODO (Bug 839171):
// defaultValue: {
// invalid: "get",
// missing: "",
// }
defaultValue: "get",
defaultValue: {
invalid: "get",
missing: "",
}
});
// .formNoValidate

View File

@ -1,72 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=585508
-->
<head>
<title>Test for Bug 585508</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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=585508">Mozilla Bug 585508</a>
<p id="display"></p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 585508 **/
var enctypeTestData = [
// Default value.
[ "application/x-www-form-urlencoded" ],
// Valid values.
[ "application/x-www-form-urlencoded", "multipart/form-data", "text/plain" ],
// Invalid values.
[ "", " ", "foo", "multipart/foo" ]
];
var methodTestData = [
// Default value.
[ "get" ],
// Valid values.
[ "get", "post" ],
// Invalid values.
[ "", " ", "foo" ],
];
function checkAttribute(form, attrName, idlName, data)
{
is(form.getAttribute(attrName), null,
"By default " + attrName + " content attribute should be null");
is(form[idlName], data[0][0],
"By default " + idlName + " IDL attribute should be equal to " +
data[0][0]);
// Valid values.
for (i in data[1]) {
form.setAttribute(attrName, data[1][i]);
is(form.getAttribute(attrName), data[1][i],
"getAttribute should return the content attribute");
is(form[idlName], data[1][i], "When getting, " + idlName + " IDL attribute " +
"should be equal to the content attribute if the value is known");
}
// Invalid values.
for (i in data[2]) {
form.setAttribute(attrName, data[2][i]);
is(form.getAttribute(attrName), data[2][i],
"getAttribute should return the content attribute");
is(form[idlName], data[0][0], "When getting, " + idlName + " IDL attribute " +
"should return the default value if the content attribute value isn't known");
}
}
var button = document.createElement('button');
checkAttribute(button, 'formenctype', 'formEnctype', enctypeTestData);
checkAttribute(button, 'formmethod', 'formMethod', methodTestData);
</script>
</pre>
</body>
</html>