Fix duplicate open from DevTools when handling OnOpenURLFromTab (fixes #3735)

This commit is contained in:
Marshall Greenblatt 2024-07-11 14:19:08 -04:00
parent 499df12b97
commit 34572843ea
2 changed files with 20 additions and 2 deletions

View File

@ -236,6 +236,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',
},
{

View File

@ -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;
}