XForms bug 280966 - Submit Get is terminated with extra separator. r=aaronr/smaug a=mkaply

This commit is contained in:
doronr%us.ibm.com 2005-07-13 17:07:42 +00:00
parent f333249bd5
commit 22a7c18a87
2 changed files with 17 additions and 2 deletions

View File

@ -1232,8 +1232,17 @@ nsXFormsSubmissionElement::SerializeDataURLEncoded(nsIDOMNode *data,
}
else
{
// XXX validate input? take only the first character?
CopyUTF16toUTF8(temp, separator);
// Separator per spec can only be |;| or |&|
if (!temp.EqualsLiteral(";") && !temp.EqualsLiteral("&")) {
// invalid separator, report the error and abort submission.
// XXX: we probably should add a visual indicator
const PRUnichar *strings[] = { temp.get() };
nsXFormsUtils::ReportError(NS_LITERAL_STRING("invalidSeparator"),
strings, 1, mElement, mElement);
return NS_ERROR_ILLEGAL_VALUE;
} else {
CopyUTF16toUTF8(temp, separator);
}
}
}
@ -1265,6 +1274,11 @@ nsXFormsSubmissionElement::SerializeDataURLEncoded(nsIDOMNode *data,
return NS_ERROR_UNEXPECTED;
}
// For HTML 4 compatibility sake, trailing separator is to be removed per an
// upcoming erratum.
if (StringEndsWith(uri, separator))
uri.Cut(uri.Length() - 1, 1);
return NS_OK;
}

View File

@ -55,6 +55,7 @@ controlBindError = XForms Error (16): Could not bind control to instance dat
labelLinkLoadOrigin = XForms Error (17): Security check failed! Trying to load label data from a different domain than document
labelLink1Error = XForms Error (18): External file (%S) for Label element not found
labelLink2Error = XForms Error (19): Failed to load Label element from external file: %S
invalidSeparator = XForms Error (20): Submission separator may only be either "&" or ";", but found "%S".
# XForms Permission Messages:
xformsXDPermissionDialogTitle = Allowed Sites - XForms Cross Domain Access