function unownedFormElementsAndFieldSetsToFormData_(
    frame, fieldsets, controlElements, extractMask,
    restrictUnownedFieldsToFormlessCheckout, form) {
  if (!frame) {
    return false;
  }

  form['name'] = '';
  form['origin'] =
      __gCrWeb.common.removeQueryAndReferenceFromURL(frame.location.href);
  form['action'] = '';
  form['is_form_tag'] = false;

  if (!restrictUnownedFieldsToFormlessCheckout) {
    return __gCrWeb.fill.formOrFieldsetsToFormData(
        null /* formElement*/, null /* formControlElement */, fieldsets,
        controlElements, extractMask, form, null /* field */);
  }

  // For now this restriction only applies to English-language pages, because
  // the keywords are not translated. Note that an empty "lang" attribute
  // counts as English.
  if (document.documentElement.hasAttribute('lang') &&
      !document.documentElement.getAttribute('lang').toLowerCase().startsWith(
          'en')) {
    return __gCrWeb.fill.formOrFieldsetsToFormData(
        null /* formElement*/, null /* formControlElement */, fieldsets,
        controlElements, extractMask, form, null /* field */);
  }

  var title = document.title.toLowerCase();
  var path = document.location.pathname.toLowerCase();
  // The keywords are defined in
  // UnownedCheckoutFormElementsAndFieldSetsToFormData in
  // components/autofill/content/renderer/form_autofill_util.cc
  var keywords =
      ['payment', 'checkout', 'address', 'delivery', 'shipping', 'wallet'];

  var count = keywords.length;
  for (var index = 0; index < count; index++) {
    var keyword = keywords[index];
    if (title.includes(keyword) || path.includes(keyword)) {
      form['is_formless_checkout'] = true;
      return __gCrWeb.fill.formOrFieldsetsToFormData(
          null /* formElement*/, null /* formControlElement */, fieldsets,
          controlElements, extractMask, form, null /* field */);
    }
  }

  // Since it's not a checkout flow, only add fields that have a non-"off"
  // autocomplete attribute to the formless autofill.
  var controlElementsWithAutocomplete = [];
  for (var index = 0; index < controlElements.length; index++) {
    if (controlElements[index].hasAttribute('autocomplete') &&
        controlElements[index].getAttribute('autocomplete') !== 'off') {
      controlElementsWithAutocomplete += controlElements[index];
    }
  }

  if (controlElementsWithAutocomplete.length == 0) {
    return false;
  }
  return __gCrWeb.fill.formOrFieldsetsToFormData(
      null /* formElement*/, null /* formControlElement */, fieldsets,
      controlElementsWithAutocomplete, extractMask, form, null /* field */);
}
/**
 * Fills |form| with the form data object corresponding to the unowned elements
 * and fieldsets in the document.
 * |extract_mask| controls what data is extracted.
 * Returns true if |form| is filled out. Returns false if there are no fields or
 * too many fields in the |form|.
 *
 * It is based on the logic in
 *     bool UnownedFormElementsAndFieldSetsToFormData(
 *         const std::vector<blink::WebElement>& fieldsets,
 *         const std::vector<blink::WebFormControlElement>& control_elements,
 *         const GURL& origin,
 *         ExtractMask extract_mask,
 *         FormData* form)
 * and
 *     bool UnownedCheckoutFormElementsAndFieldSetsToFormData(
 *         const std::vector<blink::WebElement>& fieldsets,
 *         const std::vector<blink::WebFormControlElement>& control_elements,
 *         const blink::WebFormControlElement* element,
 *         const blink::WebDocument& document,
 *         ExtractMask extract_mask,
 *         FormData* form,
 *         FormFieldData* field)
 * in chromium/src/components/autofill/content/renderer/form_autofill_util.cc
 *
 * @param {HTMLFrameElement|Window} frame The window or frame where the
 *     formElement is in.
 * @param {Array<Element>} fieldsets The fieldsets to look through.
 * @param {Array<FormControlElement>} controlElements The control elements that
 *     will be processed.
 * @param {number} extractMask Mask controls what data is extracted from
 *     formElement.
 * @param {bool} restrictUnownedFieldsToFormlessCheckout whether forms made of
 *     unowned fields (i.e., not within a <form> tag) should be restricted to
 *     those that appear to be in a checkout flow.
 * @param {AutofillFormData} form Form to fill in the AutofillFormData
 *     information of formElement.
 * @return {boolean} Whether there are fields and not too many fields in the
 *     form.
 */
Fills |form| with the form data object corresponding to the unowned elements
and fieldsets in the document.
|extract_mask| controls what data is extracted.
Returns true if |form| is filled out. Returns false if there are no fields or
too many fields in the |form|.



@param {HTMLFrameElement|Window} frame The window or frame where the
formElement is in.
@param {Array} fieldsets The fieldsets to look through.
@param {Array} controlElements The control elements that
will be processed.
@param {number} extractMask Mask controls what data is extracted from
formElement.
@param {bool} restrictUnownedFieldsToFormlessCheckout whether forms made of
unowned fields  should be restricted to
those that appear to be in a checkout flow.
@param {AutofillFormData} form Form to fill in the AutofillFormData
information of formElement.
@return {boolean} Whether there are fields and not too many fields in the
form.
Fills |form| with the form data object corresponding to the unowned elements and fieldsets in the document . |extract_mask| controls what data is extracted . Returns true if |form| is filled out . Returns false if there are no fields or too many fields in the |form| . @param { HTMLFrameElement|Window } frame The window or frame where the formElement is in . @param { Array } fieldsets The fieldsets to look through . @param { Array } controlElements The control elements that will be processed . @param { number } extractMask Mask controls what data is extracted from formElement . @param { bool } restrictUnownedFieldsToFormlessCheckout whether forms made of unowned fields should be restricted to those that appear to be in a checkout flow . @param { AutofillFormData } form Form to fill in the AutofillFormData information of formElement . @return { boolean } Whether there are fields and not too many fields in the form .
function unownedFormElementsAndFieldSetsToFormData_(
    frame, fieldsets, controlElements, extractMask,
    restrictUnownedFieldsToFormlessCheckout, form) {
  if (!frame) {
    return false;
  }
  form['name'] = '';
  form['origin'] =
      __gCrWeb.common.removeQueryAndReferenceFromURL(frame.location.href);
  form['action'] = '';
  form['is_form_tag'] = false;
  if (!restrictUnownedFieldsToFormlessCheckout) {
    return __gCrWeb.fill.formOrFieldsetsToFormData(
        null , null , fieldsets,
        controlElements, extractMask, form, null );
  }
  if (document.documentElement.hasAttribute('lang') &&
      !document.documentElement.getAttribute('lang').toLowerCase().startsWith(
          'en')) {
    return __gCrWeb.fill.formOrFieldsetsToFormData(
        null , null , fieldsets,
        controlElements, extractMask, form, null );
  }
  var title = document.title.toLowerCase();
  var path = document.location.pathname.toLowerCase();
  var keywords =
      ['payment', 'checkout', 'address', 'delivery', 'shipping', 'wallet'];
  var count = keywords.length;
  for (var index = 0; index < count; index++) {
    var keyword = keywords[index];
    if (title.includes(keyword) || path.includes(keyword)) {
      form['is_formless_checkout'] = true;
      return __gCrWeb.fill.formOrFieldsetsToFormData(
          null , null , fieldsets,
          controlElements, extractMask, form, null );
    }
  }
  var controlElementsWithAutocomplete = [];
  for (var index = 0; index < controlElements.length; index++) {
    if (controlElements[index].hasAttribute('autocomplete') &&
        controlElements[index].getAttribute('autocomplete') !== 'off') {
      controlElementsWithAutocomplete += controlElements[index];
    }
  }
  if (controlElementsWithAutocomplete.length == 0) {
    return false;
  }
  return __gCrWeb.fill.formOrFieldsetsToFormData(
      null , null , fieldsets,
      controlElementsWithAutocomplete, extractMask, form, null );
}
function unownedFormElementsAndFieldSetsToFormData_ ( frame , fieldsets , controlElements , extractMask , restrictUnownedFieldsToFormlessCheckout , form ) { if ( ! frame ) { return false ; } form [ 'name' ] = '' ; form [ 'origin' ] = __gCrWeb . common . removeQueryAndReferenceFromURL ( frame . location . href ) ; form [ 'action' ] = '' ; form [ 'is_form_tag' ] = false ; if ( ! restrictUnownedFieldsToFormlessCheckout ) { return __gCrWeb . fill . formOrFieldsetsToFormData ( null , null , fieldsets , controlElements , extractMask , form , null ) ; } if ( document . documentElement . hasAttribute ( 'lang' ) && ! document . documentElement . getAttribute ( 'lang' ) . toLowerCase ( ) . startsWith ( 'en' ) ) { return __gCrWeb . fill . formOrFieldsetsToFormData ( null , null , fieldsets , controlElements , extractMask , form , null ) ; } var title = document . title . toLowerCase ( ) ; var path = document . location . pathname . toLowerCase ( ) ; var keywords = [ 'payment' , 'checkout' , 'address' , 'delivery' , 'shipping' , 'wallet' ] ; var count = keywords . length ; for ( var index = 0 ; index < count ; index ++ ) { var keyword = keywords [ index ] ; if ( title . includes ( keyword ) || path . includes ( keyword ) ) { form [ 'is_formless_checkout' ] = true ; return __gCrWeb . fill . formOrFieldsetsToFormData ( null , null , fieldsets , controlElements , extractMask , form , null ) ; } } var controlElementsWithAutocomplete = [ ] ; for ( var index = 0 ; index < controlElements . length ; index ++ ) { if ( controlElements [ index ] . hasAttribute ( 'autocomplete' ) && controlElements [ index ] . getAttribute ( 'autocomplete' ) !== 'off' ) { controlElementsWithAutocomplete += controlElements [ index ] ; } } if ( controlElementsWithAutocomplete . length == 0 ) { return false ; } return __gCrWeb . fill . formOrFieldsetsToFormData ( null , null , fieldsets , controlElementsWithAutocomplete , extractMask , form , null ) ; }
Fills |form| with the form data object corresponding to the unowned elements
 and fieldsets in the document.
Fills |form| with the form data object corresponding to the unowned elements and fieldsets in the document .
/* formElement*/ /* formControlElement */ /* field */ // For now this restriction only applies to English-language pages, because // the keywords are not translated. Note that an empty "lang" attribute // counts as English. /* formElement*/ /* formControlElement */ /* field */ // The keywords are defined in // UnownedCheckoutFormElementsAndFieldSetsToFormData in // components/autofill/content/renderer/form_autofill_util.cc /* formElement*/ /* formControlElement */ /* field */ // Since it's not a checkout flow, only add fields that have a non-"off" // autocomplete attribute to the formless autofill. /* formElement*/ /* formControlElement */ /* field */