Commit 596758c7 authored by Kurt Horimoto's avatar Kurt Horimoto Committed by Commit Bot

[iOS] Don't call CanShowUIForRequest() if there's no active request.

When the Browser is destroyed, all OverlayRequests are cancelled.
However, if there is a presented overlay, |presenting_| will still be
true.  The active request is moved from the WebState to the
|removed_request_awaiting_dismissal_| variable until it is finished
being dismissed.

This CL checks that the active request is non-null before checking
whether the presentation context is capable of presenting its UI with
its new capabilities.  Additionally, the cancelled request is
destroyed when the Browser is destroyed so that its completion
callback can be executed.

Bug: 1065564
Change-Id: I12f4ae9b2d6090b631590a18d0314d2175822490
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2135153
Commit-Queue: Kurt Horimoto <kkhorimoto@chromium.org>
Auto-Submit: Kurt Horimoto <kkhorimoto@chromium.org>
Reviewed-by: default avatarMike Dougherty <michaeldo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#757601}
parent b3e7ce0f
......@@ -331,6 +331,7 @@ void OverlayPresenterImpl::BrowserDestroyed(Browser* browser) {
}
web_state_list_->RemoveObserver(this);
web_state_list_ = nullptr;
removed_request_awaiting_dismissal_ = nullptr;
browser->RemoveObserver(this);
}
......@@ -399,7 +400,7 @@ void OverlayPresenterImpl::
// Hide the presented overlay UI if the presentation context is transitioning
// to a state where that UI is not supported.
OverlayRequest* request = GetActiveRequest();
if (presenting_ &&
if (request && presenting_ &&
!presentation_context->CanShowUIForRequest(request, capabilities)) {
presentation_context_->HideOverlayUI(GetActiveRequest());
}
......
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