diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js
index c1e23a41be32..dd9094937973 100644
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1716,6 +1716,8 @@ pref("extensions.formautofill.firstTimeUse", true);
pref("extensions.formautofill.heuristics.enabled", true);
pref("extensions.formautofill.section.enabled", true);
pref("extensions.formautofill.loglevel", "Warn");
+// Comma separated list of countries Form Autofill supports
+pref("extensions.formautofill.supportedCountries", "US");
// Whether or not to restore a session with lazy-browser tabs.
pref("browser.sessionstore.restore_tabs_lazily", true);
diff --git a/browser/extensions/formautofill/FormAutofillUtils.jsm b/browser/extensions/formautofill/FormAutofillUtils.jsm
index 73ea961b566c..aa395e606ccc 100644
--- a/browser/extensions/formautofill/FormAutofillUtils.jsm
+++ b/browser/extensions/formautofill/FormAutofillUtils.jsm
@@ -12,9 +12,6 @@ const ADDRESS_METADATA_PATH = "resource://formautofill/addressmetadata/";
const ADDRESS_REFERENCES = "addressReferences.js";
const ADDRESS_REFERENCES_EXT = "addressReferencesExt.js";
-// TODO: This list should become a pref in Bug 1413494
-const SUPPORTED_COUNTRY_LIST = ["US"];
-
const ADDRESSES_COLLECTION_NAME = "addresses";
const CREDITCARDS_COLLECTION_NAME = "creditCards";
const ADDRESSES_FIRST_TIME_USE_PREF = "extensions.formautofill.firstTimeUse";
@@ -22,6 +19,7 @@ const ENABLED_AUTOFILL_ADDRESSES_PREF = "extensions.formautofill.addresses.enabl
const CREDITCARDS_USED_STATUS_PREF = "extensions.formautofill.creditCards.used";
const AUTOFILL_CREDITCARDS_AVAILABLE_PREF = "extensions.formautofill.creditCards.available";
const ENABLED_AUTOFILL_CREDITCARDS_PREF = "extensions.formautofill.creditCards.enabled";
+const SUPPORTED_COUNTRIES_PREF = "extensions.formautofill.supportedCountries";
const MANAGE_ADDRESSES_KEYWORDS = ["manageAddressesTitle", "addNewAddressTitle"];
const EDIT_ADDRESS_KEYWORDS = [
"givenName", "additionalName", "familyName", "organization2", "streetAddress",
@@ -378,7 +376,7 @@ this.FormAutofillUtils = {
* @returns {string} The matching country code.
*/
identifyCountryCode(countryName, countrySpecified) {
- let countries = countrySpecified ? [countrySpecified] : SUPPORTED_COUNTRY_LIST;
+ let countries = countrySpecified ? [countrySpecified] : this.supportedCountries;
for (let country of countries) {
let collators = this.getCollators(country);
@@ -696,3 +694,6 @@ XPCOMUtils.defineLazyPreferenceGetter(this.FormAutofillUtils,
"isAutofillAddressesFirstTimeUse", ADDRESSES_FIRST_TIME_USE_PREF);
XPCOMUtils.defineLazyPreferenceGetter(this.FormAutofillUtils,
"AutofillCreditCardsUsedStatus", CREDITCARDS_USED_STATUS_PREF);
+XPCOMUtils.defineLazyPreferenceGetter(this.FormAutofillUtils,
+ "supportedCountries", SUPPORTED_COUNTRIES_PREF, null, null,
+ val => val.split(","));
diff --git a/browser/extensions/formautofill/ProfileStorage.jsm b/browser/extensions/formautofill/ProfileStorage.jsm
index fa93ca32b0ae..d2c65e1955d1 100644
--- a/browser/extensions/formautofill/ProfileStorage.jsm
+++ b/browser/extensions/formautofill/ProfileStorage.jsm
@@ -1216,9 +1216,7 @@ class Addresses extends AutofillRecords {
}
_recordReadProcessor(address) {
- // TODO: We only support US in MVP so hide the field if it's not. We
- // are going to support more countries in bug 1370193.
- if (address.country && address.country != "US") {
+ if (address.country && !FormAutofillUtils.supportedCountries.includes(address.country)) {
delete address.country;
delete address["country-name"];
}
diff --git a/browser/extensions/formautofill/bootstrap.js b/browser/extensions/formautofill/bootstrap.js
index a4490ce99c07..3a21191a5b0b 100644
--- a/browser/extensions/formautofill/bootstrap.js
+++ b/browser/extensions/formautofill/bootstrap.js
@@ -59,7 +59,9 @@ function isAvailable() {
} else if (availablePref == "detect") {
let locale = Services.locale.getRequestedLocale();
let region = Services.prefs.getCharPref("browser.search.region", "");
- return locale == "en-US" && region == "US";
+ let supportedCountries = Services.prefs.getCharPref("extensions.formautofill.supportedCountries")
+ .split(",");
+ return locale == "en-US" && supportedCountries.includes(region);
}
return false;
}
diff --git a/browser/extensions/formautofill/content/editAddress.xhtml b/browser/extensions/formautofill/content/editAddress.xhtml
index 64be8f9ab13b..df8364d75561 100644
--- a/browser/extensions/formautofill/content/editAddress.xhtml
+++ b/browser/extensions/formautofill/content/editAddress.xhtml
@@ -49,10 +49,9 @@
-
+