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 649795 658f0d12cc26f9ff14e88d36a1e9f14e0ab57dc3
parent 649794 4903cf2eaf5a2da7d32c20e60d680d5fa885d591
child 649796 c7e40486b23a1a421ed46b16041d0109dbbae32f
push id75162
push userschung@mozilla.com
push dateMon, 21 Aug 2017 10:29:17 +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);