Commit 2c1b3d06 authored by Tao Bai's avatar Tao Bai Committed by Commit Bot

Fix crash caused by the detached iframe

Reproduced the crash locally, but it needs a little bit more work
to write a test, this patch has fix only, following up patch will
add test.

Bug: 792327
Change-Id: I76d8dbc51b84b0aca87f09e162fc97d870881ca9
Reviewed-on: https://chromium-review.googlesource.com/813195Reviewed-by: default avatarMathieu Perreault <mathp@chromium.org>
Reviewed-by: default avatarRoger McFarlane <rogerm@chromium.org>
Commit-Queue: Tao Bai <michaelbai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522459}
parent 7937a29e
...@@ -824,9 +824,20 @@ void AutofillAgent::OnInferredFormSubmission(SubmissionSource source) { ...@@ -824,9 +824,20 @@ void AutofillAgent::OnInferredFormSubmission(SubmissionSource source) {
return; return;
} }
FormData form_data; if (source == SubmissionSource::FRAME_DETACHED) {
if (GetSubmittedForm(&form_data)) { // Should not access the frame because it is now detached. Instead, use
FireHostSubmitEvents(form_data, /*known_success=*/true); // |constructed_form_| or |last_interacted_form_| depending on whether the
// form is formless or not.
if (!last_interacted_form_.IsNull()) {
FireHostSubmitEvents(last_interacted_form_, /*known_success=*/true);
} else if (constructed_form_) {
FireHostSubmitEvents(*constructed_form_, /*known_success=*/true);
}
} else {
FormData form_data;
if (GetSubmittedForm(&form_data)) {
FireHostSubmitEvents(form_data, /*known_success=*/true);
}
} }
ResetLastInteractedElements(); ResetLastInteractedElements();
} }
......
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