Commit 55a1c50f authored by Ehsan Karamad's avatar Ehsan Karamad Committed by Commit Bot

[ MimeHandlerView ] Reset beforeunload binding

When a new BeforeUnloadControl binding is being bound we should clear the old
binding. It is possible to try to bind an existing binding when the page is
refreshed.

TBR=wjmaclean@chromium.org

Bug: 659750
Change-Id: I1b41deb91e32cf394e9fa9c53de75c69141a8da5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1607503Reviewed-by: default avatarJames MacLean <wjmaclean@chromium.org>
Commit-Queue: Ehsan Karamad <ekaramad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658893}
parent b868215e
...@@ -128,6 +128,10 @@ void MimeHandlerViewContainerManager::CreateBeforeUnloadControl( ...@@ -128,6 +128,10 @@ void MimeHandlerViewContainerManager::CreateBeforeUnloadControl(
if (!post_message_support_) if (!post_message_support_)
post_message_support_ = std::make_unique<PostMessageSupport>(this); post_message_support_ = std::make_unique<PostMessageSupport>(this);
mime_handler::BeforeUnloadControlPtr before_unload_control; mime_handler::BeforeUnloadControlPtr before_unload_control;
if (before_unload_control_binding_.is_bound()) {
// Might happen when reloading the same page.
before_unload_control_binding_.Close();
}
before_unload_control_binding_.Bind( before_unload_control_binding_.Bind(
mojo::MakeRequest(&before_unload_control)); mojo::MakeRequest(&before_unload_control));
std::move(callback).Run(std::move(before_unload_control)); std::move(callback).Run(std::move(before_unload_control));
......
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