cef/patch/patches/rfh_navigation_4829483.patch
Marshall Greenblatt 1a99a3abc5 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`.
2024-11-13 16:24:44 -05:00

30 lines
1.4 KiB
Diff

diff --git content/browser/renderer_host/render_frame_host_impl.cc content/browser/renderer_host/render_frame_host_impl.cc
index 98c865765c57d..f31210f9c3070 100644
--- content/browser/renderer_host/render_frame_host_impl.cc
+++ content/browser/renderer_host/render_frame_host_impl.cc
@@ -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 &&
+ common_params->url.IsStandard() &&
!policy->CanAccessOrigin(
GetProcess()->GetID(), browser_calc_origin_to_commit.first.value(),
ChildProcessSecurityPolicyImpl::AccessType::kCanCommitNewOrigin)) {