Bug 1385179 - Enable addresses sync engine as formautofill initializes. r=MattN
authorMark Hammond <mhammond@skippinet.com.au>
Tue, 08 Aug 2017 15:07:10 +1000
changeset 374669 5d879d2d773034c969103f8756e331089b193291
parent 374668 faaf89285517cacf28cd764294ce2b0e0486f94d
child 374670 2cca20fca12c1abf92545966332215f895bf61a8
push id48762
push usermhammond@skippinet.com.au
push dateTue, 15 Aug 2017 01:50:22 +0000
treeherderautoland@5d879d2d7730 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1385179
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1385179 - Enable addresses sync engine as formautofill initializes. r=MattN MozReview-Commit-ID: BPikY3wM8Df
browser/extensions/formautofill/bootstrap.js
--- a/browser/extensions/formautofill/bootstrap.js
+++ b/browser/extensions/formautofill/bootstrap.js
@@ -60,16 +60,19 @@ function isAvailable() {
     return locale == "en-US" && region == "US";
   }
   return false;
 }
 
 function startup(data) {
   if (!isAvailable()) {
     Services.prefs.clearUserPref("dom.forms.autocomplete.formautofill");
+    // reset the sync related prefs incase the feature was previously available
+    // but isn't now.
+    Services.prefs.clearUserPref("services.sync.engine.addresses.available");
     return;
   }
 
   if (data.hasOwnProperty("instanceID") && data.instanceID) {
     if (AddonManagerPrivate.isDBLoaded()) {
       addUpgradeListener(data.instanceID);
     } else {
       // Wait for the extension database to be loaded so we don't cause its init.
@@ -82,16 +85,21 @@ function startup(data) {
     throw Error("no instanceID passed to bootstrap startup");
   }
 
   // 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);
 
+  // This pref determines whether the "addresses" sync engine is available
+  // (ie, whether it is shown in any UI etc) - it *does not* determine whether
+  // the engine is actually enabled or not.
+  Services.prefs.setBoolPref("services.sync.engine.addresses.available", true);
+
   // Listen for the autocomplete popup message to lazily append our stylesheet related to the popup.
   Services.mm.addMessageListener("FormAutoComplete:MaybeOpenPopup", onMaybeOpenPopup);
 
   let parent = new FormAutofillParent();
   parent.init().catch(Cu.reportError);
   Services.ppmm.loadProcessScript("data:,new " + function() {
     Components.utils.import("resource://formautofill/FormAutofillContent.jsm");
   }, true);