From 3f593634258e924e062c15cbadf8c746d84cb2d5 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Wed, 16 Feb 2022 18:23:45 -0500 Subject: [PATCH] chrome: Disable Chrome WebUI factory registration (see issue #3047) Disable the initial Chrome factory registration in ChromeBrowserMainParts so that all WebUI loading goes through CefWebUIControllerFactory. --- patch/patches/chrome_runtime.patch | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/patch/patches/chrome_runtime.patch b/patch/patches/chrome_runtime.patch index 8d7e05870..554356b83 100644 --- a/patch/patches/chrome_runtime.patch +++ b/patch/patches/chrome_runtime.patch @@ -78,7 +78,7 @@ index 132735e3a1200..0d392976799a4 100644 #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) diff --git chrome/browser/chrome_browser_main.cc chrome/browser/chrome_browser_main.cc -index 4e9969d9c5b0b..0e734d8661db0 100644 +index 4e9969d9c5b0b..e599b114f021d 100644 --- chrome/browser/chrome_browser_main.cc +++ chrome/browser/chrome_browser_main.cc @@ -52,6 +52,7 @@ @@ -89,7 +89,21 @@ index 4e9969d9c5b0b..0e734d8661db0 100644 #include "chrome/browser/about_flags.h" #include "chrome/browser/active_use_util.h" #include "chrome/browser/after_startup_task_utils.h" -@@ -1757,11 +1758,14 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { +@@ -1530,11 +1531,13 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { + browser_process_->local_state()); + } + ++#if !BUILDFLAG(ENABLE_CEF) + // Needs to be done before PostProfileInit, since login manager on CrOS is + // called inside PostProfileInit. + content::WebUIControllerFactory::RegisterFactory( + ChromeWebUIControllerFactory::GetInstance()); + ChromeUntrustedWebUIControllerFactory::RegisterInstance(); ++#endif + + #if BUILDFLAG(IS_ANDROID) + page_info::SetPageInfoClient(new ChromePageInfoClient()); +@@ -1757,11 +1760,14 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { // This step is costly and is already measured in // Startup.StartupBrowserCreator_Start. // See the comment above for an explanation of |process_command_line|. @@ -105,7 +119,7 @@ index 4e9969d9c5b0b..0e734d8661db0 100644 // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. #if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) -@@ -1789,8 +1793,10 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { +@@ -1789,8 +1795,10 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { // Create the RunLoop for MainMessageLoopRun() to use and transfer // ownership of the browser's lifetime to the BrowserProcess.