Bug 566128 (1/3) - HTMLFormElement action IDL attribute should reflect the action content attribute. r=sicking a2.0=blocking

This commit is contained in:
Mounir Lamouri 2010-08-19 23:55:00 +02:00
parent 0145c9b59e
commit d01191d056
3 changed files with 15 additions and 22 deletions

View File

@ -375,6 +375,7 @@ nsHTMLFormElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
}
NS_IMPL_STRING_ATTR(nsHTMLFormElement, AcceptCharset, acceptcharset)
NS_IMPL_STRING_ATTR(nsHTMLFormElement, Action, action)
NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLFormElement, Enctype, enctype,
kFormDefaultEnctype->tag)
NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLFormElement, Method, method,
@ -382,23 +383,6 @@ NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLFormElement, Method, method,
NS_IMPL_STRING_ATTR(nsHTMLFormElement, Name, name)
NS_IMPL_STRING_ATTR(nsHTMLFormElement, Target, target)
NS_IMETHODIMP
nsHTMLFormElement::GetAction(nsAString& aValue)
{
GetAttr(kNameSpaceID_None, nsGkAtoms::action, aValue);
if (aValue.IsEmpty()) {
// Avoid resolving action="" to the base uri, bug 297761.
return NS_OK;
}
return GetURIAttr(nsGkAtoms::action, nsnull, aValue);
}
NS_IMETHODIMP
nsHTMLFormElement::SetAction(const nsAString& aValue)
{
return SetAttr(kNameSpaceID_None, nsGkAtoms::action, aValue, PR_TRUE);
}
NS_IMETHODIMP
nsHTMLFormElement::Submit()
{
@ -1347,7 +1331,11 @@ nsHTMLFormElement::GetActionURL(nsIURI** aActionURL)
// Grab the URL string
//
nsAutoString action;
GetAction(action);
GetAttr(kNameSpaceID_None, nsGkAtoms::action, action);
// Avoid resolving action="" to the base uri, bug 297761.
if (!action.IsEmpty()) {
GetURIAttr(nsGkAtoms::action, nsnull, action);
}
//
// Form the full action URL

View File

@ -25,6 +25,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=392567
var dataUrl = "http://mochi.test:8888/tests/content/html/content/test/bug392567.jar";
var jarUrl = "jar:" + dataUrl + "!/index.html";
var httpUrl = location.href.replace(/\.html.*/, "_404");
var previousDir = location.href.replace(/test\/[^\/]*$/, "");
var form = document.forms.testForm;
var frame = frames.testFrame;
@ -39,7 +40,10 @@ var tests = [
["data:text/html,<html>How%20about%20this?</html>", "data:text/html,<html>How%20about%20this?$PARAMS"],
[httpUrl, httpUrl + "?$PARAMS"],
[httpUrl + "?httpTest1=httpTest2", httpUrl + "?$PARAMS"],
[httpUrl + "?httpTest3=httpTest4#httpTest5", httpUrl + "?$PARAMS#httpTest5"]
[httpUrl + "?httpTest3=httpTest4#httpTest5", httpUrl + "?$PARAMS#httpTest5"],
["", jarUrl + "?key=value0"],
[" ", jarUrl + "?key=value0"],
["../", previousDir + "?$PARAMS"],
];
var currentTest = -1;
@ -54,7 +58,9 @@ function runNextTest() {
return;
}
form.action = tests[currentTest][0];
form.setAttribute("action", tests[currentTest][0]);
is(form.action, tests[currentTest][0],
"action IDL attribute should reflect the action content attribute");
form.key.value = "value" + currentTest;
form.submit();
}

View File

@ -99,8 +99,7 @@ testNode = nodeList.item(0);
// its not clear that this test is valid
// mozilla returns a fully expanded uri
//assertEquals("formLink","...",vfaction);
todo_is(vfaction, "...", "formLink");
is(vfaction, "...", "formLink");
}