Skip to content

Commit

Permalink
fix: dispatch openExternal event for top level webview navs still
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound committed Aug 26, 2022
1 parent 5852b98 commit d2b55fb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions shell/browser/electron_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1036,8 +1036,13 @@ void HandleExternalProtocolInUI(
return;

content::RenderFrameHost* rfh = document_ptr.AsRenderFrameHostIfValid();
if (!rfh)
return;
if (!rfh) {
// If the render frame host is not valid it means it was a top level
// navigation and the frame has already been disposed of. In this case we
// take the current main frame and declare it responsible for the
// transition.
rfh = web_contents->GetPrimaryMainFrame();
}

GURL escaped_url(base::EscapeExternalHandlerValue(url.spec()));
auto callback = base::BindOnce(&OnOpenExternal, escaped_url);
Expand Down

0 comments on commit d2b55fb

Please sign in to comment.