Fix crashes loading chrome://system with extensions disabled (issue #2415)

This commit is contained in:
Marshall Greenblatt
2018-03-29 13:58:48 -04:00
parent 7c74b173ae
commit 6d8faa4942

View File

@@ -1,8 +1,16 @@
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 e3a222a90f33..24298a7423f1 100644
index e3a222a90f33..8b909deef05d 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
@@ -164,6 +164,10 @@ void ChromeInternalLogSource::Fetch(SysLogsSourceCallback callback) {
@@ -17,6 +17,7 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/common/channel_info.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "components/browser_sync/profile_sync_service.h"
#include "components/prefs/pref_service.h"
@@ -164,6 +165,10 @@ void ChromeInternalLogSource::Fetch(SysLogsSourceCallback callback) {
}
void ChromeInternalLogSource::PopulateSyncLogs(SystemLogsResponse* response) {
@@ -13,6 +21,44 @@ index e3a222a90f33..24298a7423f1 100644
// We are only interested in sync logs for the primary user profile.
Profile* profile = ProfileManager::GetPrimaryUserProfile();
if (!profile ||
@@ -208,6 +213,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;
diff --git chrome/browser/memory_details.cc chrome/browser/memory_details.cc
index 5ef6e7292f5f..2884102c28e8 100644
--- chrome/browser/memory_details.cc
+++ chrome/browser/memory_details.cc
@@ -16,6 +16,7 @@
#include "base/task_scheduler/post_task.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"
@@ -253,8 +254,11 @@ void MemoryDetails::CollectChildInfoOnUIThread() {
#if BUILDFLAG(ENABLE_EXTENSIONS)
// Determine if this is an extension process.
+ // CEF should avoid accessing ExtensionRegistry when extensions are disabled.
bool process_is_for_extensions = false;
- 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 =
diff --git chrome/browser/ui/webui/net_internals/net_internals_ui.cc chrome/browser/ui/webui/net_internals/net_internals_ui.cc
index 158173bac8eb..26af7ef2e14b 100644
--- chrome/browser/ui/webui/net_internals/net_internals_ui.cc