Commit 7b25846e authored by Olivier Robin's avatar Olivier Robin Committed by Commit Bot

[Autofill iOS] Add guards when accessing iframe.

These methods can be calle asynchronously.
It is necessary to check that the web_frame was not destroyed before
processing it.

Bug: 942427
Change-Id: Icc46dae9193c4fd9ef9612ce47239bd50eef33d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1538194
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
Reviewed-by: default avatarJavier Ernesto Flores Robles <javierrobles@chromium.org>
Reviewed-by: default avatarMoe Ahmadi <mahmadi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#644779}
parent f684eadf
...@@ -90,6 +90,9 @@ void AutofillDriverIOS::SendFormDataToRenderer( ...@@ -90,6 +90,9 @@ void AutofillDriverIOS::SendFormDataToRenderer(
RendererFormDataAction action, RendererFormDataAction action,
const FormData& data) { const FormData& data) {
web::WebFrame* web_frame = web::GetWebFrameWithId(web_state_, web_frame_id_); web::WebFrame* web_frame = web::GetWebFrameWithId(web_state_, web_frame_id_);
if (!web_frame) {
return;
}
[bridge_ fillFormData:data inFrame:web_frame]; [bridge_ fillFormData:data inFrame:web_frame];
} }
...@@ -101,6 +104,9 @@ void AutofillDriverIOS::PropagateAutofillPredictions( ...@@ -101,6 +104,9 @@ void AutofillDriverIOS::PropagateAutofillPredictions(
void AutofillDriverIOS::SendAutofillTypePredictionsToRenderer( void AutofillDriverIOS::SendAutofillTypePredictionsToRenderer(
const std::vector<FormStructure*>& forms) { const std::vector<FormStructure*>& forms) {
web::WebFrame* web_frame = web::GetWebFrameWithId(web_state_, web_frame_id_); web::WebFrame* web_frame = web::GetWebFrameWithId(web_state_, web_frame_id_);
if (!web_frame) {
return;
}
[bridge_ fillFormDataPredictions:FormStructure::GetFieldTypePredictions(forms) [bridge_ fillFormDataPredictions:FormStructure::GetFieldTypePredictions(forms)
inFrame:web_frame]; inFrame:web_frame];
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment