diff options
author | glen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-30 23:51:39 +0000 |
---|---|---|
committer | glen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-30 23:51:39 +0000 |
commit | f64dcdade2021bf7e6093935fdc3eee5ccd1ecdf (patch) | |
tree | 3d2ba79b3a070362849a8c44783324940ae412d7 /chrome/browser | |
parent | 1057da7cbd8fe6257c667f346001b7e59902ea12 (diff) | |
download | chromium_src-f64dcdade2021bf7e6093935fdc3eee5ccd1ecdf.zip chromium_src-f64dcdade2021bf7e6093935fdc3eee5ccd1ecdf.tar.gz chromium_src-f64dcdade2021bf7e6093935fdc3eee5ccd1ecdf.tar.bz2 |
Fix for HTTP AUTH prompts allowing save-password infobars to be shown after a transition away from the appropriate page while that page was loading.
The issue was the LoginPrompt set up a provisional password save prior to the start of a page load, and DidNavigate is not called early enough when a user navigates, which they have an opportunity to do in the HTTP auth case (details in bug comments).
BUG=2792
Review URL: http://codereview.chromium.org/8647
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4250 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/password_manager.cc | 9 | ||||
-rw-r--r-- | chrome/browser/password_manager.h | 7 | ||||
-rw-r--r-- | chrome/browser/web_contents.cc | 5 |
3 files changed, 14 insertions, 7 deletions
diff --git a/chrome/browser/password_manager.cc b/chrome/browser/password_manager.cc index cd99f82..f046773 100644 --- a/chrome/browser/password_manager.cc +++ b/chrome/browser/password_manager.cc @@ -88,17 +88,16 @@ void PasswordManager::ProvisionallySavePassword(PasswordForm form) { void PasswordManager::DidNavigate() { // As long as this navigation isn't due to a currently pending // password form submit, we're ready to reset and move on. - // Rest assured that if a navigation happens due to a redirect between submit - // and landing at a destination page after successful login we don't mess - // anything up, because either the credentials have already been saved or it - // is now the responsibility of the SavePasswordBar to deal with the lingering - // PasswordFormManager. if (!pending_save_manager_.get() && !pending_login_managers_.empty()) { STLDeleteElements(&pending_login_managers_); pending_login_managers_.clear(); } } +void PasswordManager::ClearProvisionalSave() { + pending_save_manager_.reset(); +} + void PasswordManager::DidStopLoading() { if (!pending_save_manager_.get()) return; diff --git a/chrome/browser/password_manager.h b/chrome/browser/password_manager.h index 7c0613b..ecdac61 100644 --- a/chrome/browser/password_manager.h +++ b/chrome/browser/password_manager.h @@ -37,8 +37,8 @@ class PasswordManager : public views::LoginModel { // Closes any visible password manager UI void CloseBars(); - // Notification that the user initiated a navigation away from the current - // page. Unless this is a password form submission, for our purposes this + // Notification that the user navigated away from the current page. + // Unless this is a password form submission, for our purposes this // means we're done with the current page, so we can clean-up. void DidNavigate(); @@ -54,6 +54,9 @@ class PasswordManager : public views::LoginModel { // of 2 (see SavePassword). void ProvisionallySavePassword(PasswordForm form); + // Clear any pending saves + void ClearProvisionalSave(); + // LoginModel implementation. virtual void SetObserver(views::LoginModelObserver* observer) { observer_ = observer; diff --git a/chrome/browser/web_contents.cc b/chrome/browser/web_contents.cc index 50ec3cd..fe35c73 100644 --- a/chrome/browser/web_contents.cc +++ b/chrome/browser/web_contents.cc @@ -371,6 +371,11 @@ bool WebContents::NavigateToPendingEntry(bool reload) { return false; } + // Clear any provisional password saves - this stops password infobars + // showing up on pages the user navigates to while the right page is + // loading. + GetPasswordManager()->ClearProvisionalSave(); + if (reload && !profile()->IsOffTheRecord()) { HistoryService* history = profile()->GetHistoryService(Profile::IMPLICIT_ACCESS); |