diff --git a/mobile/android/app/mobile.js b/mobile/android/app/mobile.js index 2f9d13d9ed0e..312badc742fc 100644 --- a/mobile/android/app/mobile.js +++ b/mobile/android/app/mobile.js @@ -172,6 +172,7 @@ pref("browser.helperApps.deleteTempFileOnExit", false); /* password manager */ pref("signon.rememberSignons", true); +pref("signon.autofillForms.http", true); pref("signon.expireMasterPassword", false); pref("signon.debug", false); diff --git a/toolkit/components/satchel/nsFormFillController.cpp b/toolkit/components/satchel/nsFormFillController.cpp index 2a051e464a49..fa55ffa586e8 100644 --- a/toolkit/components/satchel/nsFormFillController.cpp +++ b/toolkit/components/satchel/nsFormFillController.cpp @@ -291,7 +291,6 @@ nsFormFillController::MarkAsLoginManagerField(nsIDOMHTMLInputElement *aInput) if (!mFocusedInput) { MaybeStartControllingInput(input); } - ShowPopup(); } } @@ -706,6 +705,7 @@ nsFormFillController::StartSearch(const nsAString &aSearchString, const nsAStrin // If the login manager has indicated it's responsible for this field, let it // handle the autocomplete. Otherwise, handle with form history. + // This method is sometimes called in unit tests and from XUL without a focused node. if (mFocusedInputNode && (mPwmgrInputs.Get(mFocusedInputNode) || formControl->GetType() == NS_FORM_INPUT_PASSWORD)) { @@ -715,6 +715,10 @@ nsFormFillController::StartSearch(const nsAString &aSearchString, const nsAStrin mLoginManager = do_GetService("@mozilla.org/login-manager;1"); } + if (NS_WARN_IF(!mLoginManager)) { + return NS_ERROR_FAILURE; + } + // XXX aPreviousResult shouldn't ever be a historyResult type, since we're not letting // satchel manage the field? mLastListener = aListener; @@ -992,8 +996,10 @@ nsFormFillController::MaybeStartControllingInput(nsIDOMHTMLInputElement* aInput) bool hasList = datalist != nullptr; bool isPwmgrInput = false; - if (mPwmgrInputs.Get(inputNode)) - isPwmgrInput = true; + if (mPwmgrInputs.Get(inputNode) || + formControl->GetType() == NS_FORM_INPUT_PASSWORD) { + isPwmgrInput = true; + } if (isPwmgrInput || hasList || autocomplete) { StartControllingInput(aInput); @@ -1013,19 +1019,17 @@ nsFormFillController::Focus(nsIDOMEvent* aEvent) return NS_OK; } +#ifndef ANDROID nsCOMPtr formControl = do_QueryInterface(mFocusedInputNode); MOZ_ASSERT(formControl); // If this focus doesn't immediately follow a contextmenu event then show - // the autocomplete popup - if (!mContextMenuFiredBeforeFocus && - (mPwmgrInputs.Get(mFocusedInputNode) -#ifndef ANDROID - || formControl->GetType() == NS_FORM_INPUT_PASSWORD -#endif - )) { + // the autocomplete popup for all password fields. + if (!mContextMenuFiredBeforeFocus + && formControl->GetType() == NS_FORM_INPUT_PASSWORD) { ShowPopup(); } +#endif mContextMenuFiredBeforeFocus = false; return NS_OK;