Commit 5f69703e authored by Derek Cheng's avatar Derek Cheng Committed by Commit Bot

[PresentationService] Fix Start/Reconnect callback cleanup behavior.

When the NewPresentationCallbackWrapper is being destroyed, the
mojo callback is invoked to satisfy Mojo. This patch fixes the
PresentationError that it is invoked with to correctly reflect the
fact that the frame is being navigated or destroyed.

Note that this behavior is most likely invisible to the page anyway
since the page is going away when the callback is invoked.

Change-Id: If9428420727d5809f985fff8169fc9d8ed075703
Bug: 
Reviewed-on: https://chromium-review.googlesource.com/595348Reviewed-by: default avatarTakumi Fujimoto <takumif@chromium.org>
Commit-Queue: Derek Cheng <imcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491125}
parent 55cf7de6
......@@ -499,8 +499,12 @@ PresentationServiceImpl::NewPresentationCallbackWrapper::
PresentationServiceImpl::NewPresentationCallbackWrapper::
~NewPresentationCallbackWrapper() {
if (!callback_.is_null())
InvokeNewPresentationCallbackWithError(std::move(callback_));
if (!callback_.is_null()) {
std::move(callback_).Run(
base::nullopt,
PresentationError(PRESENTATION_ERROR_PRESENTATION_REQUEST_CANCELLED,
"The frame is navigating or being destroyed."));
}
}
void PresentationServiceImpl::NewPresentationCallbackWrapper::Run(
......
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