Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
nsXFormsSubmissionElement Class Reference

Implementation of the XForms <submission> element. More...

#include <nsXFormsSubmissionElement.h>

Inheritance diagram for nsXFormsSubmissionElement:
Inheritance graph
[legend]
Collaboration diagram for nsXFormsSubmissionElement:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIREQUESTOBSERVER
NS_DECL_NSIXFORMSSUBMISSIONELEMENT
NS_DECL_NSICHANNELEVENTSINK
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSIHTTPHEADERVISITOR 
nsXFormsSubmissionElement ()
NS_IMETHOD OnDestroyed ()
NS_IMETHOD HandleDefault (nsIDOMEvent *aEvent, PRBool *aHandled)
NS_IMETHOD OnCreated (nsIXTFGenericElementWrapper *aWrapper)
 NS_HIDDEN_ (already_AddRefed< nsIModelElementPrivate >) GetModel()
 NS_HIDDEN_ (nsresult) LoadReplaceInstance(nsIChannel *)
 NS_HIDDEN_ (nsresult) LoadReplaceAll(nsIChannel *)
 NS_HIDDEN_ (nsresult) Submit()
 NS_HIDDEN_ (nsresult) GetSubmissionURI(nsACString &aURI)
 NS_HIDDEN_ (PRBool) GetBooleanAttr(const nsAString &attrName
 NS_HIDDEN_ (void) GetDefaultInstanceData(nsIDOMNode **result)
 NS_HIDDEN_ (nsresult) GetBoundInstanceData(nsIDOMNode **result)
 NS_HIDDEN_ (nsresult) GetSelectedInstanceElement(const nsAString &aInstance
 NS_HIDDEN_ (nsresult) SerializeData(nsIDOMDocument *data
 NS_HIDDEN_ (nsresult) SerializeDataXML(nsIDOMDocument *data
 NS_HIDDEN_ (nsresult) CreatePurgedDoc(nsIDOMNode *source
 NS_HIDDEN_ (nsresult) CopyChildren(nsIModelElementPrivate *model
 NS_HIDDEN_ (nsresult) SerializeDataURLEncoded(nsIDOMDocument *data
 NS_HIDDEN_ (void) AppendURLEncodedData(nsIDOMNode *data
 NS_HIDDEN_ (nsresult) SerializeDataMultipartRelated(nsIDOMDocument *data
 NS_HIDDEN_ (nsresult) SerializeDataMultipartFormData(nsIDOMDocument *data
 NS_HIDDEN_ (nsresult) AppendMultipartFormData(nsIDOMNode *data
const nsCString nsCString
nsIMultiplexInputStream
NS_HIDDEN_ (nsresult) AppendPostDataChunk(nsCString &postDataChunk
 NS_HIDDEN_ (nsresult) GetElementEncodingType(nsIDOMNode *data
 NS_HIDDEN_ (nsresult) CreateFileStream(const nsString &absURI
 NS_HIDDEN_ (nsresult) SendData(const nsCString &uri
virtual nsRepeatState GetRepeatState ()
 Get/Set the repeat state for the xforms control or action.
virtual void SetRepeatState (nsRepeatState aState)
void onCreated (in nsIXTFGenericElementWrapper wrapper)
void onDestroyed ()
void getScriptingInterfaces (out unsigned long count,[array, size_is(count), retval] out nsIIDPtr array)
void willChangeDocument (in nsIDOMDocument newDoc)
void documentChanged (in nsIDOMDocument newDoc)
void willChangeParent (in nsIDOMElement newParent)
void parentChanged (in nsIDOMElement newParent)
void willInsertChild (in nsIDOMNode child, in unsigned long index)
void childInserted (in nsIDOMNode child, in unsigned long index)
void willAppendChild (in nsIDOMNode child)
void childAppended (in nsIDOMNode child)
void willRemoveChild (in unsigned long index)
void childRemoved (in unsigned long index)
void willSetAttribute (in nsIAtom name, in AString newValue)
void attributeSet (in nsIAtom name, in AString newValue)
void willRemoveAttribute (in nsIAtom name)
void attributeRemoved (in nsIAtom name)
void beginAddingChildren ()
void doneAddingChildren ()
boolean handleDefault (in nsIDOMEvent aEvent)
void cloneState (in nsIDOMElement aElement)
void onStartRequest (in nsIRequest aRequest, in nsISupports aContext)
 Called to signify the beginning of an asynchronous request.
void onStopRequest (in nsIRequest aRequest, in nsISupports aContext, in nsresult aStatusCode)
 Called to signify the end of an asynchronous request.
void setActivator (in nsIXFormsSubmitElement aActivator)
void onChannelRedirect (in nsIChannel oldChannel, in nsIChannel newChannel, in unsigned long flags)
 Called when a redirect occurs.
void getInterface (in nsIIDRef uuid,[iid_is(uuid), retval] out nsQIResult result)
 Retrieves the specified interface pointer.
void visitHeader (in ACString aHeader, in ACString aValue)
 Called by the nsIHttpChannel implementation when visiting request and response headers.

Public Attributes

PRBool defaultVal = PR_FALSE)
nsIModelElementPrivateaModel
nsIModelElementPrivate
nsIInstanceElementPrivate ** 
result
nsCStringuri
nsCString nsIInputStream
nsCString
contentType
nsIInputStream nsCStringcontentType
nsIDOMDocument ** result
nsIDOMNodesource
nsIDOMNode nsIDOMNodedest
nsIDOMNode nsIDOMNode
nsIDOMDocument
destDoc
nsIDOMNode nsIDOMNode
nsIDOMDocument const nsString
cdataElements
nsIDOMNode nsIDOMNode
nsIDOMDocument const nsString
PRUint32 
depth
const nsCStringsep
const nsCString nsCStringbuf
const nsCStringboundary
const nsCString nsCString
nsIMultiplexInputStream
nsIMultiplexInputStream
multiStream
PRUint32encType
PRUint32 nsIModelElementPrivateaModel = nsnull)
nsIFile ** file
nsIFile nsIInputStream ** stream
nsIInputStreamstream
nsIInputStream const nsCStringcontentType
const unsigned long ELEMENT_TYPE_GENERIC_ELEMENT = 0
const unsigned long ELEMENT_TYPE_SVG_VISUAL = 1
const unsigned long ELEMENT_TYPE_XML_VISUAL = 2
const unsigned long ELEMENT_TYPE_XUL_VISUAL = 3
const unsigned long ELEMENT_TYPE_BINDABLE = 4
readonly attribute unsigned long elementType
readonly attribute boolean isAttributeHandler
const unsigned long NOTIFY_WILL_CHANGE_DOCUMENT = 0x00000001
const unsigned long NOTIFY_DOCUMENT_CHANGED = 0x00000002
const unsigned long NOTIFY_WILL_CHANGE_PARENT = 0x00000004
const unsigned long NOTIFY_PARENT_CHANGED = 0x00000008
const unsigned long NOTIFY_WILL_INSERT_CHILD = 0x00000010
const unsigned long NOTIFY_CHILD_INSERTED = 0x00000020
const unsigned long NOTIFY_WILL_APPEND_CHILD = 0x00000040
const unsigned long NOTIFY_CHILD_APPENDED = 0x00000080
const unsigned long NOTIFY_WILL_REMOVE_CHILD = 0x00000100
const unsigned long NOTIFY_CHILD_REMOVED = 0x00000200
const unsigned long NOTIFY_WILL_SET_ATTRIBUTE = 0x00000400
const unsigned long NOTIFY_ATTRIBUTE_SET = 0x00000800
const unsigned long NOTIFY_WILL_REMOVE_ATTRIBUTE = 0x00001000
const unsigned long NOTIFY_ATTRIBUTE_REMOVED = 0x00002000
const unsigned long NOTIFY_BEGIN_ADDING_CHILDREN = 0x00004000
const unsigned long NOTIFY_DONE_ADDING_CHILDREN = 0x00008000
const unsigned long NOTIFY_HANDLE_DEFAULT = 0x00010000
const unsigned long REDIRECT_TEMPORARY = 1 << 0
 This is a temporary redirect.
const unsigned long REDIRECT_PERMANENT = 1 << 1
 This is a permanent redirect.
const unsigned long REDIRECT_INTERNAL = 1 << 2
 This is an internal redirect, i.e.

Protected Member Functions

virtual nsRepeatState UpdateRepeatState (nsIDOMNode *aParent)
 This is processed when an XForms control or XForms action has been inserted under a parent node AND has been inserted into a document.

Protected Attributes

nsRepeatState mRepeatState
PRPackedBool mHasParent
 State that tells whether control has a parent or not.
PRPackedBool mHasDoc
 State that tells whether control has a document or not.

Private Member Functions

PRBool CheckSameOrigin (nsIDocument *aBaseDocument, nsIURI *aTestURI)
nsresult AddNameSpaces (nsIDOMElement *aTarget, nsIDOMNode *aSource, nsStringHashSet *aPrefixHash)
nsresult GetIncludeNSPrefixesAttr (nsStringHashSet **aHash)
void EndSubmit (PRBool aSucceeded)
 Send xforms-submit-done/-error, depending on |aSucceeded|.
nsresult CreateSubmissionDoc (nsIDOMNode *aRoot, nsIDOMDocument **aReturnDoc)
 Create submission document.
nsresult CreateAttachments (nsIModelElementPrivate *aModel, nsIDOMNode *aDoc, SubmissionAttachmentArray *aAttachments)
 Run through document and create attachment ids for xsd:anyURI nodes.
nsresult SetContextInfo ()
 Set context info.
nsresult SetHttpContextInfo (PRUint32 aResponse, const nsAString &aResponseText)
 Set Http context info.
nsresult ParseErrorResponse (nsIChannel *aChannel)
nsresult OverrideRequestHeaders (nsIHttpChannel *aHttpChannel)
nsresult ProcessHeaderElement (nsIDOMNode *aHeaderNode, nsIHttpChannel *aHttpChannel)

Private Attributes

nsIDOMElementmElement
PRPackedBool mSubmissionActive
PRPackedBool mIsReplaceInstance
PRPackedBool mIsSOAPRequest
PRUint32 mFormat
nsCOMPtr< nsIXFormsSubmitElementmActivator
nsCOMPtr< nsIInputStreammPipeIn
nsCOMArray< nsIXFormsContextInfomContextInfo
nsCOMPtr< nsIDOMDocumentmHttpHeaderDoc
nsCOMPtr< nsIDOMNodemSubmissionBody
nsString mSubmitError

Detailed Description

Implementation of the XForms <submission> element.

See also:
http://www.w3.org/TR/xforms/slice3.html#structure-model-submission

Definition at line 75 of file nsXFormsSubmissionElement.h.


Constructor & Destructor Documentation

NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIREQUESTOBSERVER NS_DECL_NSIXFORMSSUBMISSIONELEMENT NS_DECL_NSICHANNELEVENTSINK NS_DECL_NSIINTERFACEREQUESTOR NS_DECL_NSIHTTPHEADERVISITOR nsXFormsSubmissionElement::nsXFormsSubmissionElement ( ) [inline]

Member Function Documentation

nsresult nsXFormsSubmissionElement::AddNameSpaces ( nsIDOMElement aTarget,
nsIDOMNode aSource,
nsStringHashSet *  aPrefixHash 
) [private]

Definition at line 1369 of file nsXFormsSubmissionElement.cpp.

{
  nsCOMPtr<nsIDOMNamedNodeMap> attrMap;
  nsCOMPtr<nsIDOMNode> attrNode;
  nsAutoString nsURI, localName, value;

  aSource->GetAttributes(getter_AddRefs(attrMap));
  NS_ENSURE_STATE(attrMap);

  PRUint32 length;
  attrMap->GetLength(&length);

  for (PRUint32 run = 0; run < length; ++run) {
    attrMap->Item(run, getter_AddRefs(attrNode));
    attrNode->GetNamespaceURI(nsURI);

    if (nsURI.Equals(kXMLNSNameSpaceURI)) {
      attrNode->GetLocalName(localName);
      attrNode->GetNodeValue(value);

      if (!localName.EqualsLiteral("xmlns")) {
        if (!aPrefixHash || aPrefixHash->Contains(localName)) {
          nsAutoString attrName(NS_LITERAL_STRING("xmlns:"));
          attrName.Append(localName);
          aTarget->SetAttributeNS(kXMLNSNameSpaceURI, attrName, value);
        }
      } else if (!aPrefixHash ||
                  aPrefixHash->Contains(NS_LITERAL_STRING("#default"))) {
        // only serialize the default namespace declaration if
        // includenamespaceprefixes is declared and it includes '#default'
        // or if we haven't already serialized it (none of the child elements
        // used it)
        PRBool hasDefaultNSAttr;
        aTarget->HasAttributeNS(kXMLNSNameSpaceURI,
                                NS_LITERAL_STRING("xmlns"), &hasDefaultNSAttr);

        if (!hasDefaultNSAttr) {
          aTarget->SetAttributeNS(kXMLNSNameSpaceURI, localName, value);
        }
      }
    }
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIXTFElement::attributeSet ( in nsIAtom  name,
in AString  newValue 
) [inherited]
PRBool nsXFormsSubmissionElement::CheckSameOrigin ( nsIDocument aBaseDocument,
nsIURI aTestURI 
) [private]
Returns:
true if aTestURI has the same origin as aBaseURI or if there is no need for a same origin check.

Definition at line 1323 of file nsXFormsSubmissionElement.cpp.

{
  // we default to true to allow regular posts to work like html forms.
  PRBool allowSubmission = PR_TRUE;

  /* for replace="instance" or XML submission, we follow these strict guidelines:
       - we default to denying submission
       - if we are not replacing instance, then file:// urls can submit anywhere.
         We don't allow fetching of content for file:// urls since for example
         XMLHttpRequest doesn't, since file:// doesn't always mean it is local.
       - if we are still denying, we check the permission manager to see if the
         domain hosting the XForm has been granted permission to get/send data
         anywhere
       - lastly, if submission is still being denied, we do a same origin check
   */
  if (mFormat & (ENCODING_XML | ENCODING_MULTIPART_RELATED) || mIsReplaceInstance) {

    // if same origin is required, default to false
    allowSubmission = PR_FALSE;
    nsIURI *baseURI = aBaseDocument->GetDocumentURI();

    // if we don't replace the instance, we allow file:// to submit data anywhere
    if (!mIsReplaceInstance) {
      baseURI->SchemeIs("file", &allowSubmission);
    }

    // if none of the above checks have allowed the submission, we do a
    // same origin check.
    if (!allowSubmission) {
      // replace instance is both a send and a load
      nsXFormsUtils::ConnectionType mode;
      if (mIsReplaceInstance)
        mode = nsXFormsUtils::kXFormsActionLoadSend;
      else
        mode = nsXFormsUtils::kXFormsActionSend;

      allowSubmission =
        nsXFormsUtils::CheckConnectionAllowed(mElement, aTestURI, mode);
    }
  }

  return allowSubmission;
}

Here is the call graph for this function:

void nsIXTFElement::childInserted ( in nsIDOMNode  child,
in unsigned long  index 
) [inherited]
void nsIXTFElement::childRemoved ( in unsigned long  index) [inherited]
void nsIXTFElement::cloneState ( in nsIDOMElement  aElement) [inherited]

Run through document and create attachment ids for xsd:anyURI nodes.

This is used for "multipart/related".

Parameters:
aModelThe model to use
aDocThe document to run through
aAttachmentsArray of files and attachment ids

Definition at line 1666 of file nsXFormsSubmissionElement.cpp.

{
  nsCOMPtr<nsIDOMNode> currentNode(aNode);

  while (currentNode) {
    PRUint16 currentNodeType;
    nsresult rv = currentNode->GetNodeType(&currentNodeType);
    NS_ENSURE_SUCCESS(rv, rv);

    // If |currentNode| is an element node of type 'xsd:anyURI', we need to
    // generate a ContentID for the child of this element, and append a new
    // attachment to the attachments array.

    PRUint32 encType;
    if (NS_SUCCEEDED(GetElementEncodingType(currentNode, &encType, aModel)) &&
        encType == ELEMENT_ENCTYPE_URI) {
      // ok, looks like we have a local file to upload

      // uploadFileProperty can exist on attribute nodes if an upload is bound
      // to an attribute.  But we'll have to look for such attributes as we
      // we encounter the element nodes that contain them.  We won't reach
      // attributes walking the child/sibling chain of nodes.  So here just
      // test for nsIContent.
      void* uploadFileProperty = nsnull;
      nsCOMPtr<nsIContent> content = do_QueryInterface(currentNode);
      if (content) {
        uploadFileProperty =
          content->GetProperty(nsXFormsAtoms::uploadFileProperty);
      }

      nsIFile *file = NS_STATIC_CAST(nsIFile *, uploadFileProperty);
      // NOTE: this value may be null if a file hasn't been selected.

      if (uploadFileProperty) {
        nsCString cid;
        cid.AssignLiteral("cid:");
        MakeMultipartContentID(cid);
  
        nsCOMPtr<nsIDOMNode> childNode;
      
        switch (currentNodeType) {

        case nsIDOMNode::TEXT_NODE:
        case nsIDOMNode::CDATA_SECTION_NODE:
        case nsIDOMNode::PROCESSING_INSTRUCTION_NODE:
        case nsIDOMNode::COMMENT_NODE:
          rv = currentNode->SetNodeValue(NS_ConvertUTF8toUTF16(cid));
          NS_ENSURE_SUCCESS(rv, rv);
      
          break;
      
        case nsIDOMNode::ELEMENT_NODE:
      
          rv = currentNode->GetFirstChild(getter_AddRefs(childNode));
          NS_ENSURE_SUCCESS(rv, rv);
      
          // shouldn't have to worry about the case of there not being a child
          // node here.  If uploadFileProperty is set then that means that
          // the node that 'currentNode' was cloned from has has gone through
          // through model.SetNodeValue, so should already have a text node
          // as the first child and no extraneous text nodes
          // following the first one.  We'll check to make sure, though.
          PRUint16 childType;
          rv = childNode->GetNodeType(&childType);
          NS_ENSURE_SUCCESS(rv, rv);
      
          if (childType == nsIDOMNode::TEXT_NODE ||
              childType == nsIDOMNode::CDATA_SECTION_NODE) {
            rv = childNode->SetNodeValue(NS_ConvertUTF8toUTF16(cid));
            NS_ENSURE_SUCCESS(rv, rv);
          } else {
            return NS_ERROR_UNEXPECTED;
          }
        }
        aAttachments->Append(file, cid);
      }
    }

    // look to see if the element node has any attributes with an
    // uploadFileProperty on it.
    if (currentNodeType == nsIDOMNode::ELEMENT_NODE) {
      PRBool hasAttributes = PR_FALSE;
      currentNode->HasAttributes(&hasAttributes);
      if (hasAttributes) {
        nsCOMPtr<nsIDOMNamedNodeMap> attrs;
        currentNode->GetAttributes(getter_AddRefs(attrs));
        NS_ENSURE_STATE(attrs);
        PRUint32 length;
        attrs->GetLength(&length);
        nsCOMPtr<nsIDOMNode> attrDOMNode;
        for (PRUint32 i = 0; i < length; ++i) {
          attrs->Item(i, getter_AddRefs(attrDOMNode));
          NS_ENSURE_STATE(attrDOMNode);
          nsCOMPtr<nsIAttribute> attr = do_QueryInterface(attrDOMNode);
          NS_ENSURE_STATE(attr);
          void *uploadFileProperty =
            attr->GetProperty(nsXFormsAtoms::uploadFileProperty);
  
          if (!uploadFileProperty) {
            continue;
          }

          nsIFile *file = NS_STATIC_CAST(nsIFile *, uploadFileProperty);
          nsCString cid;
          cid.AssignLiteral("cid:");
          MakeMultipartContentID(cid);
          rv = attrDOMNode->SetNodeValue(NS_ConvertUTF8toUTF16(cid));
          NS_ENSURE_SUCCESS(rv, rv);
          aAttachments->Append(file, cid);
        }
      }
    }

    nsCOMPtr<nsIDOMNode> child;
    currentNode->GetFirstChild(getter_AddRefs(child));
    if (child) {
      rv = CreateAttachments(aModel, child, aAttachments);
      NS_ENSURE_SUCCESS(rv, rv);
    }

    nsCOMPtr<nsIDOMNode> node;
    currentNode->GetNextSibling(getter_AddRefs(node));
    currentNode.swap(node);
  }
  
  return NS_OK;
}

Here is the call graph for this function:

Create submission document.

This creates a new document, include namespaces, purges non-relevant nodes, and checks simple type validity. If a check fails, no document will be returned.

Parameters:
aRootThe source node
aReturnDocThe resulting document

Definition at line 1458 of file nsXFormsSubmissionElement.cpp.

{
  NS_ENSURE_ARG_POINTER(aRoot);
  NS_ENSURE_ARG_POINTER(aReturnDoc);

  nsCOMPtr<nsIDOMDocument> instDoc, submDoc;
  aRoot->GetOwnerDocument(getter_AddRefs(instDoc));
  nsresult rv;

  if (!instDoc) {
    // owner doc is null when the aRoot node is the document (e.g., ref="/")
    // so we can just get the document via QI.
    instDoc = do_QueryInterface(aRoot);
    NS_ENSURE_STATE(instDoc);

    rv = CreatePurgedDoc(instDoc, getter_AddRefs(submDoc));
  } else {
    rv = CreatePurgedDoc(aRoot, getter_AddRefs(submDoc));
  }
  NS_ENSURE_SUCCESS(rv, rv);
  NS_ENSURE_STATE(submDoc);

  // We now need to add namespaces to the submission document.  We get them
  // from 3 sources - the main document's documentElement, the model and the
  // xforms:instance that contains the submitted instance data node.

  nsCOMPtr<nsIDOMNode> instanceNode;
  rv = nsXFormsUtils::GetInstanceNodeForData(aRoot,
                                             getter_AddRefs(instanceNode));
  NS_ENSURE_SUCCESS(rv, rv);

  // add namespaces from the main document to the submission document, but only
  // if the instance data is local, not remote.
  PRBool serialize = PR_FALSE;
  nsCOMPtr<nsIDOMElement> instanceElement(do_QueryInterface(instanceNode));

  // make sure that this is a DOMElement.  It won't be if it was lazy
  // authored.  Lazy authored instance documents don't inherit namespaces
  // from parent nodes or the original document (in formsPlayer and Novell,
  // at least).
  if (instanceElement) {
    PRBool hasSrc = PR_FALSE;
    instanceElement->HasAttribute(NS_LITERAL_STRING("src"), &hasSrc);
    serialize = !hasSrc;
  }

  if (serialize) {
    // Handle "includenamespaceprefixes" attribute, if present
    nsAutoPtr<nsStringHashSet> prefixHash;
    PRBool hasPrefixAttr = PR_FALSE;
    mElement->HasAttribute(kIncludeNamespacePrefixes, &hasPrefixAttr);
    if (hasPrefixAttr) {
      rv = GetIncludeNSPrefixesAttr(getter_Transfers(prefixHash));
      NS_ENSURE_SUCCESS(rv, rv);
    }

    // get the document element of the document we are going to submit
    nsCOMPtr<nsIDOMElement> submDocElm;
    submDoc->GetDocumentElement(getter_AddRefs(submDocElm));
    NS_ENSURE_STATE(submDocElm);

    // handle namespaces on the root element of the instance document
    nsCOMPtr<nsIDOMElement> instDocElm;
    instDoc->GetDocumentElement(getter_AddRefs(instDocElm));
    nsCOMPtr<nsIDOMNode> instDocNode(do_QueryInterface(instDocElm));
    NS_ENSURE_STATE(instDocNode);
    rv = AddNameSpaces(submDocElm, instDocNode, prefixHash);
    NS_ENSURE_SUCCESS(rv, rv);

    // handle namespaces on the xforms:instance
    rv = AddNameSpaces(submDocElm, instanceNode, prefixHash);
    NS_ENSURE_SUCCESS(rv, rv);

    // handle namespaces on the model
    nsCOMPtr<nsIModelElementPrivate> model = GetModel();
    nsCOMPtr<nsIDOMNode> modelNode(do_QueryInterface(model));
    NS_ENSURE_STATE(modelNode);
    rv = AddNameSpaces(submDocElm, modelNode, prefixHash);
    NS_ENSURE_SUCCESS(rv, rv);

    // handle namespace on main document
    nsCOMPtr<nsIDOMDocument> mainDoc;
    mElement->GetOwnerDocument(getter_AddRefs(mainDoc));
    NS_ENSURE_STATE(mainDoc);

    nsCOMPtr<nsIDOMElement> mainDocElm;
    mainDoc->GetDocumentElement(getter_AddRefs(mainDocElm));
    nsCOMPtr<nsIDOMNode> mainDocNode(do_QueryInterface(mainDocElm));
    NS_ENSURE_STATE(mainDocNode);

    rv = AddNameSpaces(submDocElm, mainDocNode, prefixHash);
    NS_ENSURE_SUCCESS(rv, rv);
  }

  NS_ADDREF(*aReturnDoc = submDoc);

  return NS_OK;
}

Here is the call graph for this function:

Send xforms-submit-done/-error, depending on |aSucceeded|.

Parameters:
aSucceededDid submit succeed?

Definition at line 512 of file nsXFormsSubmissionElement.cpp.

{
  mSubmissionActive = PR_FALSE;
  if (mActivator) {
    mActivator->SetDisabled(PR_FALSE);
    mActivator = nsnull;
  }

  // If there were any errors, set 'error-type' context info.
  if (!mSubmitError.IsEmpty()) {
    nsCOMPtr<nsXFormsContextInfo> contextInfo =
      new nsXFormsContextInfo(mElement);
    if (contextInfo) {
      contextInfo->SetStringValue("error-type", mSubmitError);
      mContextInfo.AppendObject(contextInfo);
    }
  }

  nsXFormsUtils::DispatchEvent(mElement, aSucceeded ?
                               eEvent_SubmitDone : eEvent_SubmitError,
                               nsnull, nsnull, &mContextInfo);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsXFormsSubmissionElement::GetIncludeNSPrefixesAttr ( nsStringHashSet **  aHash) [private]

Definition at line 1418 of file nsXFormsSubmissionElement.cpp.

{
  NS_PRECONDITION(aHash, "null ptr");
  if (!aHash)
    return NS_ERROR_NULL_POINTER;

  *aHash = new nsStringHashSet();
  if (!*aHash)
    return NS_ERROR_OUT_OF_MEMORY;
  (*aHash)->Init(5);

  nsAutoString prefixes;
  mElement->GetAttribute(kIncludeNamespacePrefixes, prefixes);

  // Cycle through space-delimited list and populate hash set
  if (!prefixes.IsEmpty()) {
    PRInt32 start = 0, end;
    PRInt32 length = prefixes.Length();

    do {
      end = prefixes.FindCharInSet(" \t\r\n", start);
      if (end != kNotFound) {
        if (start != end) {   // this line handles consecutive space chars
          const nsAString& p = Substring(prefixes, start, end - start);
          (*aHash)->Put(p);
        }
        start = end + 1;
      }
    } while (end != kNotFound && start != length);

    if (start != length) {
      const nsAString& p = Substring(prefixes, start);
      (*aHash)->Put(p);
    }
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIInterfaceRequestor::getInterface ( in nsIIDRef  uuid,
[iid_is(uuid), retval] out nsQIResult  result 
) [inherited]

Retrieves the specified interface pointer.

Parameters:
uuidThe IID of the interface being requested.
result[out] The interface pointer to be filled in if the interface is accessible.
Returns:
NS_OK - interface was successfully returned. NS_NOINTERFACE - interface not accessible. NS_ERROR* - method failure.

Get/Set the repeat state for the xforms control or action.

The repeat state indicates whether the control or action lives inside a context container, a repeat element, an itemset or none of the above.

Definition at line 205 of file nsXFormsStubElement.cpp.

{
  return mRepeatState;
}
void nsIXTFElement::getScriptingInterfaces ( out unsigned long  count,
[array, size_is(count), retval] out nsIIDPtr  array 
) [inherited]

Definition at line 307 of file nsXFormsSubmissionElement.cpp.

{
  if (!nsXFormsUtils::EventHandlingAllowed(aEvent, mElement))
    return NS_OK;

  nsAutoString type;
  aEvent->GetType(type);
  if (type.EqualsLiteral("xforms-submit")) {
    // If the submission is already active, do nothing.
    if (!mSubmissionActive && NS_FAILED(Submit())) {
      EndSubmit(PR_FALSE);
    }

    *aHandled = PR_TRUE;
  } else if (type.EqualsLiteral("xforms-submit-serialize")) {
    nsCOMPtr<nsIXFormsDOMEvent> xfEvent = do_QueryInterface(aEvent);
    if (xfEvent) {
      nsCOMPtr<nsIXFormsContextInfo> contextInfo;
      nsAutoString contextName;
      contextName.AssignLiteral("submission-body");
      xfEvent->GetContextInfo(contextName, getter_AddRefs(contextInfo));
      if (contextInfo) {
        nsAutoString submissionBody;
        contextInfo->GetStringValue(submissionBody);
        if (!submissionBody.EqualsLiteral(" ")) {
          // Save the new submission body.
          contextInfo->GetNodeValue(getter_AddRefs(mSubmissionBody));
        }
      }
    }
    *aHandled = PR_TRUE;
  } else {
    *aHandled = PR_FALSE;
  }

  return NS_OK;
}

Here is the call graph for this function:

void nsIChannelEventSink::onChannelRedirect ( in nsIChannel  oldChannel,
in nsIChannel  newChannel,
in unsigned long  flags 
) [inherited]

Called when a redirect occurs.

This may happen due to an HTTP 3xx status code.

Parameters:
oldChannelThe channel that's being redirected.
newChannelThe new channel. This channel is not opened yet.
flagsFlags indicating the type of redirect. A bitmask consisting of flags from above. One of REDIRECT_TEMPORARY and REDIRECT_PERMANENT will always be set.
Exceptions:
<any>Throwing an exception will cancel the load. No network request for the new channel will be made.

Definition at line 358 of file nsXFormsSubmissionElement.cpp.

{
  aWrapper->SetNotificationMask(nsIXTFElement::NOTIFY_HANDLE_DEFAULT);

  nsCOMPtr<nsIDOMElement> node;
  aWrapper->GetElementNode(getter_AddRefs(node));

  // It's ok to keep a weak pointer to mElement.  mElement will have an
  // owning reference to this object, so as long as we null out mElement in
  // OnDestroyed, it will always be valid.

  mElement = node;
  NS_ASSERTION(mElement, "Wrapper is not an nsIDOMElement, we'll crash soon");

  return NS_OK;
}

Here is the call graph for this function:

void nsIRequestObserver::onStartRequest ( in nsIRequest  aRequest,
in nsISupports  aContext 
) [inherited]

Called to signify the beginning of an asynchronous request.

Parameters:
aRequestrequest being observed
aContextuser defined context

An exception thrown from onStartRequest has the side-effect of causing the request to be canceled.

Here is the caller graph for this function:

void nsIRequestObserver::onStopRequest ( in nsIRequest  aRequest,
in nsISupports  aContext,
in nsresult  aStatusCode 
) [inherited]

Called to signify the end of an asynchronous request.

This call is always preceded by a call to onStartRequest.

Parameters:
aRequestrequest being observed
aContextuser defined context
aStatusCodereason for stopping (NS_OK if completed successfully)

An exception thrown from onStopRequest is generally ignored.

Here is the caller graph for this function:

Definition at line 919 of file nsXFormsSubmissionElement.cpp.

{

  // Check to see if this submission element has any header elements.  Process
  // the header elements, which will find any name/value pairs and add them
  // to the channel's request header

  nsresult rv = NS_OK;
  nsCOMPtr<nsIDOMNode> currentNode, node, headerNode;
  mElement->GetFirstChild(getter_AddRefs(currentNode));

  PRUint16 nodeType;

  while (currentNode) {
    currentNode->GetNodeType(&nodeType);
    if (nodeType == nsIDOMNode::ELEMENT_NODE) {
      // Check if the element is a header element.
      nsAutoString localName, namespaceURI;
      currentNode->GetLocalName(localName);
      currentNode->GetNamespaceURI(namespaceURI);
      if (localName.EqualsLiteral("header") &&
          namespaceURI.EqualsLiteral(NS_NAMESPACE_XFORMS)) {
        headerNode = currentNode;
        nsAutoString name, value;
        rv = ProcessHeaderElement(headerNode, aHttpChannel);
        NS_ENSURE_SUCCESS(rv, rv);
      }
    }

    currentNode->GetNextSibling(getter_AddRefs(node));
    currentNode.swap(node);
  }

  return NS_OK;
}

Here is the call graph for this function:

void nsIXTFElement::parentChanged ( in nsIDOMElement  newParent) [inherited]

Definition at line 2915 of file nsXFormsSubmissionElement.cpp.

{
  // Context Info: response-body
  // When the error response specifies an XML media type as defined by
  // RFC 3023], the response body is parsed into an XML document and the
  // root element of the document is returned. If the parse fails, or if
  // the error response specifies a text media type (starting with text/),
  // then the response body is returned as a string.
  // Otherwise, an empty string is returned.
  nsCString contentCharset, contentType;
  aChannel->GetContentCharset(contentCharset);
  aChannel->GetContentType(contentType);

  // use DOM parser to construct nsIDOMDocument
  nsCOMPtr<nsIDOMParser> parser =
    do_CreateInstance("@mozilla.org/xmlextras/domparser;1");
  NS_ENSURE_STATE(parser);

  PRUint32 contentLength;
  mPipeIn->Available(&contentLength);

  // set the base uri so that the document can get the correct security
  // principal.
  nsCOMPtr<nsIURI> uri;
  nsresult rv = aChannel->GetURI(getter_AddRefs(uri));
  NS_ENSURE_SUCCESS(rv, rv);
  rv = parser->SetBaseURI(uri);
  NS_ENSURE_SUCCESS(rv, rv);

  // Try to parse the content into an XML document. If the parse fails, the
  // content type is not an XML type that ParseFromStream can handle. In that
  // case, read the response as a simple string.
  nsCOMPtr<nsXFormsContextInfo> contextInfo;
  nsCOMPtr<nsIDOMDocument> newDoc;
  rv = parser->ParseFromStream(mPipeIn, contentCharset.get(), contentLength,
                               contentType.get(), getter_AddRefs(newDoc));
  if (NS_SUCCEEDED(rv)) {
    // Succeeded in parsing the error response as an XML document.
    nsCOMPtr<nsIDOMNode> responseBody = do_QueryInterface(newDoc);
    if (newDoc) {
      contextInfo = new nsXFormsContextInfo(mElement);
      NS_ENSURE_TRUE(contextInfo, NS_ERROR_OUT_OF_MEMORY);

      contextInfo->SetNodeValue("response-body", responseBody);
      mContextInfo.AppendObject(contextInfo);
    }
  } else {
    // Read the content as a simple string and set a string into the
    // context info.
    PRUint32 len, read, numReadIn = 1;
    nsCAutoString responseBody;

    rv = mPipeIn->Available(&len);
    NS_ENSURE_SUCCESS(rv, rv);

    char *buf = new char[len+1];
    NS_ENSURE_TRUE(buf, NS_ERROR_OUT_OF_MEMORY);
    memset(buf, 0, len+1);

    // Read returns 0 if eos
    while (numReadIn != 0) {
      numReadIn = mPipeIn->Read(buf, len, &read);
      responseBody.Append(buf);
    }
    delete [] buf;

    // Set the string response body as context info.
    contextInfo = new nsXFormsContextInfo(mElement);
    NS_ENSURE_TRUE(contextInfo, NS_ERROR_OUT_OF_MEMORY);
    contextInfo->SetStringValue("response-body",
                                NS_ConvertUTF8toUTF16(responseBody));
    mContextInfo.AppendObject(contextInfo);
  }

  return NS_OK;
}

Here is the call graph for this function:

nsresult nsXFormsSubmissionElement::ProcessHeaderElement ( nsIDOMNode aHeaderNode,
nsIHttpChannel aHttpChannel 
) [private]

Definition at line 956 of file nsXFormsSubmissionElement.cpp.

{
  // Take the given header node and look for name/value element pairs
  // underneath.  Evaluate their bindings, if any, and set those headers on
  // the submission request.

  NS_ENSURE_ARG(aHeaderNode);

  PRBool hasNodeset = PR_FALSE;
  nsCOMPtr<nsIDOMXPathResult> nodesetResult;
  PRInt32 contextSize = kNotFound;
  nsAutoString nodesetString(NS_LITERAL_STRING("nodeset"));
  nsresult rv;
  nsCOMPtr<nsIDOMElement> headerElement(do_QueryInterface(aHeaderNode));
  NS_ENSURE_STATE(headerElement);
  headerElement->HasAttribute(nodesetString, &hasNodeset);

  if (hasNodeset) {
    nsAutoString bindExpr;
    headerElement->GetAttribute(nodesetString, bindExpr);
    if (!bindExpr.IsEmpty()) {
      // Get the nodeset we are bound to
      nsCOMPtr<nsIModelElementPrivate> model;
      PRBool usesModelBind = PR_FALSE;
      rv = nsXFormsUtils::EvaluateNodeBinding(headerElement, 0, nodesetString,
                                              EmptyString(),
                                              nsIDOMXPathResult::ORDERED_NODE_SNAPSHOT_TYPE,
                                              getter_AddRefs(model),
                                              getter_AddRefs(nodesetResult),
                                              &usesModelBind);
      NS_ENSURE_SUCCESS(rv, rv);
      PRUint32 tempSize;
      rv = nodesetResult->GetSnapshotLength(&tempSize);
      NS_ENSURE_SUCCESS(rv, rv);
      contextSize = (PRInt32)tempSize;

      if (contextSize <= 0) {
        return NS_OK;
      }
    }
  }

  // look for the name and value elements under the header element

  nsCOMPtr<nsIDOMNode> currentNode, node;
  headerElement->GetFirstChild(getter_AddRefs(currentNode));
  
  PRUint16 nodeType;
  nsAutoString nameExpr, nameValue, valueExpr, valueValue;
  PRBool useNameExpr = PR_FALSE, useValueExpr = PR_FALSE;
  nsCOMPtr<nsIDOMElement> nameElement, valueElement;
  
  while (currentNode && (!valueElement || !nameElement)) {
    currentNode->GetNodeType(&nodeType);
    if (nodeType == nsIDOMNode::ELEMENT_NODE) {
      nsAutoString localName, namespaceURI,
                   valueString(NS_LITERAL_STRING("value"));
      currentNode->GetLocalName(localName);
      currentNode->GetNamespaceURI(namespaceURI);
      if (localName.EqualsLiteral("name") &&
          namespaceURI.EqualsLiteral(NS_NAMESPACE_XFORMS) &&
          !nameElement) {
        nameElement = do_QueryInterface(currentNode);
        if (nameElement) {
          nameElement->HasAttribute(valueString, &useNameExpr);
          if (useNameExpr) {
            nameElement->GetAttribute(valueString, nameExpr);
            if (contextSize == kNotFound) {
              nsCOMPtr<nsIModelElementPrivate> model;
              PRBool usesModelBind = PR_FALSE;
              nsCOMPtr<nsIDOMXPathResult> xpRes;
              rv = nsXFormsUtils::EvaluateNodeBinding(nameElement, 0,
                                                      valueString, EmptyString(),
                                                      nsIDOMXPathResult::STRING_TYPE,
                                                      getter_AddRefs(model),
                                                      getter_AddRefs(xpRes),
                                                      &usesModelBind);
              NS_ENSURE_SUCCESS(rv, rv);
              if (xpRes) {
                // Truncate nameValue so GetStringValue replaces the contents
                // with the xpath result rather than appending to it.
                nameValue.Truncate();
                rv = xpRes->GetStringValue(nameValue);
                NS_ENSURE_SUCCESS(rv, rv);
              }
            }
          } else {
            // No value attribute. Get the string content of the resource element.
            nsXFormsUtils::GetNodeValue(currentNode, nameValue);
          }
        }
      } else if (localName.Equals(valueString) &&
          namespaceURI.EqualsLiteral(NS_NAMESPACE_XFORMS) &&
          !valueElement) {
        valueElement = do_QueryInterface(currentNode);
        if (valueElement) {
          valueElement->HasAttribute(valueString, &useValueExpr);
          if (useValueExpr) {
            valueElement->GetAttribute(valueString, valueExpr);
            if (contextSize == kNotFound) {
              nsCOMPtr<nsIModelElementPrivate> model;
              PRBool usesModelBind = PR_FALSE;
              nsCOMPtr<nsIDOMXPathResult> xpRes;
              rv = nsXFormsUtils::EvaluateNodeBinding(valueElement, 0,
                                                      valueString, EmptyString(),
                                                      nsIDOMXPathResult::STRING_TYPE,
                                                      getter_AddRefs(model),
                                                      getter_AddRefs(xpRes),
                                                      &usesModelBind);
              NS_ENSURE_SUCCESS(rv, rv);
              if (xpRes) {
                // Truncate valueValue so GetStringValue replaces the contents
                // with the xpath result rather than appending to it.
                valueValue.Truncate();
                rv = xpRes->GetStringValue(valueValue);
                NS_ENSURE_SUCCESS(rv, rv);
              }
            }
          } else {
            // No value attribute. Get the string content of the resource element.
            nsXFormsUtils::GetNodeValue(valueElement, valueValue);
          }
        }
      }
    }
    currentNode->GetNextSibling(getter_AddRefs(node));
    currentNode.swap(node);
  }

  NS_ENSURE_STATE(nameElement && valueElement);

  if (contextSize == kNotFound) {
    // if the header element didn't have any nodeset attribute we just have the
    // one name/value pair to worry about

    if (!nameValue.IsEmpty()) {
      rv = aHttpChannel->SetRequestHeader(NS_ConvertUTF16toUTF8(nameValue),
                                          NS_ConvertUTF16toUTF8(valueValue),
                                          PR_TRUE);
      NS_ENSURE_SUCCESS(rv, rv);
    }
    return NS_OK;
  }

  for (PRInt32 i = 0; i < contextSize; ++i) {
    // Get context node
    nsCOMPtr<nsIDOMNode> contextNode;
    rv = nodesetResult->SnapshotItem(i, getter_AddRefs(contextNode));
    NS_ENSURE_SUCCESS(rv, rv);

    if (contextNode) {
      nsCOMPtr<nsIDOMXPathResult> xpRes;
      if (!nameExpr.IsEmpty()) {
        rv = nsXFormsUtils::EvaluateXPath(nameExpr, contextNode, nameElement,
                                          nsIDOMXPathResult::STRING_TYPE,
                                          getter_AddRefs(xpRes));
        NS_ENSURE_SUCCESS(rv, rv);
        if (xpRes) {
          // Truncate nameValue so GetStringValue replaces the contents
          // with the xpath result rather than appending to it.
          nameValue.Truncate();
          rv = xpRes->GetStringValue(nameValue);
          NS_ENSURE_SUCCESS(rv, rv);
        }
      }
      if (!valueExpr.IsEmpty()) {
        rv = nsXFormsUtils::EvaluateXPath(valueExpr, contextNode, valueElement,
                                          nsIDOMXPathResult::STRING_TYPE,
                                          getter_AddRefs(xpRes));
        NS_ENSURE_SUCCESS(rv, rv);
        if (xpRes) {
          // Truncate valueValue so GetStringValue replaces the contents
          // with the xpath result rather than appending to it.
          valueValue.Truncate();
          rv = xpRes->GetStringValue(valueValue);
          NS_ENSURE_SUCCESS(rv, rv);
        }
      }

      if (!nameValue.IsEmpty()) {
        rv = aHttpChannel->SetRequestHeader(NS_ConvertUTF16toUTF8(nameValue),
                                            NS_ConvertUTF16toUTF8(valueValue),
                                            PR_TRUE);
        NS_ENSURE_SUCCESS(rv, rv);
      }
    }
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Set context info.

Definition at line 2851 of file nsXFormsSubmissionElement.cpp.

{

  return NS_OK;
}
nsresult nsXFormsSubmissionElement::SetHttpContextInfo ( PRUint32  aResponse,
const nsAString &  aResponseText 
) [private]

Set Http context info.

Parameters:
aResponseProtocol response code
aResponseTextProtocol response reason phrase

Definition at line 2858 of file nsXFormsSubmissionElement.cpp.

{
  nsresult rv;

  nsCOMPtr<nsXFormsContextInfo> contextInfo = new nsXFormsContextInfo(mElement);
  NS_ENSURE_TRUE(contextInfo, NS_ERROR_OUT_OF_MEMORY);
  // response-status-code
  if (aResponse > 0) {
    contextInfo->SetNumberValue("response-status-code", aResponse);
    mContextInfo.AppendObject(contextInfo);
  }
  // response-reason-phrase
  contextInfo = new nsXFormsContextInfo(mElement);
  NS_ENSURE_TRUE(contextInfo, NS_ERROR_OUT_OF_MEMORY);
  contextInfo->SetStringValue("response-reason-phrase", aResponseText);
  mContextInfo.AppendObject(contextInfo);
  // response-headers
  if (mHttpHeaderDoc) {
    nsCOMPtr<nsIDOMNode> rootNode;
    rv = mHttpHeaderDoc->GetFirstChild(getter_AddRefs(rootNode));
    NS_ENSURE_SUCCESS(rv, rv);

    nsCOMPtr<nsIDOMXPathResult> headerNodeset;
    nsAutoString expr;
    expr.AssignLiteral("header");
    rv = nsXFormsUtils::EvaluateXPath(expr, rootNode, rootNode,
                                      nsIDOMXPathResult::ORDERED_NODE_SNAPSHOT_TYPE,
                                      getter_AddRefs(headerNodeset));

    NS_ENSURE_SUCCESS(rv, rv);

    if (headerNodeset) {
      contextInfo = new nsXFormsContextInfo(mElement);
      NS_ENSURE_TRUE(contextInfo, NS_ERROR_OUT_OF_MEMORY);
      contextInfo->SetNodesetValue("response-headers", headerNodeset);
      mContextInfo.AppendObject(contextInfo);
#ifdef DEBUG
      PRUint32 nodesetSize = 0;
      headerNodeset->GetSnapshotLength(&nodesetSize);
      for (PRUint32 i = 0; i < nodesetSize; i++) {
        nsCOMPtr<nsIDOMNode> headerNode, nameNode, valueNode;
        headerNodeset->SnapshotItem(i, getter_AddRefs(headerNode));
        headerNode->GetFirstChild(getter_AddRefs(nameNode));
        nsAutoString name, value;
        nsXFormsUtils::GetNodeValue(nameNode, name);
        nameNode->GetNextSibling(getter_AddRefs(valueNode));
        nsXFormsUtils::GetNodeValue(valueNode, value);
      }
#endif // DEBUG
    }
  }

  return NS_OK;
}

Here is the call graph for this function:

void nsXFormsStubElement::SetRepeatState ( nsRepeatState  aState) [virtual, inherited]

Definition at line 211 of file nsXFormsStubElement.cpp.

{
  mRepeatState = aState;
  return;
}

Here is the caller graph for this function:

nsRepeatState nsXFormsStubElement::UpdateRepeatState ( nsIDOMNode aParent) [protected, virtual, inherited]

This is processed when an XForms control or XForms action has been inserted under a parent node AND has been inserted into a document.

It checks the ancestors of the element and returns an nsRepeatState depending on the element's place in the document.

Parameters:
aParentThe new parent of the XForms control

Definition at line 218 of file nsXFormsStubElement.cpp.

{
  // Walk up the parent chain looking to see if the this control is contained
  // in an item.  If it is and that item is contained in a itemset, then we
  // know that this control was generated as a clone from the itemset's
  // template.  Similarly, we'll check to see if this control lives in a
  // contextcontainer (meaning it was cloned from a repeat's template).
  // Otherwise, if neither of these are the case but it lives under a repeat
  // or an itemset, then this control must be part of a template.  A template
  // is the content of a repeat or itemset that gets cloned once for every
  // node in the bound nodeset.
  //
  // If none of this applies, we'll return eType_NotApplicable to show that this
  // control isn't bound to a repeating nodeset.
  nsRepeatState repeatState = eType_NotApplicable;

  if (!mHasDoc || !mHasParent) {
    // If we don't have a document or a parent, none of these tests will work
    // correctly so no sense doing them now.  If either of these are false the
    // repeat state for the object should already be eType_Unknown so just
    // return that now.
    return eType_Unknown;
  }

  nsCOMPtr<nsIDOMNode> parent = aParent;
  PRBool childIsItem = PR_FALSE;
  while (parent) {
    if (nsXFormsUtils::IsXFormsElement(parent,
                                       NS_LITERAL_STRING("contextcontainer"))) {
      repeatState = eType_GeneratedContent;
      break;
    }
    if (nsXFormsUtils::IsXFormsElement(parent, NS_LITERAL_STRING("repeat"))) {
      repeatState = eType_Template;
      break;
    }
    if (nsXFormsUtils::IsXFormsElement(parent, NS_LITERAL_STRING("itemset"))) {
      if (childIsItem) {
        repeatState = eType_GeneratedContent;
        break;
      }
      repeatState = eType_Template;
      break;
    }

    if (nsXFormsUtils::IsXFormsElement(parent, NS_LITERAL_STRING("item"))) {
      childIsItem = PR_TRUE;
    } else {

      nsCOMPtr<nsIDOMElement> parentEle(do_QueryInterface(parent));
      if (!parentEle) {
        // I don't know how this can possibly happen, but if it does I guess
        // we should just ignore it and coninue on our way.
        break;
      }

      // if this control is contained underneath an element that contains
      // an xforms binding attribute that introduces an anonymous xf:repeat
      // then the control is part of a template
      PRBool repeatAttr = PR_FALSE;
      parentEle->HasAttributeNS(NS_LITERAL_STRING(NS_NAMESPACE_XFORMS),
                                NS_LITERAL_STRING("repeat-bind"),
                                &repeatAttr);
      if (repeatAttr) {
        repeatState = eType_Template;
        break;
      }

      parentEle->HasAttributeNS(NS_LITERAL_STRING(NS_NAMESPACE_XFORMS),
                                NS_LITERAL_STRING("repeat-nodeset"),
                                &repeatAttr);
      if (repeatAttr) {
        repeatState = eType_Template;
        break;
      }
    }
    nsCOMPtr<nsIDOMNode> tmp;
    parent->GetParentNode(getter_AddRefs(tmp));
    parent = tmp;
  }

  SetRepeatState(repeatState);
  return repeatState;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIHttpHeaderVisitor::visitHeader ( in ACString  aHeader,
in ACString  aValue 
) [inherited]

Called by the nsIHttpChannel implementation when visiting request and response headers.

Parameters:
aHeaderthe header being visited.
aValuethe header value (possibly a comma delimited list).
Exceptions:
anyexception to terminate enumeration
void nsIXTFElement::willInsertChild ( in nsIDOMNode  child,
in unsigned long  index 
) [inherited]
void nsIXTFElement::willRemoveChild ( in unsigned long  index) [inherited]
void nsIXTFElement::willSetAttribute ( in nsIAtom  name,
in AString  newValue 
) [inherited]

Member Data Documentation

Definition at line 115 of file nsXFormsSubmissionElement.h.

Definition at line 149 of file nsXFormsSubmissionElement.h.

Definition at line 142 of file nsXFormsSubmissionElement.h.

Definition at line 133 of file nsXFormsSubmissionElement.h.

Definition at line 124 of file nsXFormsSubmissionElement.h.

Definition at line 117 of file nsXFormsSubmissionElement.h.

Definition at line 119 of file nsXFormsSubmissionElement.h.

Definition at line 152 of file nsXFormsSubmissionElement.h.

Definition at line 111 of file nsXFormsSubmissionElement.h.

Definition at line 124 of file nsXFormsSubmissionElement.h.

Definition at line 124 of file nsXFormsSubmissionElement.h.

Definition at line 124 of file nsXFormsSubmissionElement.h.

Definition at line 72 of file nsIXTFElement.idl.

Definition at line 56 of file nsIXTFElement.idl.

Definition at line 60 of file nsIXTFElement.idl.

Definition at line 64 of file nsIXTFElement.idl.

Definition at line 68 of file nsIXTFElement.idl.

readonly attribute unsigned long nsIXTFElement::elementType [inherited]

Definition at line 78 of file nsIXTFElement.idl.

Definition at line 148 of file nsXFormsSubmissionElement.h.

Definition at line 150 of file nsXFormsSubmissionElement.h.

Definition at line 86 of file nsIXTFElement.idl.

Definition at line 163 of file nsXFormsSubmissionElement.h.

Definition at line 169 of file nsXFormsSubmissionElement.h.

Definition at line 156 of file nsXFormsSubmissionElement.h.

Definition at line 162 of file nsXFormsSubmissionElement.h.

State that tells whether control has a document or not.

This could be false even if the control has a document. Just means that the element doesn't need to track whether it has a document or not (i.e. xf:choices)

Definition at line 109 of file nsXFormsStubElement.h.

State that tells whether control has a parent or not.

This could be false even if the control has a parent. Just means that the element doesn't need to track whether it has a parent or not (i.e. xf:choices)

Definition at line 102 of file nsXFormsStubElement.h.

Definition at line 171 of file nsXFormsSubmissionElement.h.

Definition at line 159 of file nsXFormsSubmissionElement.h.

Definition at line 160 of file nsXFormsSubmissionElement.h.

Definition at line 166 of file nsXFormsSubmissionElement.h.

Definition at line 95 of file nsXFormsStubElement.h.

Definition at line 157 of file nsXFormsSubmissionElement.h.

Definition at line 173 of file nsXFormsSubmissionElement.h.

Definition at line 175 of file nsXFormsSubmissionElement.h.

Definition at line 146 of file nsXFormsSubmissionElement.h.

const unsigned long nsIXTFElement::NOTIFY_ATTRIBUTE_REMOVED = 0x00002000 [inherited]

Definition at line 118 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_ATTRIBUTE_SET = 0x00000800 [inherited]

Definition at line 115 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_BEGIN_ADDING_CHILDREN = 0x00004000 [inherited]

Definition at line 120 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_CHILD_APPENDED = 0x00000080 [inherited]

Definition at line 109 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_CHILD_INSERTED = 0x00000020 [inherited]

Definition at line 106 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_CHILD_REMOVED = 0x00000200 [inherited]

Definition at line 112 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_DOCUMENT_CHANGED = 0x00000002 [inherited]

Definition at line 100 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_DONE_ADDING_CHILDREN = 0x00008000 [inherited]

Definition at line 121 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_HANDLE_DEFAULT = 0x00010000 [inherited]

Definition at line 123 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_PARENT_CHANGED = 0x00000008 [inherited]

Definition at line 103 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_WILL_APPEND_CHILD = 0x00000040 [inherited]

Definition at line 108 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_WILL_CHANGE_DOCUMENT = 0x00000001 [inherited]

Definition at line 99 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_WILL_CHANGE_PARENT = 0x00000004 [inherited]

Definition at line 102 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_WILL_INSERT_CHILD = 0x00000010 [inherited]

Definition at line 105 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_WILL_REMOVE_ATTRIBUTE = 0x00001000 [inherited]

Definition at line 117 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_WILL_REMOVE_CHILD = 0x00000100 [inherited]

Definition at line 111 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_WILL_SET_ATTRIBUTE = 0x00000400 [inherited]

Definition at line 114 of file nsIXTFElement.idl.

const unsigned long nsIChannelEventSink::REDIRECT_INTERNAL = 1 << 2 [inherited]

This is an internal redirect, i.e.

it was not initiated by the remote server, but is specific to the channel implementation.

The new URI may be identical to the old one.

Definition at line 81 of file nsIChannelEventSink.idl.

const unsigned long nsIChannelEventSink::REDIRECT_PERMANENT = 1 << 1 [inherited]

This is a permanent redirect.

New requests for this resource should use the URI of the new channel (This might be an HTTP 301 reponse). If this flag is not set, this is a temporary redirect.

The new URI may be identical to the old one.

Definition at line 73 of file nsIChannelEventSink.idl.

const unsigned long nsIChannelEventSink::REDIRECT_TEMPORARY = 1 << 0 [inherited]

This is a temporary redirect.

New requests for this resource should continue to use the URI of the old channel.

The new URI may be identical to the old one.

Definition at line 64 of file nsIChannelEventSink.idl.

Definition at line 115 of file nsXFormsSubmissionElement.h.

Definition at line 122 of file nsXFormsSubmissionElement.h.

Definition at line 133 of file nsXFormsSubmissionElement.h.

Definition at line 124 of file nsXFormsSubmissionElement.h.

Definition at line 150 of file nsXFormsSubmissionElement.h.

Definition at line 152 of file nsXFormsSubmissionElement.h.

Definition at line 117 of file nsXFormsSubmissionElement.h.


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