From ed4257c807b2decaf5e6f2dc89665e9e0351c144 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Thu, 11 Jul 2024 14:13:40 -0400 Subject: [PATCH] Fix duplicate open from DevTools when handling OnOpenURLFromTab (fixes #3735) --- patch/patch.cfg | 4 ++++ patch/patches/chrome_browser_browser.patch | 18 ++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/patch/patch.cfg b/patch/patch.cfg index 453333f1b..d0eea34f4 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -226,6 +226,10 @@ patches = [ # # Linux: Fix duplicate symbol error for window_frame_util.cc # https://issuetracker.google.com/issues/343037853#comment3 + # + # Avoid duplicate window from DevTools when CEF handles the open via + # OnOpenURLFromTab. + # https://github.com/chromiumembedded/cef/issues/3735 'name': 'chrome_browser_browser', }, { diff --git a/patch/patches/chrome_browser_browser.patch b/patch/patches/chrome_browser_browser.patch index dba6263b3..4d772a54e 100644 --- a/patch/patches/chrome_browser_browser.patch +++ b/patch/patches/chrome_browser_browser.patch @@ -13,7 +13,7 @@ index 2480282a19d12..dbd1fbf8a15b5 100644 return false; } diff --git chrome/browser/devtools/devtools_window.cc chrome/browser/devtools/devtools_window.cc -index 02ff1e580d3a7..7f51115896049 100644 +index 02ff1e580d3a7..e2e232c424029 100644 --- chrome/browser/devtools/devtools_window.cc +++ chrome/browser/devtools/devtools_window.cc @@ -37,6 +37,7 @@ @@ -38,7 +38,21 @@ index 02ff1e580d3a7..7f51115896049 100644 } // Create WebContents with devtools. -@@ -1919,12 +1927,28 @@ void DevToolsWindow::CreateDevToolsBrowser() { +@@ -1754,9 +1762,13 @@ void DevToolsWindow::OpenInNewTab(const GURL& url) { + if (!inspected_web_contents || + !inspected_web_contents->OpenURL(params, + /*navigation_handle_callback=*/{})) { ++#if !BUILDFLAG(ENABLE_CEF) ++ // Remove default behavior when CEF handles the open via OnOpenURLFromTab. ++ // See CEF issue #3735. + chrome::ScopedTabbedBrowserDisplayer displayer(profile_); + chrome::AddSelectedTabWithURL(displayer.browser(), fixed_url, + ui::PAGE_TRANSITION_LINK); ++#endif + } + } + +@@ -1919,12 +1931,28 @@ void DevToolsWindow::CreateDevToolsBrowser() { Browser::CreationStatus::kOk) { return; }