From 14f07d7814e3ffd64d18213129ff4a4cfa50e1e1 Mon Sep 17 00:00:00 2001 From: Keeley Hammond Date: Mon, 2 May 2022 08:20:30 -0700 Subject: [PATCH] fix: move FirstPartySets into the browser process (#33998) Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3448551 --- shell/browser/electron_browser_main_parts.cc | 6 ++++++ shell/browser/net/system_network_context_manager.cc | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/shell/browser/electron_browser_main_parts.cc b/shell/browser/electron_browser_main_parts.cc index a03835dd81e0e..defb91ab6e1da 100644 --- a/shell/browser/electron_browser_main_parts.cc +++ b/shell/browser/electron_browser_main_parts.cc @@ -25,6 +25,7 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/device_service.h" +#include "content/public/browser/first_party_sets_handler.h" #include "content/public/browser/web_ui_controller_factory.h" #include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" @@ -416,6 +417,11 @@ int ElectronBrowserMainParts::PreMainMessageLoopRun() { // url::Add*Scheme are not threadsafe, this helps prevent data races. url::LockSchemeRegistries(); + // The First-Party Sets feature always expects to be initialized + // CL: https://chromium-review.googlesource.com/c/chromium/src/+/3448551 + content::FirstPartySetsHandler::GetInstance()->SetPublicFirstPartySets( + base::File()); + #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) extensions_client_ = std::make_unique(); extensions::ExtensionsClient::Set(extensions_client_.get()); diff --git a/shell/browser/net/system_network_context_manager.cc b/shell/browser/net/system_network_context_manager.cc index 552df5c6b2a18..d1f474d59ead7 100644 --- a/shell/browser/net/system_network_context_manager.cc +++ b/shell/browser/net/system_network_context_manager.cc @@ -20,7 +20,6 @@ #include "components/os_crypt/os_crypt.h" #include "components/prefs/pref_service.h" #include "content/public/browser/browser_thread.h" -#include "content/public/browser/first_party_sets_handler.h" #include "content/public/browser/network_service_instance.h" #include "content/public/common/content_features.h" #include "content/public/common/network_service_util.h" @@ -289,11 +288,6 @@ void SystemNetworkContextManager::OnNetworkServiceCreated( base::FeatureList::IsEnabled(features::kAsyncDns), default_secure_dns_mode, doh_config, additional_dns_query_types_enabled); - // Initializes first party sets component - // CL: https://chromium-review.googlesource.com/c/chromium/src/+/3449280 - content::FirstPartySetsHandler::GetInstance()->SetPublicFirstPartySets( - base::File()); - std::string app_name = electron::Browser::Get()->GetName(); #if BUILDFLAG(IS_MAC) KeychainPassword::GetServiceName() = app_name + " Safe Storage";