Commit a973d4b0 authored by David Black's avatar David Black Committed by Commit Bot

ManagedWebContents should always run callback.

In some situations we may destroy ManagedWebContents before it has run
its callback to indicate contents are ready for embedding. This can
occur, for example, if the user navigates to Assistant Settings and
then closes Assistant UI prior to the contents being loaded.

In such situations we still need to run the callback.

Bug: b:116817905
Change-Id: I9ef8d3bcdd68d31a9cebb49300a6a9b465a85c4c
Reviewed-on: https://chromium-review.googlesource.com/1249078
Commit-Queue: David Black <dmblack@google.com>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595666}
parent 834841e4
...@@ -52,6 +52,13 @@ class ManagedWebContents : public content::WebContentsDelegate, ...@@ -52,6 +52,13 @@ class ManagedWebContents : public content::WebContentsDelegate,
} }
~ManagedWebContents() override { ~ManagedWebContents() override {
// We may be destroying this instance before |callback_| was signaled that
// contents were ready for embedding. In such cases we still need to run the
// callback as it is an error to drop response callbacks which still
// correspond to an open interface pipe.
if (callback_)
std::move(callback_).Run(base::nullopt);
web_contents_->SetDelegate(nullptr); web_contents_->SetDelegate(nullptr);
Observe(nullptr); Observe(nullptr);
......
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