diff --git a/firefox-ios/Client/Assets/CC_Script/FieldScanner.sys.mjs b/firefox-ios/Client/Assets/CC_Script/FieldScanner.sys.mjs
index 85f771dd0c01..7d6a87d255cc 100644
--- a/firefox-ios/Client/Assets/CC_Script/FieldScanner.sys.mjs
+++ b/firefox-ios/Client/Assets/CC_Script/FieldScanner.sys.mjs
@@ -6,6 +6,7 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
FormAutofill: "resource://autofill/FormAutofill.sys.mjs",
FormAutofillUtils: "resource://gre/modules/shared/FormAutofillUtils.sys.mjs",
+ MLAutofill: "resource://autofill/MLAutofill.sys.mjs",
});
/**
@@ -98,6 +99,8 @@ export class FieldDetail {
fathomLabel = null,
fathomConfidence = null,
isVisible = true,
+ mlHeaderInput = null,
+ mlButtonInput = null,
} = {}
) {
const fieldDetail = new FieldDetail(element);
@@ -169,7 +172,9 @@ export class FieldDetail {
lazy.FormAutofill.isMLExperimentEnabled &&
["input", "select"].includes(element.localName)
) {
- fieldDetail.htmlMarkup = element.outerHTML.substring(0, 1024);
+ fieldDetail.mlinput = lazy.MLAutofill.getMLMarkup(fieldDetail.element);
+ fieldDetail.mlHeaderInput = mlHeaderInput;
+ fieldDetail.mlButtonInput = mlButtonInput;
fieldDetail.fathomLabel = fathomLabel;
fieldDetail.fathomConfidence = fathomConfidence;
}
diff --git a/firefox-ios/Client/Assets/CC_Script/FormAutofill.sys.mjs b/firefox-ios/Client/Assets/CC_Script/FormAutofill.sys.mjs
index 82889760649a..64e20cdbb317 100644
--- a/firefox-ios/Client/Assets/CC_Script/FormAutofill.sys.mjs
+++ b/firefox-ios/Client/Assets/CC_Script/FormAutofill.sys.mjs
@@ -83,10 +83,22 @@ export const FormAutofill = {
}
return false;
},
+
+ /**
+ * Return true if address autofill is available for a specific country.
+ */
isAutofillAddressesAvailableInCountry(country) {
- return FormAutofill._addressAutofillSupportedCountries.includes(
- country.toUpperCase()
- );
+ if (FormAutofill._isAutofillAddressesAvailableInExperiment) {
+ return true;
+ }
+
+ let available = FormAutofill._isAutofillAddressesAvailable;
+ if (country && available == "detect") {
+ return FormAutofill._addressAutofillSupportedCountries.includes(
+ country.toUpperCase()
+ );
+ }
+ return available == "on";
},
get isAutofillEnabled() {
return this.isAutofillAddressesEnabled || this.isAutofillCreditCardsEnabled;
@@ -317,6 +329,13 @@ XPCOMUtils.defineLazyPreferenceGetter(
false
);
+XPCOMUtils.defineLazyPreferenceGetter(
+ FormAutofill,
+ "MLModelRevision",
+ "extensions.formautofill.ml.experiment.modelRevision",
+ null
+);
+
ChromeUtils.defineLazyGetter(FormAutofill, "countries", () =>
AddressMetaDataLoader.getCountries()
);
diff --git a/firefox-ios/Client/Assets/CC_Script/FormAutofillChild.ios.sys.mjs b/firefox-ios/Client/Assets/CC_Script/FormAutofillChild.ios.sys.mjs
index b0a956a19304..f094b0fe96a1 100644
--- a/firefox-ios/Client/Assets/CC_Script/FormAutofillChild.ios.sys.mjs
+++ b/firefox-ios/Client/Assets/CC_Script/FormAutofillChild.ios.sys.mjs
@@ -71,7 +71,7 @@ export class FormAutofillChild {
if (!handler.hasIdentifiedFields() || handler.updateFormIfNeeded(element)) {
// If we found newly identified fields, run section classification heuristic
- const detectedFields = FormAutofillHandler.collectFormFields(
+ const detectedFields = FormAutofillHandler.collectFormFieldDetails(
handler.form
);
diff --git a/firefox-ios/Client/Assets/CC_Script/FormAutofillHandler.sys.mjs b/firefox-ios/Client/Assets/CC_Script/FormAutofillHandler.sys.mjs
index a7aec3ac1f64..1989b41a94ff 100644
--- a/firefox-ios/Client/Assets/CC_Script/FormAutofillHandler.sys.mjs
+++ b/firefox-ios/Client/Assets/CC_Script/FormAutofillHandler.sys.mjs
@@ -217,20 +217,38 @@ export class FormAutofillHandler {
* Collect ,