Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: move FirstPartySets initialization into the browser process #33998

Merged
merged 1 commit into from May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions shell/browser/electron_browser_main_parts.cc
Expand Up @@ -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"
Expand Down Expand Up @@ -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<ElectronExtensionsClient>();
extensions::ExtensionsClient::Set(extensions_client_.get());
Expand Down
6 changes: 0 additions & 6 deletions shell/browser/net/system_network_context_manager.cc
Expand Up @@ -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"
Expand Down Expand Up @@ -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";
Expand Down