Commit 0c22e779 authored by Nick Burris's avatar Nick Burris Committed by Commit Bot

Fix DCHECK in PaymentAppProviderImpl::SetOpenedWindow

The PaymentAppProviderImpl's web contents is not always closed via
PaymentAppProviderImpl::CloseOpenedWindow, e.g. when the bottom sheet UI
is closed the web contents is destroyed. If the PaymentAppProviderImpl
instance then reopens a web contents, we hit the DCHECK in
SetOpenedWindow.

This patch properly resets the payment_handler_window_ pointer even if
the web contents is already closed. Ideally the bottom sheet UI code
should close the web contents via CloseOpenedWindow(), but we don't
currently have any other logic in here so the issue is minimal. This
temporary fix is worthwhile as we often hit this in manual testing.

Bug: 1099270
Change-Id: I377406f385f2250073dacd6b750a948019cea3f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2269792Reviewed-by: default avatarLiquan (Max) Gu <maxlg@chromium.org>
Commit-Queue: Nick Burris <nburris@chromium.org>
Cr-Commit-Position: refs/heads/master@{#784150}
parent 372de0e3
......@@ -1018,10 +1018,14 @@ void PaymentAppProviderImpl::SetOpenedWindow(WebContents* web_contents) {
void PaymentAppProviderImpl::CloseOpenedWindow() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
// TODO(crbug.com/1099270): Fix cases where the web contents has already been
// destroyed without calling this function, e.g. when the bottom sheet UI is
// closed.
if (payment_handler_window_ && payment_handler_window_->web_contents()) {
payment_handler_window_->web_contents()->Close();
payment_handler_window_.reset();
}
payment_handler_window_.reset();
}
void PaymentAppProviderImpl::OnClosingOpenedWindow(
......
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