nsPostData postData(!isURLEncoded, data.ToNewCString()); handler->OnLinkClick(aFrame, absURLSpec, target, &postData);
if (isPost) { nsPostData postData(!isURLEncoded, data.ToNewCString()); handler->OnLinkClick(aFrame, absURLSpec, target, &postData); } else { handler->OnLinkClick(aFrame, absURLSpec, target, nsnull); }
void nsForm::OnSubmit(nsIPresContext* aPresContext, nsIFrame* aFrame,                       nsIFormControl* aSubmitter){  nsString data; // this could be more efficient, by allocating a larger buffer  nsAutoString method, enctype;  GetAttribute("method", method);  GetAttribute("enctype", enctype);  PRBool isURLEncoded = (enctype.EqualsIgnoreCase(*gMULTIPART)) ? PR_FALSE : PR_TRUE;  // for enctype=multipart/form-data, force it to be post  PRBool isPost = (method.EqualsIgnoreCase(*gGET) && isURLEncoded) ? PR_FALSE : PR_TRUE;  if (isURLEncoded) {    ProcessAsURLEncoded(isPost, aSubmitter, data);  }  else {    ProcessAsMultipart(aSubmitter, data);  }  // make the url string  nsILinkHandler* handler;  if (NS_OK == aPresContext->GetLinkHandler(&handler)) {    // Resolve url to an absolute url    nsIURL* docURL = nsnull;    nsIContent* content;    aFrame->GetContent(content);    if (nsnull != content) {      nsIDocument* doc = content->GetDocument();      docURL = doc->GetDocumentURL();      NS_RELEASE(doc);      NS_RELEASE(content);    }    nsAutoString target;    GetAttribute("target", target);    nsAutoString href;    GetAttribute("action", href);    if (!isPost) {      href.Append(data);    }    nsAutoString absURLSpec;    nsAutoString base;    nsresult rv = NS_MakeAbsoluteURL(docURL, base, href, absURLSpec);    NS_IF_RELEASE(docURL);    // Now pass on absolute url to the click handler    nsPostData postData(!isURLEncoded, data.ToNewCString());     handler->OnLinkClick(aFrame, absURLSpec, target, &postData);DebugPrint("url", absURLSpec);DebugPrint("data", data);  }}