Bug 425145 - Add a preference to override autocomplete=off for password manager. r=gavin
authorManish Goregaokar <manishearth@gmail.com>
Thu, 19 Dec 2013 11:32:09 -0500
changeset 161346 31a801812dcea371376da5234de891353f235c19
parent 161345 07b3207166bab80d23d8ee9e086b09a8b51690eb
child 161347 58698f94b7627694651142977ea48a6e4cf105b4
push id25878
push userkwierso@gmail.com
push dateFri, 20 Dec 2013 03:09:21 +0000
treeherdermozilla-central@599100c4ebfe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin
bugs425145
milestone29.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 425145 - Add a preference to override autocomplete=off for password manager. r=gavin
modules/libpref/src/init/all.js
toolkit/components/passwordmgr/LoginManagerContent.jsm
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -3893,16 +3893,18 @@ pref("print.print_command", "lp -c -s ${
 # Solaris
 #endif
 
 // Login Manager prefs
 pref("signon.rememberSignons",              true);
 pref("signon.autofillForms",                true);
 pref("signon.autologin.proxy",              false);
 pref("signon.debug",                        false);
+// Override autocomplete=false for password manager
+pref("signon.overrideAutocomplete",         false);
 
 // Satchel (Form Manager) prefs
 pref("browser.formfill.debug",            false);
 pref("browser.formfill.enable",           true);
 pref("browser.formfill.expire_days",      180);
 pref("browser.formfill.saveHttpsForms",   true);
 pref("browser.formfill.agedWeight",       2);
 pref("browser.formfill.bucketSize",       1);
--- a/toolkit/components/passwordmgr/LoginManagerContent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerContent.jsm
@@ -8,17 +8,17 @@ const Ci = Components.interfaces;
 const Cr = Components.results;
 const Cc = Components.classes;
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
 
-var gEnabled = false, gDebug = false, gAutofillForms = true; // these mirror signon.* prefs
+var gEnabled = false, gDebug = false, gAutofillForms = true , gOverrideAutocompleteAttribute = false; // these mirror signon.* prefs
 
 function log(...pieces) {
     function generateLogMessage(args) {
         let strings = ['Login Manager (content):'];
 
         args.forEach(function(arg) {
             if (typeof arg === 'string') {
                 strings.push(arg);
@@ -66,16 +66,17 @@ var observer = {
 
         return true; // Always return true, or form submit will be canceled.
     },
 
     onPrefChange : function() {
         gDebug = Services.prefs.getBoolPref("signon.debug");
         gEnabled = Services.prefs.getBoolPref("signon.rememberSignons");
         gAutofillForms = Services.prefs.getBoolPref("signon.autofillForms");
+        gOverrideAutocompleteAttribute = Services.prefs.getBoolPref("signon.overrideAutocomplete");
     },
 };
 
 Services.obs.addObserver(observer, "earlyformsubmit", false);
 var prefBranch = Services.prefs.getBranch("signon.");
 prefBranch.addObserver("", observer.onPrefChange, false);
 
 observer.onPrefChange(); // read initial values
@@ -351,20 +352,23 @@ var LoginManagerContent = {
 
     /*
      * _isAutoCompleteDisabled
      *
      * Returns true if the page requests autocomplete be disabled for the
      * specified form input.
      */
     _isAutocompleteDisabled :  function (element) {
+        if (gOverrideAutocompleteAttribute)
+            return false; 
+
         if (element && element.hasAttribute("autocomplete") &&
             element.getAttribute("autocomplete").toLowerCase() == "off")
             return true;
-
+        
         return false;
     },
 
 
     /*
      * _onFormSubmit
      *
      * Called by the our observer when notified of a form submission.