Skip to content

Commit

Permalink
Fix duplicate open from DevTools when handling OnOpenURLFromTab (fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
magreenblatt committed Jul 11, 2024
1 parent b7a172f commit ed4257c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions patch/patch.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
{
Expand Down
18 changes: 16 additions & 2 deletions patch/patches/chrome_browser_browser.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@
Expand All @@ -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;
}
Expand Down

0 comments on commit ed4257c

Please sign in to comment.