Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Issue 786823002: PasswordFormManager takes WeakPtr<PasswordManagerDriver> (Closed)

Created:
6 years ago by vabr (Chromium)
Modified:
6 years ago
Reviewers:
Evan Stade
CC:
chromium-reviews, gcasto+watchlist_chromium.org, mkwst+watchlist-passwords_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

PasswordFormManager takes WeakPtr<PasswordManagerDriver> PFM instances are owned by PasswordManager, which lives as long as a WebContents does. Drivers associated to PFMs are bound to frames. PasswordManager keeps PFMs alive until the main frame navigation, and even longer (if they carry the provisionally saved password). This means that a PFM can outlive the associated driver. On its creation, the PFM calls the PasswordStore to get the stored credentials. While PFM lives on the UI thread, the store works on DB thread, and the results are returned asynchronously. The PFM normally uses the services of the driver to process the obtained results. If the results come later than the frame and driver were deleted, this leads to use-after-free. Also, if the frame is already deleted, there is no harm in skipping the work done by driver on the results, because that is always bound to operations on the frame, like (auto)filling. Therefore, this CL makes PFM hold a WeakPtr (instead of a naked pointer) to the driver, and check before each use its validity. BUG=439534 Committed: https://crrev.com/8a62de58cfbf91ec21c769723bb54e111bd0dadf Cr-Commit-Position: refs/heads/master@{#307461}

Patch Set 1 : #

Patch Set 2 : Fixed test compilation #

Total comments: 4

Patch Set 3 : SupportsWeakPtr #

Messages

Total messages: 10 (3 generated)
vabr (Chromium)
Hi Evan, Could you please take a look? Thanks! Vaclav
6 years ago (2014-12-08 19:12:01 UTC) #3
Evan Stade
https://codereview.chromium.org/786823002/diff/40001/components/password_manager/core/browser/password_form_manager.cc File components/password_manager/core/browser/password_form_manager.cc (right): https://codereview.chromium.org/786823002/diff/40001/components/password_manager/core/browser/password_form_manager.cc#newcode536 components/password_manager/core/browser/password_form_manager.cc:536: if (driver_) { move this up to ~L521 for ...
6 years ago (2014-12-08 20:02:50 UTC) #4
Evan Stade
aside from those two issues, lgtm
6 years ago (2014-12-08 20:03:04 UTC) #5
vabr (Chromium)
Thanks, Evan! Both comments addressed, so sending to CQ. Cheers, Vaclav https://codereview.chromium.org/786823002/diff/40001/components/password_manager/core/browser/password_form_manager.cc File components/password_manager/core/browser/password_form_manager.cc (right): ...
6 years ago (2014-12-09 12:55:46 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/786823002/60001
6 years ago (2014-12-09 12:56:48 UTC) #8
commit-bot: I haz the power
Committed patchset #3 (id:60001)
6 years ago (2014-12-09 13:37:54 UTC) #9
commit-bot: I haz the power
6 years ago (2014-12-09 13:39:01 UTC) #10
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/8a62de58cfbf91ec21c769723bb54e111bd0dadf
Cr-Commit-Position: refs/heads/master@{#307461}

Powered by Google App Engine
This is Rietveld 408576698