Bug 555657 - GetSubmissionFromForm caches the wrong doc, r=sicking

This commit is contained in:
timeless@mozdev.org 2010-03-29 01:59:00 -07:00
parent 7a93ecfc41
commit 5741f6929d

View File

@ -803,8 +803,8 @@ GetSubmissionFromForm(nsGenericHTMLElement* aForm,
nsFormSubmission** aFormSubmission)
{
// Get all the information necessary to encode the form data
nsIDocument* doc = aForm->GetCurrentDoc();
NS_ASSERTION(doc, "Should have doc if we're building submission!");
NS_ASSERTION(aForm->GetCurrentDoc(),
"Should have doc if we're building submission!");
// Get encoding type (default: urlencoded)
PRInt32 enctype = NS_FORM_ENCTYPE_URLENCODED;
@ -826,16 +826,16 @@ GetSubmissionFromForm(nsGenericHTMLElement* aForm,
enctype == NS_FORM_ENCTYPE_TEXTPLAIN) {
*aFormSubmission = new nsFSTextPlain(charset);
} else {
nsIDocument* doc = aForm->GetOwnerDoc();
if (enctype == NS_FORM_ENCTYPE_MULTIPART ||
enctype == NS_FORM_ENCTYPE_TEXTPLAIN) {
nsAutoString enctypeStr;
aForm->GetAttr(kNameSpaceID_None, nsGkAtoms::enctype, enctypeStr);
const PRUnichar* enctypeStrPtr = enctypeStr.get();
SendJSWarning(aForm->GetOwnerDoc(), "ForgotPostWarning",
SendJSWarning(doc, "ForgotPostWarning",
&enctypeStrPtr, 1);
}
*aFormSubmission = new nsFSURLEncoded(charset, method,
aForm->GetOwnerDoc());
*aFormSubmission = new nsFSURLEncoded(charset, method, doc);
}
NS_ENSURE_TRUE(*aFormSubmission, NS_ERROR_OUT_OF_MEMORY);