Add notification for aborted popups (fixes #3776)

Pass a new |popup_id| parameter to OnBeforePopup and call a new
OnBeforePopupAborted callback if the popup is aborted before
OnAfterCreated is called for the popup browser. Add new
CefBrowserHost::GetBrowserByIdentifier and GetOpenerIdentifier
methods to assist with retrieval of associated browsers.

In cefclient, clean up state when a popup is aborted and close
any associated popup browsers when the opener browser is closed.
This also works when running with `--use-default-popup`.
This commit is contained in:
Marshall Greenblatt
2024-11-08 19:05:04 -05:00
parent b91be9fcc9
commit 1a99a3abc5
45 changed files with 773 additions and 109 deletions

View File

@@ -1,8 +1,25 @@
diff --git content/browser/renderer_host/render_frame_host_impl.cc content/browser/renderer_host/render_frame_host_impl.cc
index 98c865765c57d..7694cd4516dc9 100644
index 98c865765c57d..f31210f9c3070 100644
--- content/browser/renderer_host/render_frame_host_impl.cc
+++ content/browser/renderer_host/render_frame_host_impl.cc
@@ -11466,6 +11466,7 @@ void RenderFrameHostImpl::CommitNavigation(
@@ -9125,6 +9125,16 @@ void RenderFrameHostImpl::CreateNewWindow(
return;
}
+ callback = base::BindOnce(
+ [](RenderFrameHostImpl* self,
+ CreateNewWindowCallback callback,
+ mojom::CreateNewWindowStatus status,
+ mojom::CreateNewWindowReplyPtr reply) {
+ GetContentClient()->browser()->CreateWindowResult(
+ self, status == mojom::CreateNewWindowStatus::kSuccess);
+ std::move(callback).Run(status, std::move(reply));
+ }, base::Unretained(this), std::move(callback));
+
// Otherwise, consume user activation before we proceed. In particular, it is
// important to do this before we return from the |opener_suppressed| case
// below.
@@ -11466,6 +11476,7 @@ void RenderFrameHostImpl::CommitNavigation(
auto browser_calc_origin_to_commit =
navigation_request->GetOriginToCommitWithDebugInfo();
if (!process_lock.is_error_page() && !is_mhtml_subframe &&