Bug 1385196 - [Form Autofill] Enable the feature based on locale and geoip. r=MattN
MozReview-Commit-ID: 3yvCJvB5zdT
--- a/browser/extensions/formautofill/bootstrap.js
+++ b/browser/extensions/formautofill/bootstrap.js
@@ -36,17 +36,28 @@ function onMaybeOpenPopup(evt) {
// This window already has autofill stylesheets.
return;
}
insertStyleSheet(domWindow, STYLESHEET_URI);
}
function startup() {
- if (Services.prefs.getStringPref("extensions.formautofill.available") != "on") {
+ let featureAvailable = false;
+ let prefAvailable = Services.prefs.getCharPref("extensions.formautofill.available");
+
+ if (prefAvailable == "on") {
+ featureAvailable = true;
+ } else if (prefAvailable == "detect") {
+ let locale = Services.locale.getRequestedLocale();
+ let region = Services.prefs.getCharPref("browser.search.region", "");
+ featureAvailable = (locale == "en-US" && region == "US");
+ }
+
+ if (!featureAvailable) {
Services.prefs.clearUserPref("dom.forms.autocomplete.formautofill");
return;
}
// This pref is used for web contents to detect the autocomplete feature.
// When it's true, "element.autocomplete" will return tokens we currently
// support -- otherwise it'll return an empty string.
Services.prefs.setBoolPref("dom.forms.autocomplete.formautofill", true);