[XForms] Need to truncate submission string buffer before reuse otherwise has issue on branches. Bug 376371, p=msterlin, r=doronr+aaronr

git-svn-id: svn://10.0.0.236/trunk@226575 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
aaronr%us.ibm.com 2007-05-17 16:12:30 +00:00
parent 11e738fb2f
commit b4b4952066

View File

@ -681,8 +681,7 @@ nsXFormsSubmissionElement::Submit()
NS_ENSURE_STATE(mFormat != 0);
nsCOMPtr<nsIInputStream> stream;
nsCAutoString contentType;
nsCAutoString uri;
nsCAutoString uri, contentType;
GetSubmissionURI(uri);
rv = SerializeData(submissionDoc, uri, getter_AddRefs(stream), contentType);
@ -772,6 +771,9 @@ nsXFormsSubmissionElement::GetSubmissionURI(nsACString& aURI)
NS_ENSURE_SUCCESS(rv, rv);
if (xpRes) {
// Truncate uri so GetStringValue replaces the contents with the
// xpath result rather than appending to it.
uri.Truncate();
rv = xpRes->GetStringValue(uri);
NS_ENSURE_SUCCESS(rv, rv);
}
@ -794,8 +796,8 @@ nsXFormsSubmissionElement::GetSubmissionURI(nsACString& aURI)
if (uri.IsEmpty())
nsXFormsUtils::ReportError(NS_LITERAL_STRING("warnSubmitURI"), mElement,
nsIScriptError::warningFlag);
else
CopyUTF16toUTF8(uri, aURI);
CopyUTF16toUTF8(uri, aURI);
return rv;
}