Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
nsFSURLEncoded Class Reference
Inheritance diagram for nsFSURLEncoded:
Inheritance graph
[legend]
Collaboration diagram for nsFSURLEncoded:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsFSURLEncoded (const nsACString &aCharset, nsISaveAsCharset *aEncoder, nsIFormProcessor *aFormProcessor, PRInt32 aBidiOptions, PRInt32 aMethod)
virtual ~nsFSURLEncoded ()
virtual
NS_DECL_ISUPPORTS_INHERITED
nsresult 
AddNameValuePair (nsIDOMHTMLElement *aSource, const nsAString &aName, const nsAString &aValue)
 Submit a name/value pair.
virtual nsresult AddNameFilePair (nsIDOMHTMLElement *aSource, const nsAString &aName, const nsAString &aFilename, nsIInputStream *aStream, const nsACString &aContentType, PRBool aMoreFilesToCome)
 Submit a name/file pair.
virtual PRBool AcceptsFiles () const
 Find out whether or not this form submission accepts files.
NS_IMETHOD Init ()
 Called to initialize the submission.
virtual NS_DECL_ISUPPORTS nsresult SubmitTo (nsIURI *aActionURI, const nsAString &aTarget, nsIContent *aSource, nsPresContext *aPresContext, nsIDocShell **aDocShell, nsIRequest **aRequest)
 Call to perform the submission.

Static Public Member Functions

static void GetSubmitCharset (nsGenericHTMLElement *aForm, PRUint8 aCtrlsModAtSubmit, nsACString &aCharset)
 Get the submit charset for a form (suitable to pass in to the constructor).
static nsresult GetEncoder (nsGenericHTMLElement *aForm, nsPresContext *aPresContext, const nsACString &aCharset, nsISaveAsCharset **aEncoder)
 Get the encoder for a form (suitable to pass in to the constructor).
static void GetEnumAttr (nsGenericHTMLElement *aForm, nsIAtom *aAtom, PRInt32 *aValue)
 Get an attribute of a form as int, provided that it is an enumerated value.

Protected Member Functions

NS_IMETHOD GetEncodedSubmission (nsIURI *aURI, nsIInputStream **aPostDataStream)
 Given a URI and the current submission, create the final URI and data stream that will be submitted.
nsresult URLEncode (const nsAString &aStr, nsCString &aEncoded)
 URL encode a Unicode string by encoding it to bytes, converting linebreaks properly, and then escaping many bytes as xx.
nsresult ProcessValue (nsIDOMHTMLElement *aSource, const nsAString &aName, const nsAString &aValue, nsAString &aResult)
 Call to have the form processor listen in when a name/value pair is found to be submitted.
nsresult EncodeVal (const nsAString &aStr, nsACString &aResult)
 Encode a Unicode string to bytes using the encoder (or just copy the input if there is no encoder).
nsresult UnicodeToNewBytes (const nsAString &aStr, nsISaveAsCharset *aEncoder, nsACString &aOut)
 Encode a Unicode string to bytes using an encoder.

Protected Attributes

nsCString mCharset
 The name of the encoder charset.
nsCOMPtr< nsISaveAsCharsetmEncoder
 The encoder that will encode Unicode names and values into bytes to be sent over the wire (usually a charset transformation)
nsCOMPtr< nsIFormProcessormFormProcessor
 A form processor who can listen to values.
PRInt32 mBidiOptions
 The BIDI options flags for the current pres context.

Private Attributes

PRInt32 mMethod
 The method of the submit (either NS_FORM_METHOD_GET or NS_FORM_METHOD_POST).
nsCString mQueryString
 The query string so far (the part after the ?)
PRBool mWarnedFileControl
 Whether or not we have warned about a file control not being submitted.

Detailed Description

Definition at line 252 of file nsFormSubmission.cpp.


Constructor & Destructor Documentation

nsFSURLEncoded::nsFSURLEncoded ( const nsACString &  aCharset,
nsISaveAsCharset aEncoder,
nsIFormProcessor aFormProcessor,
PRInt32  aBidiOptions,
PRInt32  aMethod 
) [inline]
Parameters:
aCharsetthe charset of the form as a string
aEncoderan encoder that will encode Unicode names and values into bytes to be sent over the wire (usually a charset transformation)
aFormProcessora form processor who can listen to
aBidiOptionsthe BIDI options flags for the current pres context
aMethodthe method of the submit (either NS_FORM_METHOD_GET or NS_FORM_METHOD_POST).

Definition at line 264 of file nsFormSubmission.cpp.

    : nsFormSubmission(aCharset, aEncoder, aFormProcessor, aBidiOptions),
      mMethod(aMethod)
  {
  }
virtual nsFSURLEncoded::~nsFSURLEncoded ( ) [inline, virtual]

Definition at line 273 of file nsFormSubmission.cpp.

  {
  }

Member Function Documentation

virtual PRBool nsFSURLEncoded::AcceptsFiles ( ) const [inline, virtual]

Find out whether or not this form submission accepts files.

Parameters:
aAcceptsFilesthe boolean output

Implements nsIFormSubmission.

Definition at line 289 of file nsFormSubmission.cpp.

  {
    return PR_FALSE;
  }
nsresult nsFSURLEncoded::AddNameFilePair ( nsIDOMHTMLElement aSource,
const nsAString &  aName,
const nsAString &  aFilename,
nsIInputStream aStream,
const nsACString &  aContentType,
PRBool  aMoreFilesToCome 
) [virtual]

Submit a name/file pair.

Parameters:
aSourcethe control sending the parameter
aNamethe name of the parameter
aFilenamethe name of the file (pass null to provide no name)
aStreamthe stream containing the file data to be sent
aContentTypethe content-type of the file data being sent
aMoreFilesToCometrue if another name/file pair with the same name will be sent soon

Implements nsIFormSubmission.

Definition at line 387 of file nsFormSubmission.cpp.

{
  return AddNameValuePair(aSource, aName, aFilename);
}

Here is the call graph for this function:

nsresult nsFSURLEncoded::AddNameValuePair ( nsIDOMHTMLElement aSource,
const nsAString &  aName,
const nsAString &  aValue 
) [virtual]

Submit a name/value pair.

Parameters:
aSourcethe control sending the parameter
aNamethe name of the parameter
aValuethe value of the parameter

Implements nsIFormSubmission.

Definition at line 331 of file nsFormSubmission.cpp.

{
  //
  // Check if there is an input type=file so that we can warn
  //
  if (!mWarnedFileControl) {
    nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(aSource);
    if (formControl->GetType() == NS_FORM_INPUT_FILE) {
      nsCOMPtr<nsIContent> content = do_QueryInterface(aSource);
      SendJSWarning(content, "ForgotFileEnctypeWarning");
      mWarnedFileControl = PR_TRUE;
    }
  }

  //
  // Let external code process (and possibly change) value
  //
  nsAutoString processedValue;
  nsresult rv = ProcessValue(aSource, aName, aValue, processedValue);

  //
  // Encode value
  //
  nsCString convValue;
  if (NS_SUCCEEDED(rv)) {
    rv = URLEncode(processedValue, convValue);
  }
  else {
    rv = URLEncode(aValue, convValue);
  }
  NS_ENSURE_SUCCESS(rv, rv);

  //
  // Encode name
  //
  nsCAutoString convName;
  rv = URLEncode(aName, convName);
  NS_ENSURE_SUCCESS(rv, rv);


  //
  // Append data to string
  //
  if (mQueryString.IsEmpty()) {
    mQueryString += convName + NS_LITERAL_CSTRING("=") + convValue;
  } else {
    mQueryString += NS_LITERAL_CSTRING("&") + convName
                  + NS_LITERAL_CSTRING("=") + convValue;
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsFormSubmission::EncodeVal ( const nsAString &  aStr,
nsACString &  aResult 
) [protected, inherited]

Encode a Unicode string to bytes using the encoder (or just copy the input if there is no encoder).

Parameters:
aStrthe string to encode
aResultthe encoded string [OUT]
Exceptions:
anerror if UnicodeToNewBytes fails

Definition at line 1423 of file nsFormSubmission.cpp.

{
  NS_ASSERTION(mEncoder, "Encoder not available. Losing data !");
  if (mEncoder)
    return UnicodeToNewBytes(aStr, mEncoder, aOut);

  // fall back to UTF-8
  CopyUTF16toUTF8(aStr, aOut);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsFSURLEncoded::GetEncodedSubmission ( nsIURI aURI,
nsIInputStream **  aPostDataStream 
) [protected, virtual]

Given a URI and the current submission, create the final URI and data stream that will be submitted.

Subclasses must implement this.

Parameters:
aURIthe URI being submitted to [INOUT]
aPostDataStreama data stream for POST data [OUT]

Implements nsFormSubmission.

Definition at line 476 of file nsFormSubmission.cpp.

{
  nsresult rv = NS_OK;

  *aPostDataStream = nsnull;

  if (mMethod == NS_FORM_METHOD_POST) {

    PRBool isMailto = PR_FALSE;
    aURI->SchemeIs("mailto", &isMailto);
    if (isMailto) {

      nsCAutoString path;
      rv = aURI->GetPath(path);
      NS_ENSURE_SUCCESS(rv, rv);

      HandleMailtoSubject(path);

      // Append the body to and force-plain-text args to the mailto line
      nsCString escapedBody;
      escapedBody.Adopt(nsEscape(mQueryString.get(), url_XAlphas));

      path += NS_LITERAL_CSTRING("&force-plain-text=Y&body=") + escapedBody;

      rv = aURI->SetPath(path);

    } else {

      nsCOMPtr<nsIInputStream> dataStream;
      // XXX We *really* need to either get the string to disown its data (and
      // not destroy it), or make a string input stream that owns the CString
      // that is passed to it.  Right now this operation does a copy.
      rv = NS_NewCStringInputStream(getter_AddRefs(dataStream), mQueryString);
      NS_ENSURE_SUCCESS(rv, rv);

      nsCOMPtr<nsIMIMEInputStream> mimeStream(
        do_CreateInstance("@mozilla.org/network/mime-input-stream;1", &rv));
      NS_ENSURE_SUCCESS(rv, rv);

#ifdef SPECIFY_CHARSET_IN_CONTENT_TYPE
      mimeStream->AddHeader("Content-Type",
                            PromiseFlatString(
                              "application/x-www-form-urlencoded; charset="
                              + mCharset
                            ).get());
#else
      mimeStream->AddHeader("Content-Type",
                            "application/x-www-form-urlencoded");
#endif
      mimeStream->SetAddContentLength(PR_TRUE);
      mimeStream->SetData(dataStream);

      *aPostDataStream = mimeStream;
      NS_ADDREF(*aPostDataStream);
    }

  } else {
    //
    // Get the full query string
    //
    PRBool schemeIsJavaScript;
    rv = aURI->SchemeIs("javascript", &schemeIsJavaScript);
    NS_ENSURE_SUCCESS(rv, rv);
    if (schemeIsJavaScript) {
      return NS_OK;
    }

    nsCAutoString path;
    rv = aURI->GetPath(path);
    NS_ENSURE_SUCCESS(rv, rv);
    // Bug 42616: Trim off named anchor and save it to add later
    PRInt32 namedAnchorPos = path.FindChar('#');
    nsCAutoString namedAnchor;
    if (kNotFound != namedAnchorPos) {
      path.Right(namedAnchor, (path.Length() - namedAnchorPos));
      path.Truncate(namedAnchorPos);
    }

    // Chop off old query string (bug 25330, 57333)
    // Only do this for GET not POST (bug 41585)
    PRInt32 queryStart = path.FindChar('?');
    if (kNotFound != queryStart) {
      path.Truncate(queryStart);
    }

    path.Append('?');
    // Bug 42616: Add named anchor to end after query string
    path.Append(mQueryString + namedAnchor);

    aURI->SetPath(path);
  }

  return rv;
}

Here is the call graph for this function:

nsresult nsFormSubmission::GetEncoder ( nsGenericHTMLElement aForm,
nsPresContext aPresContext,
const nsACString &  aCharset,
nsISaveAsCharset **  aEncoder 
) [static, inherited]

Get the encoder for a form (suitable to pass in to the constructor).

Parameters:
aFormthe form in question
aPresContextthe pres context in which we are submitting
aCharsetthe charset of the form
aEncoderthe returned encoder [OUT]

Definition at line 1309 of file nsFormSubmission.cpp.

{
  *aEncoder = nsnull;
  nsresult rv = NS_OK;

  nsCAutoString charset(aCharset);
  // canonical name is passed so that we just have to check against
  // *our* canonical names listed in charsetaliases.properties
  if (charset.EqualsLiteral("ISO-8859-1")) {
    charset.AssignLiteral("windows-1252");
  }

  // use UTF-8 for UTF-16* and UTF-32* (per WHATWG and existing practice of
  // MS IE/Opera). 
  if (StringBeginsWith(charset, NS_LITERAL_CSTRING("UTF-16")) || 
      StringBeginsWith(charset, NS_LITERAL_CSTRING("UTF-32"))) {
    charset.AssignLiteral("UTF-8");
  }

  rv = CallCreateInstance( NS_SAVEASCHARSET_CONTRACTID, aEncoder);
  NS_ASSERTION(NS_SUCCEEDED(rv), "create nsISaveAsCharset failed");
  NS_ENSURE_SUCCESS(rv, rv);

  rv = (*aEncoder)->Init(charset.get(),
                         (nsISaveAsCharset::attr_EntityAfterCharsetConv + 
                          nsISaveAsCharset::attr_FallbackDecimalNCR),
                         0);
  NS_ASSERTION(NS_SUCCEEDED(rv), "initialize nsISaveAsCharset failed");
  NS_ENSURE_SUCCESS(rv, rv);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsFormSubmission::GetEnumAttr ( nsGenericHTMLElement aForm,
nsIAtom aAtom,
PRInt32 aValue 
) [static, inherited]

Get an attribute of a form as int, provided that it is an enumerated value.

Parameters:
aFormthe form in question
aAtomthe attribute (for example, nsHTMLAtoms::enctype) to get
aValuethe result (will not be set at all if the attribute does not exist on the form, so make sure you provide a default value.) [OUT]

Definition at line 1413 of file nsFormSubmission.cpp.

{
  const nsAttrValue* value = aContent->GetParsedAttr(atom);
  if (value && value->Type() == nsAttrValue::eEnum) {
    *aValue = value->GetEnumValue();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsFormSubmission::GetSubmitCharset ( nsGenericHTMLElement aForm,
PRUint8  aCtrlsModAtSubmit,
nsACString &  aCharset 
) [static, inherited]

Get the submit charset for a form (suitable to pass in to the constructor).

Parameters:
aFormthe form in question
aCtrlsModAtSubmitBIDI controls text mode. Unused in non-BIDI builds.
aCharsetthe returned charset [OUT]

Definition at line 1238 of file nsFormSubmission.cpp.

{
  oCharset.AssignLiteral("UTF-8"); // default to utf-8

  nsresult rv = NS_OK;
  nsAutoString acceptCharsetValue;
  aForm->GetAttr(kNameSpaceID_None, nsHTMLAtoms::acceptcharset,
                 acceptCharsetValue);

  PRInt32 charsetLen = acceptCharsetValue.Length();
  if (charsetLen > 0) {
    PRInt32 offset=0;
    PRInt32 spPos=0;
    // get charset from charsets one by one
    nsCOMPtr<nsICharsetAlias> calias(do_GetService(kCharsetAliasCID, &rv));
    if (NS_FAILED(rv)) {
      return;
    }
    if (calias) {
      do {
        spPos = acceptCharsetValue.FindChar(PRUnichar(' '), offset);
        PRInt32 cnt = ((-1==spPos)?(charsetLen-offset):(spPos-offset));
        if (cnt > 0) {
          nsAutoString uCharset;
          acceptCharsetValue.Mid(uCharset, offset, cnt);

          if (NS_SUCCEEDED(calias->
                           GetPreferred(NS_LossyConvertUTF16toASCII(uCharset),
                                        oCharset)))
            return;
        }
        offset = spPos + 1;
      } while (spPos != -1);
    }
  }
  // if there are no accept-charset or all the charset are not supported
  // Get the charset from document
  nsIDocument* doc = aForm->GetDocument();
  if (doc) {
    oCharset = doc->GetDocumentCharacterSet();
  }

  if (aCtrlsModAtSubmit==IBMBIDI_CONTROLSTEXTMODE_VISUAL
     && oCharset.Equals(NS_LITERAL_CSTRING("windows-1256"),
                        nsCaseInsensitiveCStringComparator())) {
//Mohamed
    oCharset.AssignLiteral("IBM864");
  }
  else if (aCtrlsModAtSubmit==IBMBIDI_CONTROLSTEXTMODE_LOGICAL
          && oCharset.Equals(NS_LITERAL_CSTRING("IBM864"),
                             nsCaseInsensitiveCStringComparator())) {
    oCharset.AssignLiteral("IBM864i");
  }
  else if (aCtrlsModAtSubmit==IBMBIDI_CONTROLSTEXTMODE_VISUAL
          && oCharset.Equals(NS_LITERAL_CSTRING("ISO-8859-6"),
                             nsCaseInsensitiveCStringComparator())) {
    oCharset.AssignLiteral("IBM864");
  }
  else if (aCtrlsModAtSubmit==IBMBIDI_CONTROLSTEXTMODE_VISUAL
          && oCharset.Equals(NS_LITERAL_CSTRING("UTF-8"),
                             nsCaseInsensitiveCStringComparator())) {
    oCharset.AssignLiteral("IBM864");
  }

}

Here is the call graph for this function:

Here is the caller graph for this function:

Called to initialize the submission.

Perform any initialization that may fail here. Subclasses must implement this.

Implements nsFormSubmission.

Definition at line 401 of file nsFormSubmission.cpp.

{
  mQueryString.Truncate();
  mWarnedFileControl = PR_FALSE;
  return NS_OK;
}
nsresult nsFormSubmission::ProcessValue ( nsIDOMHTMLElement aSource,
const nsAString &  aName,
const nsAString &  aValue,
nsAString &  aResult 
) [protected, inherited]

Call to have the form processor listen in when a name/value pair is found to be submitted.

Parameters:
aSourcethe HTML element the name/value is associated with
aNamethe name that will be submitted
aValuethe value that will be submitted
theprocessed value that will be sent to the server. [OUT]

Definition at line 1435 of file nsFormSubmission.cpp.

{
  // Hijack _charset_ (hidden inputs only) for internationalization (bug 18643)
  if (aName.EqualsLiteral("_charset_")) {
    nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(aSource);
    if (formControl && formControl->GetType() == NS_FORM_INPUT_HIDDEN) {
        CopyASCIItoUTF16(mCharset, aResult);
        return NS_OK;
    }
  }

  nsresult rv = NS_OK;
  aResult = aValue;
  if (mFormProcessor) {
    rv = mFormProcessor->ProcessValue(aSource, aName, aResult);
    NS_ASSERTION(NS_SUCCEEDED(rv), "Unable to Notify form process observer");
  }

  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsFormSubmission::SubmitTo ( nsIURI aActionURL,
const nsAString &  aTarget,
nsIContent aSource,
nsPresContext aPresContext,
nsIDocShell **  aDocShell,
nsIRequest **  aRequest 
) [virtual, inherited]

Call to perform the submission.

Parameters:
aActionURLthe URL to submit to (may be modified with GET contents)
aTargetthe target window
aSourcethe element responsible for the submission (for web shell)
aPresContextthe presentation context
aDocShell(out param) the DocShell in which the submission was loaded
aRequest(out param) the Request for the submission

Implements nsIFormSubmission.

Definition at line 1209 of file nsFormSubmission.cpp.

{
  nsresult rv;

  //
  // Finish encoding (get post data stream and URI)
  //
  nsCOMPtr<nsIInputStream> postDataStream;
  rv = GetEncodedSubmission(aActionURI, getter_AddRefs(postDataStream));
  NS_ENSURE_SUCCESS(rv, rv);

  //
  // Actually submit the data
  //
  nsILinkHandler *handler = aPresContext->GetLinkHandler();
  NS_ENSURE_TRUE(handler, NS_ERROR_FAILURE);

  return handler->OnLinkClickSync(aSource, eLinkVerb_Replace,
                                  aActionURI,
                                  PromiseFlatString(aTarget).get(),
                                  postDataStream, nsnull,
                                  aDocShell, aRequest);
}

Here is the call graph for this function:

nsresult nsFormSubmission::UnicodeToNewBytes ( const nsAString &  aStr,
nsISaveAsCharset aEncoder,
nsACString &  aOut 
) [protected, inherited]

Encode a Unicode string to bytes using an encoder.

(Used by EncodeVal)

Parameters:
aStrthe string to encode
aEncoderthe encoder to encode the bytes with (cannot be null)
aOutthe encoded string [OUT]
Exceptions:
anerror if the encoder fails

Definition at line 1347 of file nsFormSubmission.cpp.

{
  PRUint8 ctrlsModAtSubmit = GET_BIDI_OPTION_CONTROLSTEXTMODE(mBidiOptions);
  PRUint8 textDirAtSubmit = GET_BIDI_OPTION_DIRECTION(mBidiOptions);
  //ahmed 15-1
  nsAutoString newBuffer;
  //This condition handle the RTL,LTR for a logical file
  if (ctrlsModAtSubmit == IBMBIDI_CONTROLSTEXTMODE_VISUAL
     && mCharset.Equals(NS_LITERAL_CSTRING("windows-1256"),
                        nsCaseInsensitiveCStringComparator())) {
    Conv_06_FE_WithReverse(nsString(aStr),
                           newBuffer,
                           textDirAtSubmit);
  }
  else if (ctrlsModAtSubmit == IBMBIDI_CONTROLSTEXTMODE_LOGICAL
          && mCharset.Equals(NS_LITERAL_CSTRING("IBM864"),
                             nsCaseInsensitiveCStringComparator())) {
    //For 864 file, When it is logical, if LTR then only convert
    //If RTL will mak a reverse for the buffer
    Conv_FE_06(nsString(aStr), newBuffer);
    if (textDirAtSubmit == 2) { //RTL
    //Now we need to reverse the Buffer, it is by searching the buffer
      PRInt32 len = newBuffer.Length();
      PRUint32 z = 0;
      nsAutoString temp;
      temp.SetLength(len);
      while (--len >= 0)
        temp.SetCharAt(newBuffer.CharAt(len), z++);
      newBuffer = temp;
    }
  }
  else if (ctrlsModAtSubmit == IBMBIDI_CONTROLSTEXTMODE_VISUAL
          && mCharset.Equals(NS_LITERAL_CSTRING("IBM864"),
                             nsCaseInsensitiveCStringComparator())
                  && textDirAtSubmit == IBMBIDI_TEXTDIRECTION_RTL) {

    Conv_FE_06(nsString(aStr), newBuffer);
    //Now we need to reverse the Buffer, it is by searching the buffer
    PRInt32 len = newBuffer.Length();
    PRUint32 z = 0;
    nsAutoString temp;
    temp.SetLength(len);
    while (--len >= 0)
      temp.SetCharAt(newBuffer.CharAt(len), z++);
    newBuffer = temp;
  }
  else {
    newBuffer = aStr;
  }

  nsXPIDLCString res;
  if (!newBuffer.IsEmpty()) {
    aOut.Truncate();
    nsresult rv = aEncoder->Convert(newBuffer.get(), getter_Copies(res));
    NS_ENSURE_SUCCESS(rv, rv);
  }

  aOut = res;
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsFSURLEncoded::URLEncode ( const nsAString &  aStr,
nsCString aEncoded 
) [protected]

URL encode a Unicode string by encoding it to bytes, converting linebreaks properly, and then escaping many bytes as xx.

Parameters:
aStrthe string to encode
aEncodedthe encoded string [OUT]
Exceptions:
NS_ERROR_OUT_OF_MEMORYif we run out of memory

Definition at line 574 of file nsFormSubmission.cpp.

{
  // convert to CRLF breaks
  PRUnichar* convertedBuf =
    nsLinebreakConverter::ConvertUnicharLineBreaks(PromiseFlatString(aStr).get(),
                                                   nsLinebreakConverter::eLinebreakAny,
                                                   nsLinebreakConverter::eLinebreakNet);
  NS_ENSURE_TRUE(convertedBuf, NS_ERROR_OUT_OF_MEMORY);

  nsCAutoString encodedBuf;
  nsresult rv = EncodeVal(nsDependentString(convertedBuf), encodedBuf);
  nsMemory::Free(convertedBuf);
  NS_ENSURE_SUCCESS(rv, rv);

  char* escapedBuf = nsEscape(encodedBuf.get(), url_XPAlphas);
  NS_ENSURE_TRUE(escapedBuf, NS_ERROR_OUT_OF_MEMORY);
  aEncoded.Adopt(escapedBuf);

  return NS_OK;
}

Here is the call graph for this function:


Member Data Documentation

PRInt32 nsFormSubmission::mBidiOptions [protected, inherited]

The BIDI options flags for the current pres context.

Definition at line 176 of file nsFormSubmission.cpp.

nsCString nsFormSubmission::mCharset [protected, inherited]

The name of the encoder charset.

Definition at line 168 of file nsFormSubmission.cpp.

The encoder that will encode Unicode names and values into bytes to be sent over the wire (usually a charset transformation)

Definition at line 172 of file nsFormSubmission.cpp.

A form processor who can listen to values.

Definition at line 174 of file nsFormSubmission.cpp.

The method of the submit (either NS_FORM_METHOD_GET or NS_FORM_METHOD_POST).

Definition at line 317 of file nsFormSubmission.cpp.

The query string so far (the part after the ?)

Definition at line 320 of file nsFormSubmission.cpp.

Whether or not we have warned about a file control not being submitted.

Definition at line 323 of file nsFormSubmission.cpp.


The documentation for this class was generated from the following file: