Bug 1390433 - (From 1386120)Flip "dom.forms.autocomplete.formautofill" according to the availability of Form Autofill feature. draft
authorLuke Chang <lchang@mozilla.com>
Tue, 01 Aug 2017 14:01:53 +0800
changeset 648815 3069d6214f58f81d7b443f1b6cede2424ffdad1f
parent 648814 a8ef9fb0239c9b1735cf37ae2b58ad584a6ea18e
child 648816 99699094f3645311a807d7bf4170ce8ed08c5351
push id74896
push userschung@mozilla.com
push dateFri, 18 Aug 2017 10:48:05 +0000
bugs1390433, 1386120
milestone56.0
Bug 1390433 - (From 1386120)Flip "dom.forms.autocomplete.formautofill" according to the availability of Form Autofill feature. MozReview-Commit-ID: 3kyDsQL15SO
browser/extensions/formautofill/bootstrap.js
--- a/browser/extensions/formautofill/bootstrap.js
+++ b/browser/extensions/formautofill/bootstrap.js
@@ -37,19 +37,25 @@ function onMaybeOpenPopup(evt) {
     return;
   }
 
   insertStyleSheet(domWindow, STYLESHEET_URI);
 }
 
 function startup() {
   if (Services.prefs.getStringPref("extensions.formautofill.available") != "on") {
+    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);
+
   // 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);