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

Unified Diff: components/autofill/content/renderer/form_autofill_util.cc

Issue 1946143002: Destroy (Password)AutofillAgent safely (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/autofill/content/renderer/form_autofill_util.cc
diff --git a/components/autofill/content/renderer/form_autofill_util.cc b/components/autofill/content/renderer/form_autofill_util.cc
index cb7947514250d5bbe3f689711c7590b9da959a29..c32ea6ccd511ea456e97111f916726f02afa01b6 100644
--- a/components/autofill/content/renderer/form_autofill_util.cc
+++ b/components/autofill/content/renderer/form_autofill_util.cc
@@ -892,6 +892,10 @@ void FillFormField(const FormFieldData& data,
TruncateString(&value, input_element->maxLength());
}
field->setValue(value, true);
+ // Setting the value might trigger JavaScript, which is capable of
+ // destroying the frame.
+ if (!field->document().frame())
+ return;
robwu 2016/05/04 14:35:38 Are you sure that |field| is still valid? One of t
vabr (Chromium) 2016/05/04 14:49:46 It's refcounted and a reference is held by the cal
}
field->setAutofilled(true);
« no previous file with comments | « components/autofill/content/renderer/autofill_agent.cc ('k') | components/autofill/content/renderer/password_autofill_agent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698