captureCount++; wallet_Capture(doc, field, value, vcardValue);
if (wallet_Capture(doc, field, value, vcardValue)) { captureCount++; }
WLLT_RequestToCapture(nsIPresShell* shell, nsIDOMWindow* win, PRUint32* status) {  /* starting with the present shell, get each form element and put them on a list */  nsresult result;  PRInt32 captureCount = 0;  gEncryptionFailure = PR_FALSE;  if (nsnull != shell)  {    nsCOMPtr<nsIDocument> doc;    result = shell->GetDocument(getter_AddRefs(doc));    if (NS_SUCCEEDED(result))    {      wallet_Initialize(PR_TRUE);      wallet_InitializeCurrentURL(doc);      nsCOMPtr<nsIDOMHTMLDocument> htmldoc = do_QueryInterface(doc);      if (htmldoc)      {        nsCOMPtr<nsIDOMHTMLCollection> forms;        htmldoc->GetForms(getter_AddRefs(forms));        if (forms)        {          PRUint32 numForms;          forms->GetLength(&numForms);          for (PRUint32 formX = 0; (formX < numForms) && !gEncryptionFailure; formX++)          {            nsCOMPtr<nsIDOMNode> formNode;            forms->Item(formX, getter_AddRefs(formNode));            if (formNode)            {              nsCOMPtr<nsIDOMHTMLFormElement> formElement = do_QueryInterface(formNode);              if (formElement)              {                nsCOMPtr<nsIDOMHTMLCollection> elements;                result = formElement->GetElements(getter_AddRefs(elements));                if (elements)                {                  /* got to the form elements at long last */                  /* now find out how many text fields are on the form */                  PRUint32 numElements;                  elements->GetLength(&numElements);                  for (PRUint32 elementY = 0; (elementY < numElements) && !gEncryptionFailure; elementY++)                  {                    nsCOMPtr<nsIDOMNode> elementNode;                    elements->Item(elementY, getter_AddRefs(elementNode));                    if (elementNode)                    {                      nsCOMPtr<nsIDOMHTMLInputElement> inputElement = do_QueryInterface(elementNode);                        if (inputElement)                      {                        /* it's an input element */                        nsAutoString type;                        result = inputElement->GetType(type);                        if ((NS_SUCCEEDED(result)) &&                            (type.IsEmpty() || (type.CompareWithConversion("text", PR_TRUE) == 0))) {                          nsAutoString field;                          result = inputElement->GetName(field);                          if (NS_SUCCEEDED(result)) {                            nsAutoString value;                            result = inputElement->GetValue(value);                            if (NS_SUCCEEDED(result)) {                              /* get schema name from vcard attribute if it exists */                              nsAutoString vcardValue;                              nsCOMPtr<nsIDOMElement> element = do_QueryInterface(elementNode);                              if (element)                              {                                nsAutoString vcardName; vcardName.AssignWithConversion("VCARD_NAME");                                result = element->GetAttribute(vcardName, vcardValue);                              }                              captureCount++;                              wallet_Capture(doc, field, value, vcardValue);                            }                          }                        }                      }                    }                  }                }              }            }          }        }      }    }  }  PRUnichar * message;  if (gEncryptionFailure) {    message = Wallet_Localize("UnableToCapture");    *status = -1;  } else if (captureCount) {    /* give caveat if this is the first time data is being captured */    Wallet_GiveCaveat(win, nsnull);    message = Wallet_Localize("Captured");    *status = 0;  } else {    message = Wallet_Localize("NotCaptured");    *status = +1;  }  wallet_Alert(message, win);  Recycle(message);}