Toolkit:Password Manager/Debugging: Difference between revisions

Add a new reason for why logins are not autofilled. See https://bugzilla.mozilla.org/show_bug.cgi?id=786276 for more details.
(→‎Won't auto-fill a saved password: add more common reasons)
(Add a new reason for why logins are not autofilled. See https://bugzilla.mozilla.org/show_bug.cgi?id=786276 for more details.)
 
(26 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The password manager in Firefox includes the ability to log debugging information to the [https://developer.mozilla.org/en-US/docs/Tools/Browser_Console Browser Console], which can be enabled to help diagnose problems. This logging is off by default. Passwords are not shown in the output.
The password manager in Firefox includes the ability to log debugging information to the [https://developer.mozilla.org/en-US/docs/Tools/Browser_Console Browser Console], which can be enabled to help diagnose problems. This logging is off by default. Passwords are not shown in the output.


= Enable Debug Logging =
= Gathering Debug Logs =
[https://drive.google.com/file/d/1P94qZvQc3FkLiwhrmEYTSweCGt09ef97/preview Follow the instructions in this video] or the written steps in both sections below.
== Enable Debug Logging ==


# Enter "about:config" in the URL bar.
<ol>
# You may see a warning screen, cautioning you about changing advanced preferences. Click the button to ignore the warning.
  <li>Enter "about:config" in the URL bar.</li>
# Find the <code>signon.debug</code> and <code>javascript.options.showInConsole</code> settings, and set them to <code>true</code> (the latter may already be <code>true</code>). You can enter the name in the "Filter" box at the top of the page to help find them. To change the value of a setting, right-click on the line and select "Toggle" or just double-click the line.
  <li>You may see a warning screen cautioning you about changing advanced preferences. Click the button to ignore the warning.</li>
# Restart the browser. Some logging is only enabled after the restart.
  <li>
      Make sure '''''all''''' of the following prefs are set to 'true'.  (Find a pref by entering its name in the "Filter" box at the top of the page. Toggle its value by either clicking the ⇌ (Toggle) icon or double-clicking the line.)
      <blockquote>signon.debug<br/>devtools.browserconsole.contentMessages<br/>devtools.browserconsole.filter.error<br/>devtools.browserconsole.filter.warn<br/>devtools.browserconsole.filter.info<br/>devtools.browserconsole.filter.log<br/>devtools.browserconsole.filter.debug<br/></blockquote>
  </li>
  <li>Restart Firefox</li>
</ol>


= View the Logging =
== View the Logging ==
# To view the logging, open the [https://developer.mozilla.org/en-US/docs/Tools/Browser_Console Browser Console] from the Tools → Web Developer menu.
# To view the logging, open the [https://developer.mozilla.org/en-US/docs/Tools/Browser_Console '''Browser''' Console] and/or Browser Content Toolbox (for logs related to in-page stuff) from the Tools → Web Developer menu. If you don't see these, follow the instructions on the MDN page to enable it.
# Make sure the "JS" logging options are all enabled in the Browser Console.
#* '''Note that the above consoles are different than the Web Console that you use for regular web development.'''
# Load a web page in in the browser. You should see messages in the Browser Console like:
# Make sure the log level toggles ("Errors", "Warnings", "Logs", …, "Debug") are all enabled in the Browser Console. "CSS" should ideally be disabled.
  Login Manager (content): onFormPassword for <nowiki>https://www.google.com</nowiki>
# Load the problematic web (or about:logins) page in in the browser. You should see messages in the Browser Console like:
  Login Manager: Counting logins matching host: <nowiki>https://www.google.com</nowiki>, formSubmitURL:  httpRealm: null
  LoginManagerContent: onDOMFormHasPassword for <nowiki>https://www.google.com</nowiki>
To copy messages, select the text and copy the usual way e.g. choose Copy from the context menu.
  LoginManager: Counting logins matching host: <nowiki>https://www.google.com</nowiki>, formSubmitURL:  httpRealm: null
All password manager logging contains the string "login" in the prefix so you can type the word "login" in the "Filter output" box of the Browser Console to filter out other content.
 
To copy/save the logs, right-click in an open area of the console and choose "Export visible messages to" and choose "Clipboard" or "File" depending on which you prefer. Include them as an '''attachment''' on your bug report, not in the body of a comment.


= Common Problems =
= Common Problems =


== Won't auto-fill a saved password ==
== Won't auto-fill a saved password ==
[https://support.mozilla.org/en-US/kb/usernames-and-passwords-are-not-saved SUMO article]
Note that '''auto-fill''' refers to the field being filled automatically whereas '''autocomplete''' refers to completing the field value based on what you have typed so far (usually via the autocomplete dropdown).
Note that '''auto-fill''' refers to the field being filled automatically whereas '''autocomplete''' refers to completing the field value based on what you have typed so far (usually via the autocomplete dropdown).
* Some sites use <code>autocomplete="off"</code> in their HTML, which directs the password manager not to autofill/autocomplete the login on page load. You can look for this in the page's HTML, or by using the password manager logging. You may still be able to autofill the password using the autocomplete dropdown on the username field (if one exists). Here's some example output:
* Logins are not auto-filled in '''Private Browsing''' windows. You should still be able to autocomplete the password from the autocomplete dropdown on the username field (if one exists).
* Logins are not auto-filled on insecure <code>http:</code> documents. Make sure all ancestor frames are <code>https:</code>
PwMgr mozStorage: _findLogins: returning 1 logins
* Logins are not auto-filled in sandboxed documents e.g. <code><iframe sandbox></code> or <code>Content-Security-Policy: sandbox;</code>
Login Manager (content): found 1 matching logins.
* If there are multiple username+password combinations saved for a domain and the username field wasn't pre-filled by the website, Firefox won't know which username/password to use and thus won't auto-fill. Use the autocomplete dropdown to choose the username you would like to use.
Login Manager (content): form not filled, has autocomplete=off
* If the page pre-fills a username field (e.g. using your session/local cookies or with a value attribute used as an old hack for placeholder text), Firefox won't fill in a password if the username field value doesn't match the one saved.
Login Manager (content): autocomplete=off but form can be filled; notified observers
* The <code><form></code>'s <code>action</code> attribute is for a different origin than the <code>action</code> origin that the login was saved for.
* The field is <code>disabled</code> or <code>readonly</code>
* Passwords are not auto-filled in '''Private Browsing''' mode. You should still be able to autocomplete the password from the autocomplete dropdown on the username field (if one exists).
* The username or password doesn't fit within the <code>maxlength</code>
* If there are multiple username+password combos saved for a domain and the username field wasn't pre-filled by the website, Firefox won't know which username/password to use and thus won't auto-fill. Use the autocomplete dropdown to choose the username you would like to use.
* The password field for the form has the <code>autocomplete</code> attribute with a value of <code>"new-password"</code>
* If the page pre-fills the username field e.g. using your session or local cookies, Firefox won't fill in the password for a different username.
* There are more than 5 password fields in the "form".
* The login form is loaded into a subframe (e.g. an <code><iframe></code>), and it is cross-origin (i.e. not [https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy same-origin]) with the top level frame.


== HTTP Authentication popup not filled in ==
== HTTP Authentication popup not filled in ==
Line 35: Line 47:
This is often due to the HTTP "Realm" being different from the stored login. The values the password manager is checking can be seen in the logging. Here's some example output from a successful sign in:
This is often due to the HTTP "Realm" being different from the stored login. The values the password manager is checking can be seen in the logging. Here's some example output from a successful sign in:
  …
  …
  Pwmgr Prompter: ===== promptAuth called =====
  LoginManagerPrompter: ===== promptAuth called =====
  Login Manager: Searching for logins matching host: <nowiki>https://intranet.mozilla.org</nowiki>, formSubmitURL: null, httpRealm: Mozilla Corporation - LDAP Login
  LoginManager: Searching for logins matching host: "<nowiki>https://intranet.mozilla.org</nowiki>", formSubmitURL: null, httpRealm: Mozilla Corporation - LDAP Login
  Login Manager: Checking if logins to <nowiki>https://intranet.mozilla.org</nowiki> can be saved.
  LoginManager: Checking if logins to "<nowiki>https://intranet.mozilla.org</nowiki>" can be saved.
  Pwmgr Prompter: Login unchanged, no further action needed.
  LoginManagerPrompter: Login unchanged, no further action needed.
  …
  …
== Won't prompt to save a password ==
Potential reasons for not getting a prompt to save:
* The password is already saved. Check about:logins to see if it's already there
* Make sure "Ask to save logins and passwords for websites." is check in about:preferences#privacy-logins
* Make sure the website isn't in the "Exceptions…" list of about:preferences#privacy-logins
* If you are in a private window, the prompt may be dismissed by default and not pop up automatically.
3

edits