cef/patch/patches/webui_2037.patch

98 lines
4.0 KiB
Diff

diff --git chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc
index 9275f1044c602..b7ced6b57cbf9 100644
--- chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc
+++ chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc
@@ -10,6 +10,7 @@
#include <vector>
#include "base/bind.h"
+#include "base/command_line.h"
#include "base/json/json_string_value_serializer.h"
#include "base/logging.h"
#include "base/path_service.h"
@@ -18,15 +19,18 @@
#include "base/strings/stringprintf.h"
#include "base/system/sys_info.h"
#include "base/task/thread_pool.h"
+#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
+#include "cef/libcef/features/runtime.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/google/google_brand.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/sync/sync_service_factory.h"
#include "chrome/common/channel_info.h"
+#include "chrome/common/chrome_switches.h"
#include "components/prefs/pref_service.h"
#include "components/sync/driver/sync_internals_util.h"
#include "components/sync/driver/sync_service.h"
@@ -332,7 +336,11 @@ void ChromeInternalLogSource::Fetch(SysLogsSourceCallback callback) {
response->emplace(kOsVersionTag, os_version);
#endif
- PopulateSyncLogs(response.get());
+ if (!cef::IsAlloyRuntimeEnabled()) {
+ // Avoid loading ProfileSyncServiceFactory which depends on a lot of
+ // unnecessary Chrome-specific factories.
+ PopulateSyncLogs(response.get());
+ }
PopulateExtensionInfoLogs(response.get());
PopulatePowerApiLogs(response.get());
#if BUILDFLAG(IS_WIN)
@@ -413,6 +421,12 @@ void ChromeInternalLogSource::PopulateExtensionInfoLogs(
if (!profile)
return;
+ // CEF should avoid accessing ExtensionRegistry when extensions are disabled.
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableExtensions)) {
+ return;
+ }
+
extensions::ExtensionRegistry* extension_registry =
extensions::ExtensionRegistry::Get(profile);
std::string extensions_list;
@@ -512,6 +526,8 @@ void ChromeInternalLogSource::PopulateOnboardingTime(
#if BUILDFLAG(IS_WIN)
void ChromeInternalLogSource::PopulateUsbKeyboardDetected(
SystemLogsResponse* response) {
+ // The below call may result in some DLLs being loaded.
+ base::ScopedAllowBlockingForTesting allow_blocking;
std::string reason;
bool result =
base::win::IsKeyboardPresentOnSlate(ui::GetHiddenWindow(), &reason);
diff --git chrome/browser/memory_details.cc chrome/browser/memory_details.cc
index 8eb1f1699728e..ebc105d79372f 100644
--- chrome/browser/memory_details.cc
+++ chrome/browser/memory_details.cc
@@ -8,6 +8,7 @@
#include <set>
#include "base/bind.h"
+#include "base/command_line.h"
#include "base/containers/adapters.h"
#include "base/containers/cxx20_erase.h"
#include "base/file_version_info.h"
@@ -18,6 +19,7 @@
#include "base/task/thread_pool.h"
#include "build/build_config.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/chrome_switches.h"
#include "components/nacl/common/nacl_process_type.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/browser_child_process_host_iterator.h"
@@ -291,7 +293,9 @@ void MemoryDetails::CollectChildInfoOnUIThread() {
// Determine if this is an extension process.
bool process_is_for_extensions = false;
const extensions::ExtensionSet* extension_set = nullptr;
- if (render_process_host) {
+ if (render_process_host &&
+ !base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableExtensions)) {
content::BrowserContext* context =
render_process_host->GetBrowserContext();
extensions::ExtensionRegistry* extension_registry =