DescriptionPasswordFormManager 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)
|