From f77a7a733653a3cb8c288537efefdb5feaf7c2bf Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Fri, 6 Jan 2023 12:06:46 -0500 Subject: [PATCH] alloy: Avoid initialization of privacy sandbox and identity manager (fixes issue #3434, fixes issue #3401) --- patch/patch.cfg | 3 ++ patch/patches/services_network_2622.patch | 49 +++++++++++++++++++++-- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/patch/patch.cfg b/patch/patch.cfg index 7e9816914..f2c01f3cb 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -441,6 +441,9 @@ patches = [ # - Fix cache directory structure ("C:\temp\cache\cache\Cache" should be # "C:\temp\cache\Cache"). # https://bitbucket.org/chromiumembedded/cef/issues/2622 + # + # alloy: Avoid initialization of privacy sandbox and identity manager. + # https://bitbucket.org/chromiumembedded/cef/issues/3434 'name': 'services_network_2622', }, { diff --git a/patch/patches/services_network_2622.patch b/patch/patches/services_network_2622.patch index dd2570671..4e0999890 100644 --- a/patch/patches/services_network_2622.patch +++ b/patch/patches/services_network_2622.patch @@ -1,5 +1,5 @@ diff --git chrome/browser/net/profile_network_context_service.cc chrome/browser/net/profile_network_context_service.cc -index 8221b46c59df3..eca1b2040dd4c 100644 +index 8221b46c59df3..736e703efa276 100644 --- chrome/browser/net/profile_network_context_service.cc +++ chrome/browser/net/profile_network_context_service.cc @@ -22,6 +22,7 @@ @@ -10,7 +10,20 @@ index 8221b46c59df3..eca1b2040dd4c 100644 #include "chrome/browser/browser_features.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_content_browser_client.h" -@@ -304,7 +305,9 @@ ProfileNetworkContextService::ProfileNetworkContextService(Profile* profile) +@@ -263,8 +264,10 @@ ProfileNetworkContextService::ProfileNetworkContextService(Profile* profile) + base::Unretained(this))); + cookie_settings_ = CookieSettingsFactory::GetForProfile(profile); + cookie_settings_observation_.Observe(cookie_settings_.get()); +- privacy_sandbox_settings_observer_.Observe( +- PrivacySandboxSettingsFactory::GetForProfile(profile)); ++ if (!cef::IsAlloyRuntimeEnabled()) { ++ privacy_sandbox_settings_observer_.Observe( ++ PrivacySandboxSettingsFactory::GetForProfile(profile)); ++ } + + DisableQuicIfNotAllowed(); + +@@ -304,7 +307,9 @@ ProfileNetworkContextService::ProfileNetworkContextService(Profile* profile) base::Unretained(this))); #if BUILDFLAG(ENABLE_EXTENSIONS) @@ -21,7 +34,7 @@ index 8221b46c59df3..eca1b2040dd4c 100644 #endif } -@@ -796,7 +799,19 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal( +@@ -796,7 +801,19 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal( // Configure on-disk storage for non-OTR profiles. OTR profiles just use // default behavior (in memory storage, default sizes). @@ -42,7 +55,7 @@ index 8221b46c59df3..eca1b2040dd4c 100644 PrefService* local_state = g_browser_process->local_state(); // Configure the HTTP cache path and size. base::FilePath base_cache_path; -@@ -809,7 +824,9 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal( +@@ -809,7 +826,9 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal( base_cache_path.Append(chrome::kCacheDirname); network_context_params->http_cache_max_size = local_state->GetInteger(prefs::kDiskCacheSize); @@ -52,6 +65,34 @@ index 8221b46c59df3..eca1b2040dd4c 100644 network_context_params->file_paths = ::network::mojom::NetworkContextFilePaths::New(); +@@ -1009,6 +1028,7 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal( + network_context_params->require_network_isolation_key = true; + + network_context_params->block_trust_tokens = ++ cef::IsAlloyRuntimeEnabled() || + !PrivacySandboxSettingsFactory::GetForProfile(profile_) + ->IsTrustTokensAllowed(); + +diff --git chrome/browser/signin/identity_manager_factory.cc chrome/browser/signin/identity_manager_factory.cc +index ff1d5b905b050..911e4b13f91e1 100644 +--- chrome/browser/signin/identity_manager_factory.cc ++++ chrome/browser/signin/identity_manager_factory.cc +@@ -11,6 +11,7 @@ + #include "base/observer_list.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/image_fetcher/image_decoder_impl.h" + #include "chrome/browser/profiles/profile.h" +@@ -82,6 +83,7 @@ IdentityManagerFactory::~IdentityManagerFactory() { + // static + signin::IdentityManager* IdentityManagerFactory::GetForProfile( + Profile* profile) { ++ DCHECK(!cef::IsAlloyRuntimeEnabled()); + return static_cast( + GetInstance()->GetServiceForBrowserContext(profile, true)); + } diff --git net/cookies/cookie_monster.cc net/cookies/cookie_monster.cc index 13911f2bd786d..832308e34a303 100644 --- net/cookies/cookie_monster.cc