From 5741f6929ddf7f1969fb2c48f86d5e6a07ff840b Mon Sep 17 00:00:00 2001 From: "timeless@mozdev.org" Date: Mon, 29 Mar 2010 01:59:00 -0700 Subject: [PATCH] Bug 555657 - GetSubmissionFromForm caches the wrong doc, r=sicking --- content/html/content/src/nsFormSubmission.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/content/html/content/src/nsFormSubmission.cpp b/content/html/content/src/nsFormSubmission.cpp index d305bb9f9070..f6f79e066366 100644 --- a/content/html/content/src/nsFormSubmission.cpp +++ b/content/html/content/src/nsFormSubmission.cpp @@ -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);