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
@@ -45,18 +45,30 @@ function onMaybeOpenPopup(evt) {
function addUpgradeListener(instanceID) {
AddonManager.addUpgradeListener(instanceID, upgrade => {
// don't install the upgrade by doing nothing here.
// The upgrade will be installed upon next restart.
});
}
+function isAvailable() {
+ let availablePref = Services.prefs.getCharPref("extensions.formautofill.available");
+ if (availablePref == "on") {
+ return true;
+ } else if (availablePref == "detect") {
+ let locale = Services.locale.getRequestedLocale();
+ let region = Services.prefs.getCharPref("browser.search.region", "");
+ return locale == "en-US" && region == "US";
+ }
+ return false;
+}
+
function startup(data) {
- if (Services.prefs.getStringPref("extensions.formautofill.available") != "on") {
+ if (!isAvailable()) {
Services.prefs.clearUserPref("dom.forms.autocomplete.formautofill");
return;
}
if (data.hasOwnProperty("instanceID") && data.instanceID) {
if (AddonManagerPrivate.isDBLoaded()) {
addUpgradeListener(data.instanceID);
} else {