alloy: Fix crashes when extensions are disabled (fixes issue #3430)

This commit is contained in:
Marshall Greenblatt
2023-01-05 14:11:56 -05:00
parent b5acaf4520
commit abbf5d2c20
3 changed files with 47 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
diff --git chrome/browser/net/profile_network_context_service.cc chrome/browser/net/profile_network_context_service.cc
index eb8daa2c4d5fe..64f6ac00f4faa 100644
index eb8daa2c4d5fe..254d6e08bffc4 100644
--- chrome/browser/net/profile_network_context_service.cc
+++ chrome/browser/net/profile_network_context_service.cc
@@ -22,6 +22,7 @@
@@ -10,7 +10,18 @@ index eb8daa2c4d5fe..64f6ac00f4faa 100644
#include "chrome/browser/browser_features.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_content_browser_client.h"
@@ -796,7 +797,19 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
@@ -304,7 +305,9 @@ ProfileNetworkContextService::ProfileNetworkContextService(Profile* profile)
base::Unretained(this)));
#if BUILDFLAG(ENABLE_EXTENSIONS)
- registry_observation_.Observe(extensions::ExtensionRegistry::Get(profile_));
+ if (auto extension_registry = extensions::ExtensionRegistry::Get(profile_)) {
+ registry_observation_.Observe(extension_registry);
+ }
#endif
}
@@ -796,7 +799,19 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
// Configure on-disk storage for non-OTR profiles. OTR profiles just use
// default behavior (in memory storage, default sizes).
@@ -31,7 +42,7 @@ index eb8daa2c4d5fe..64f6ac00f4faa 100644
PrefService* local_state = g_browser_process->local_state();
// Configure the HTTP cache path and size.
base::FilePath base_cache_path;
@@ -809,7 +822,9 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
@@ -809,7 +824,9 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
base_cache_path.Append(chrome::kCacheDirname);
network_context_params->http_cache_max_size =
local_state->GetInteger(prefs::kDiskCacheSize);