Bug 1386120 - Flip "dom.forms.autocomplete.formautofill" according to the availability of Form Autofill feature. r=MattN, steveck draft
authorLuke Chang <lchang@mozilla.com>
Tue, 01 Aug 2017 14:01:53 +0800
changeset 620295 c219a93d3375be805c4b77c2e587a72edc1b035b
parent 620112 d942ef54fdf726840a698d2ddcaf989d2c00edbc
child 640657 a50a3213ff67235c3055061b19f6a0b3d861382b
push id71994
push userbmo:lchang@mozilla.com
push dateThu, 03 Aug 2017 09:46:09 +0000
reviewersMattN, steveck
bugs1386120
milestone57.0a1
Bug 1386120 - Flip "dom.forms.autocomplete.formautofill" according to the availability of Form Autofill feature. r=MattN, steveck 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);