зеркало из https://github.com/mozilla/pjs.git
Bug 566128 (2/3) - Add mozActionUri to get the resolved action URI from scripts. r=sicking a2.0=blocking
This commit is contained in:
Родитель
4d7d7eaef4
Коммит
f94e769eac
|
@ -383,6 +383,17 @@ 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::GetMozActionUri(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::Submit()
|
||||
{
|
||||
|
@ -1331,11 +1342,7 @@ nsHTMLFormElement::GetActionURL(nsIURI** aActionURL)
|
|||
// Grab the URL string
|
||||
//
|
||||
nsAutoString action;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::action, action);
|
||||
// Avoid resolving action="" to the base uri, bug 297761.
|
||||
if (!action.IsEmpty()) {
|
||||
GetURIAttr(nsGkAtoms::action, nsnull, action);
|
||||
}
|
||||
GetMozActionUri(action);
|
||||
|
||||
//
|
||||
// Form the full action URL
|
||||
|
|
|
@ -33,17 +33,17 @@ document.getElementById("testFrame").onload = processTestResult;
|
|||
|
||||
// List of tests to run, each test consists of form action URL and expected result URL
|
||||
var tests = [
|
||||
[jarUrl, jarUrl + "?$PARAMS"],
|
||||
[jarUrl + "?jarTest1=jarTest2", jarUrl + "?$PARAMS"],
|
||||
[jarUrl + "?jarTest3=jarTest4#jarTest5", jarUrl + "?$PARAMS#jarTest5"],
|
||||
["data:text/html,<html></html>", "data:text/html,<html></html>?$PARAMS"],
|
||||
["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"],
|
||||
["", jarUrl + "?key=value0"],
|
||||
[" ", jarUrl + "?key=value0"],
|
||||
["../", previousDir + "?$PARAMS"],
|
||||
[jarUrl, jarUrl + "?$PARAMS", null],
|
||||
[jarUrl + "?jarTest1=jarTest2", jarUrl + "?$PARAMS", null],
|
||||
[jarUrl + "?jarTest3=jarTest4#jarTest5", jarUrl + "?$PARAMS#jarTest5", null],
|
||||
["data:text/html,<html></html>", "data:text/html,<html></html>?$PARAMS", null],
|
||||
["data:text/html,<html>How%20about%20this?</html>", "data:text/html,<html>How%20about%20this?$PARAMS", null],
|
||||
[httpUrl, httpUrl + "?$PARAMS", null],
|
||||
[httpUrl + "?httpTest1=httpTest2", httpUrl + "?$PARAMS", null ],
|
||||
[httpUrl + "?httpTest3=httpTest4#httpTest5", httpUrl + "?$PARAMS#httpTest5", null],
|
||||
["", jarUrl + "?key=value0", null],
|
||||
[" ", jarUrl + "?key=value0", document.location],
|
||||
["../", previousDir + "?$PARAMS", previousDir],
|
||||
];
|
||||
|
||||
var currentTest = -1;
|
||||
|
@ -61,6 +61,8 @@ function runNextTest() {
|
|||
form.setAttribute("action", tests[currentTest][0]);
|
||||
is(form.action, tests[currentTest][0],
|
||||
"action IDL attribute should reflect the action content attribute");
|
||||
is(form.mozActionUri, tests[currentTest][2] ? tests[currentTest][2] : tests[currentTest][0],
|
||||
"mozActionUri IDL attribute should resolve the action URI");
|
||||
form.key.value = "value" + currentTest;
|
||||
form.submit();
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
* http://www.w3.org/TR/DOM-Level-2-HTML/
|
||||
*/
|
||||
|
||||
[scriptable, uuid(a6cf908f-15b3-11d2-932e-00805f8add32)]
|
||||
[scriptable, uuid(083d2e20-a996-11df-94e2-0800200c9a66)]
|
||||
interface nsIDOMHTMLFormElement : nsIDOMHTMLElement
|
||||
{
|
||||
readonly attribute nsIDOMHTMLCollection elements;
|
||||
|
@ -60,4 +60,7 @@ interface nsIDOMHTMLFormElement : nsIDOMHTMLElement
|
|||
attribute DOMString target;
|
||||
void submit();
|
||||
void reset();
|
||||
|
||||
// This property returns the resolved action URI.
|
||||
readonly attribute DOMString mozActionUri;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче