mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
alloy: Fix crash when accessing FirstPartySets (fixes #3643)
Initialize FirstPartySets without PrivacySandbox or IdentityManager dependencies.
This commit is contained in:
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include "base/feature_list.h"
|
#include "base/feature_list.h"
|
||||||
#include "chrome/browser/content_settings/cookie_settings_factory.h"
|
#include "chrome/browser/content_settings/cookie_settings_factory.h"
|
||||||
|
#include "chrome/browser/first_party_sets/first_party_sets_policy_service_factory.h"
|
||||||
#include "chrome/browser/media/router/chrome_media_router_factory.h"
|
#include "chrome/browser/media/router/chrome_media_router_factory.h"
|
||||||
#include "chrome/browser/media/webrtc/media_device_salt_service_factory.h"
|
#include "chrome/browser/media/webrtc/media_device_salt_service_factory.h"
|
||||||
#include "chrome/browser/plugins/plugin_prefs_factory.h"
|
#include "chrome/browser/plugins/plugin_prefs_factory.h"
|
||||||
@ -25,6 +26,7 @@ namespace cef {
|
|||||||
|
|
||||||
void EnsureBrowserContextKeyedServiceFactoriesBuilt() {
|
void EnsureBrowserContextKeyedServiceFactoriesBuilt() {
|
||||||
CookieSettingsFactory::GetInstance();
|
CookieSettingsFactory::GetInstance();
|
||||||
|
first_party_sets::FirstPartySetsPolicyServiceFactory::GetInstance();
|
||||||
MediaDeviceSaltServiceFactory::GetInstance();
|
MediaDeviceSaltServiceFactory::GetInstance();
|
||||||
media_router::ChromeMediaRouterFactory::GetInstance();
|
media_router::ChromeMediaRouterFactory::GetInstance();
|
||||||
PluginPrefsFactory::GetInstance();
|
PluginPrefsFactory::GetInstance();
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
#include "chrome/browser/accessibility/accessibility_ui.h"
|
#include "chrome/browser/accessibility/accessibility_ui.h"
|
||||||
#include "chrome/browser/download/download_prefs.h"
|
#include "chrome/browser/download/download_prefs.h"
|
||||||
#include "chrome/browser/first_party_sets/first_party_sets_pref_names.h"
|
|
||||||
#include "chrome/browser/media/router/discovery/access_code/access_code_cast_feature.h"
|
#include "chrome/browser/media/router/discovery/access_code/access_code_cast_feature.h"
|
||||||
#include "chrome/browser/media/router/media_router_feature.h"
|
#include "chrome/browser/media/router/media_router_feature.h"
|
||||||
#include "chrome/browser/media/webrtc/permission_bubble_media_access_handler.h"
|
#include "chrome/browser/media/webrtc/permission_bubble_media_access_handler.h"
|
||||||
@ -346,11 +345,6 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
|||||||
}
|
}
|
||||||
registry->RegisterListPref(prefs::kWebRtcLocalIpsAllowedUrls);
|
registry->RegisterListPref(prefs::kWebRtcLocalIpsAllowedUrls);
|
||||||
|
|
||||||
// First party sets preferences.
|
|
||||||
// Based on FirstPartySetsPolicyServiceFactory::RegisterProfilePrefs.
|
|
||||||
registry->RegisterDictionaryPref(
|
|
||||||
first_party_sets::kRelatedWebsiteSetsOverrides);
|
|
||||||
|
|
||||||
// Always do this after all other profile prefs.
|
// Always do this after all other profile prefs.
|
||||||
RegisterProfilePrefs(registry.get());
|
RegisterProfilePrefs(registry.get());
|
||||||
} else {
|
} else {
|
||||||
|
@ -463,9 +463,8 @@ patches = [
|
|||||||
# "C:\temp\cache\Cache").
|
# "C:\temp\cache\Cache").
|
||||||
# https://github.com/chromiumembedded/cef/issues/2622
|
# https://github.com/chromiumembedded/cef/issues/2622
|
||||||
#
|
#
|
||||||
# alloy: Avoid initialization of privacy sandbox, identity manager and
|
# alloy: Avoid initialization of privacy sandbox and identity manager.
|
||||||
# first party sets policy.
|
# https://github.com/chromiumembedded/cef/issues/3643
|
||||||
# https://github.com/chromiumembedded/cef/issues/3434
|
|
||||||
'name': 'services_network_2622',
|
'name': 'services_network_2622',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -20,8 +20,25 @@ index 101044d12aa89..795fb5f2d0738 100644
|
|||||||
auto* service = ConnectorsServiceFactory::GetForBrowserContext(profile);
|
auto* service = ConnectorsServiceFactory::GetForBrowserContext(profile);
|
||||||
// If the corresponding Connector policy isn't set, don't perform scans.
|
// If the corresponding Connector policy isn't set, don't perform scans.
|
||||||
if (!service || !service->IsConnectorEnabled(connector))
|
if (!service || !service->IsConnectorEnabled(connector))
|
||||||
|
diff --git chrome/browser/first_party_sets/first_party_sets_policy_service.cc chrome/browser/first_party_sets/first_party_sets_policy_service.cc
|
||||||
|
index 0509dabf8f421..35a0046a03c6c 100644
|
||||||
|
--- chrome/browser/first_party_sets/first_party_sets_policy_service.cc
|
||||||
|
+++ chrome/browser/first_party_sets/first_party_sets_policy_service.cc
|
||||||
|
@@ -275,6 +275,12 @@ void FirstPartySetsPolicyService::OnProfileConfigReady(
|
||||||
|
|
||||||
|
// Representation of the current profile to be persisted on disk.
|
||||||
|
const std::string browser_context_id = profile->GetBaseName().AsUTF8Unsafe();
|
||||||
|
+ if (browser_context_id.empty()) {
|
||||||
|
+ // CEF/Alloy incognito profiles have empty cache path.
|
||||||
|
+ OnReadyToNotifyDelegates(std::move(config),
|
||||||
|
+ net::FirstPartySetsCacheFilter());
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
base::RepeatingCallback<content::BrowserContext*()> browser_context_getter =
|
||||||
|
base::BindRepeating(
|
||||||
diff --git chrome/browser/net/profile_network_context_service.cc chrome/browser/net/profile_network_context_service.cc
|
diff --git chrome/browser/net/profile_network_context_service.cc chrome/browser/net/profile_network_context_service.cc
|
||||||
index 62d54608cfe39..b0c5e3970de03 100644
|
index 62d54608cfe39..f6edd65789aa2 100644
|
||||||
--- chrome/browser/net/profile_network_context_service.cc
|
--- chrome/browser/net/profile_network_context_service.cc
|
||||||
+++ chrome/browser/net/profile_network_context_service.cc
|
+++ chrome/browser/net/profile_network_context_service.cc
|
||||||
@@ -23,6 +23,7 @@
|
@@ -23,6 +23,7 @@
|
||||||
@ -45,17 +62,7 @@ index 62d54608cfe39..b0c5e3970de03 100644
|
|||||||
|
|
||||||
DisableQuicIfNotAllowed();
|
DisableQuicIfNotAllowed();
|
||||||
|
|
||||||
@@ -468,6 +471,9 @@ void ProfileNetworkContextService::OnTruncatedCookieBlockingChanged() {
|
@@ -913,9 +916,26 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
|
||||||
|
|
||||||
void ProfileNetworkContextService::OnFirstPartySetsEnabledChanged(
|
|
||||||
bool enabled) {
|
|
||||||
+ if (cef::IsAlloyRuntimeEnabled()) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
// Update all FPS Access Delegates on the FPS service to be `enabled`.
|
|
||||||
first_party_sets::FirstPartySetsPolicyServiceFactory::GetForBrowserContext(
|
|
||||||
profile_)
|
|
||||||
@@ -913,9 +919,26 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
|
|
||||||
network_context_params->cookie_manager_params =
|
network_context_params->cookie_manager_params =
|
||||||
CreateCookieManagerParams(profile_, *cookie_settings_);
|
CreateCookieManagerParams(profile_, *cookie_settings_);
|
||||||
|
|
||||||
@ -83,7 +90,7 @@ index 62d54608cfe39..b0c5e3970de03 100644
|
|||||||
PrefService* local_state = g_browser_process->local_state();
|
PrefService* local_state = g_browser_process->local_state();
|
||||||
// Configure the HTTP cache path and size.
|
// Configure the HTTP cache path and size.
|
||||||
base::FilePath base_cache_path;
|
base::FilePath base_cache_path;
|
||||||
@@ -924,15 +947,14 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
|
@@ -924,15 +944,14 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
|
||||||
local_state->GetFilePath(prefs::kDiskCacheDir);
|
local_state->GetFilePath(prefs::kDiskCacheDir);
|
||||||
if (!disk_cache_dir.empty())
|
if (!disk_cache_dir.empty())
|
||||||
base_cache_path = disk_cache_dir.Append(base_cache_path.BaseName());
|
base_cache_path = disk_cache_dir.Append(base_cache_path.BaseName());
|
||||||
@ -103,24 +110,16 @@ index 62d54608cfe39..b0c5e3970de03 100644
|
|||||||
network_context_params->file_paths->data_directory =
|
network_context_params->file_paths->data_directory =
|
||||||
path.Append(chrome::kNetworkDataDirname);
|
path.Append(chrome::kNetworkDataDirname);
|
||||||
network_context_params->file_paths->unsandboxed_data_path = path;
|
network_context_params->file_paths->unsandboxed_data_path = path;
|
||||||
@@ -1104,6 +1126,7 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
|
@@ -1107,6 +1126,7 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
|
||||||
network_context_params->block_trust_tokens =
|
|
||||||
anti_abuse_content_setting == CONTENT_SETTING_BLOCK;
|
|
||||||
|
|
||||||
+ if (!cef::IsAlloyRuntimeEnabled()) {
|
|
||||||
network_context_params->first_party_sets_access_delegate_params =
|
network_context_params->first_party_sets_access_delegate_params =
|
||||||
network::mojom::FirstPartySetsAccessDelegateParams::New();
|
network::mojom::FirstPartySetsAccessDelegateParams::New();
|
||||||
network_context_params->first_party_sets_access_delegate_params->enabled =
|
network_context_params->first_party_sets_access_delegate_params->enabled =
|
||||||
@@ -1120,6 +1143,7 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
|
+ cef::IsAlloyRuntimeEnabled() ? false :
|
||||||
GetForBrowserContext(profile_);
|
PrivacySandboxSettingsFactory::GetForProfile(profile_)
|
||||||
DCHECK(fps_service);
|
->AreRelatedWebsiteSetsEnabled();
|
||||||
fps_service->AddRemoteAccessDelegate(std::move(fps_access_delegate_remote));
|
|
||||||
+ }
|
|
||||||
|
|
||||||
network_context_params->acam_preflight_spec_conformant =
|
|
||||||
profile_->GetPrefs()->GetBoolean(
|
|
||||||
diff --git chrome/browser/net/profile_network_context_service_factory.cc chrome/browser/net/profile_network_context_service_factory.cc
|
diff --git chrome/browser/net/profile_network_context_service_factory.cc chrome/browser/net/profile_network_context_service_factory.cc
|
||||||
index 14ac2ce8b90c5..99297094beea2 100644
|
index 14ac2ce8b90c5..66431eface762 100644
|
||||||
--- chrome/browser/net/profile_network_context_service_factory.cc
|
--- chrome/browser/net/profile_network_context_service_factory.cc
|
||||||
+++ chrome/browser/net/profile_network_context_service_factory.cc
|
+++ chrome/browser/net/profile_network_context_service_factory.cc
|
||||||
@@ -6,6 +6,7 @@
|
@@ -6,6 +6,7 @@
|
||||||
@ -131,18 +130,16 @@ index 14ac2ce8b90c5..99297094beea2 100644
|
|||||||
#include "chrome/browser/first_party_sets/first_party_sets_policy_service_factory.h"
|
#include "chrome/browser/first_party_sets/first_party_sets_policy_service_factory.h"
|
||||||
#include "chrome/browser/net/profile_network_context_service.h"
|
#include "chrome/browser/net/profile_network_context_service.h"
|
||||||
#include "chrome/browser/privacy_sandbox/privacy_sandbox_settings_factory.h"
|
#include "chrome/browser/privacy_sandbox/privacy_sandbox_settings_factory.h"
|
||||||
@@ -53,9 +54,11 @@ ProfileNetworkContextServiceFactory::ProfileNetworkContextServiceFactory()
|
@@ -53,7 +54,9 @@ ProfileNetworkContextServiceFactory::ProfileNetworkContextServiceFactory()
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||||
DependsOn(chromeos::CertificateProviderServiceFactory::GetInstance());
|
DependsOn(chromeos::CertificateProviderServiceFactory::GetInstance());
|
||||||
#endif
|
#endif
|
||||||
+ if (!cef::IsAlloyRuntimeEnabled()) {
|
+ if (!cef::IsAlloyRuntimeEnabled()) {
|
||||||
DependsOn(PrivacySandboxSettingsFactory::GetInstance());
|
DependsOn(PrivacySandboxSettingsFactory::GetInstance());
|
||||||
|
+ }
|
||||||
DependsOn(
|
DependsOn(
|
||||||
first_party_sets::FirstPartySetsPolicyServiceFactory::GetInstance());
|
first_party_sets::FirstPartySetsPolicyServiceFactory::GetInstance());
|
||||||
+ }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfileNetworkContextServiceFactory::~ProfileNetworkContextServiceFactory() =
|
|
||||||
diff --git chrome/browser/signin/identity_manager_factory.cc chrome/browser/signin/identity_manager_factory.cc
|
diff --git chrome/browser/signin/identity_manager_factory.cc chrome/browser/signin/identity_manager_factory.cc
|
||||||
index 77522f65b7b6e..51cc2d60d4b8d 100644
|
index 77522f65b7b6e..51cc2d60d4b8d 100644
|
||||||
--- chrome/browser/signin/identity_manager_factory.cc
|
--- chrome/browser/signin/identity_manager_factory.cc
|
||||||
|
Reference in New Issue
Block a user