fix: align cookie policy default with Epiphany ITP model
With ITP enabled, WebKit's ACCEPT_NO_THIRD_PARTY policy is silently ignored. Switch the default to CookiePolicyAlways so ITP handles third-party blocking, matching Epiphany's configuration.
- commit
- f8e18204d134fde4f57b1282f6b94fd06c0c6756
- author
- brice · · 2026-03-25 12:48 UTC
- parent
- b3d3030
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
4 files · +8 -8
M internal/infrastructure/config/defaults.go +1 -1
| @@ -147,7 +147,7 @@ func DefaultConfig() *Config { | |||
| 147 | 147 | Profile: ProfileDefault, | |
| 148 | 148 | PoolPrewarmCount: defaultWebViewPoolPrewarmCount, | |
| 149 | 149 | ZoomCacheSize: defaultZoomCacheSize, | |
| 150 | - | CookiePolicy: CookiePolicyNoThirdParty, | |
| 150 | + | CookiePolicy: CookiePolicyAlways, | |
| 151 | 151 | WebKit: WebKitEngineConfig{ | |
| 152 | 152 | ITPEnabled: true, | |
| 153 | 153 | SkiaCPUPaintingThreads: defaultSkiaCPUPaintingThreads, | |
| @@ -147,7 +147,7 @@ func DefaultConfig() *Config { | |||||
| 147 | Profile: ProfileDefault, | 147 | Profile: ProfileDefault, | ||
| 148 | PoolPrewarmCount: defaultWebViewPoolPrewarmCount, | 148 | PoolPrewarmCount: defaultWebViewPoolPrewarmCount, | ||
| 149 | ZoomCacheSize: defaultZoomCacheSize, | 149 | ZoomCacheSize: defaultZoomCacheSize, | ||
| 150 | - | CookiePolicy: CookiePolicyNoThirdParty, | 150 | + | CookiePolicy: CookiePolicyAlways, |
| 151 | WebKit: WebKitEngineConfig{ | 151 | WebKit: WebKitEngineConfig{ | ||
| 152 | ITPEnabled: true, | 152 | ITPEnabled: true, | ||
| 153 | SkiaCPUPaintingThreads: defaultSkiaCPUPaintingThreads, | 153 | SkiaCPUPaintingThreads: defaultSkiaCPUPaintingThreads, | ||
M internal/infrastructure/config/defaults_test.go +1 -1
| @@ -15,7 +15,7 @@ func TestDefaultConfig_CoreDefaults(t *testing.T) { | |||
| 15 | 15 | // Engine defaults (replaces old Performance/Privacy sections) | |
| 16 | 16 | assert.Equal(t, "webkit", cfg.Engine.Type) | |
| 17 | 17 | assert.Equal(t, ProfileDefault, cfg.Engine.Profile) | |
| 18 | - | assert.Equal(t, CookiePolicyNoThirdParty, cfg.Engine.CookiePolicy) | |
| 18 | + | assert.Equal(t, CookiePolicyAlways, cfg.Engine.CookiePolicy) | |
| 19 | 19 | assert.True(t, cfg.Engine.WebKit.ITPEnabled) | |
| 20 | 20 | ||
| 21 | 21 | // Old sections (Rendering, Privacy, Performance, Runtime) have been removed from Config. | |
| @@ -15,7 +15,7 @@ func TestDefaultConfig_CoreDefaults(t *testing.T) { | |||||
| 15 | // Engine defaults (replaces old Performance/Privacy sections) | 15 | // Engine defaults (replaces old Performance/Privacy sections) | ||
| 16 | assert.Equal(t, "webkit", cfg.Engine.Type) | 16 | assert.Equal(t, "webkit", cfg.Engine.Type) | ||
| 17 | assert.Equal(t, ProfileDefault, cfg.Engine.Profile) | 17 | assert.Equal(t, ProfileDefault, cfg.Engine.Profile) | ||
| 18 | - | assert.Equal(t, CookiePolicyNoThirdParty, cfg.Engine.CookiePolicy) | 18 | + | assert.Equal(t, CookiePolicyAlways, cfg.Engine.CookiePolicy) |
| 19 | assert.True(t, cfg.Engine.WebKit.ITPEnabled) | 19 | assert.True(t, cfg.Engine.WebKit.ITPEnabled) | ||
| 20 | 20 | ||||
| 21 | // Old sections (Rendering, Privacy, Performance, Runtime) have been removed from Config. | 21 | // Old sections (Rendering, Privacy, Performance, Runtime) have been removed from Config. | ||
M internal/infrastructure/config/loader.go +4 -4
| @@ -226,14 +226,14 @@ func normalizeEngineConfig(config *Config) { | |||
| 226 | 226 | ||
| 227 | 227 | // Normalize cookie policy (engine) | |
| 228 | 228 | switch strings.ToLower(string(config.Engine.CookiePolicy)) { | |
| 229 | - | case "", string(CookiePolicyNoThirdParty): | |
| 230 | - | config.Engine.CookiePolicy = CookiePolicyNoThirdParty | |
| 231 | - | case string(CookiePolicyAlways): | |
| 229 | + | case "", string(CookiePolicyAlways): | |
| 232 | 230 | config.Engine.CookiePolicy = CookiePolicyAlways | |
| 231 | + | case string(CookiePolicyNoThirdParty): | |
| 232 | + | config.Engine.CookiePolicy = CookiePolicyNoThirdParty | |
| 233 | 233 | case string(CookiePolicyNever): | |
| 234 | 234 | config.Engine.CookiePolicy = CookiePolicyNever | |
| 235 | 235 | default: | |
| 236 | - | config.Engine.CookiePolicy = CookiePolicyNoThirdParty | |
| 236 | + | config.Engine.CookiePolicy = CookiePolicyAlways | |
| 237 | 237 | } | |
| 238 | 238 | ||
| 239 | 239 | // Normalize performance profile (engine) | |
| @@ -226,14 +226,14 @@ func normalizeEngineConfig(config *Config) { | |||||
| 226 | 226 | ||||
| 227 | // Normalize cookie policy (engine) | 227 | // Normalize cookie policy (engine) | ||
| 228 | switch strings.ToLower(string(config.Engine.CookiePolicy)) { | 228 | switch strings.ToLower(string(config.Engine.CookiePolicy)) { | ||
| 229 | - | case "", string(CookiePolicyNoThirdParty): | 229 | + | case "", string(CookiePolicyAlways): |
| 230 | - | config.Engine.CookiePolicy = CookiePolicyNoThirdParty | |||
| 231 | - | case string(CookiePolicyAlways): | |||
| 232 | config.Engine.CookiePolicy = CookiePolicyAlways | 230 | config.Engine.CookiePolicy = CookiePolicyAlways | ||
| 231 | + | case string(CookiePolicyNoThirdParty): | |||
| 232 | + | config.Engine.CookiePolicy = CookiePolicyNoThirdParty | |||
| 233 | case string(CookiePolicyNever): | 233 | case string(CookiePolicyNever): | ||
| 234 | config.Engine.CookiePolicy = CookiePolicyNever | 234 | config.Engine.CookiePolicy = CookiePolicyNever | ||
| 235 | default: | 235 | default: | ||
| 236 | - | config.Engine.CookiePolicy = CookiePolicyNoThirdParty | 236 | + | config.Engine.CookiePolicy = CookiePolicyAlways |
| 237 | } | 237 | } | ||
| 238 | 238 | ||||
| 239 | // Normalize performance profile (engine) | 239 | // Normalize performance profile (engine) | ||
M internal/infrastructure/config/loader_test.go +2 -2
| @@ -14,7 +14,7 @@ func TestSetEngineDefaults(t *testing.T) { | |||
| 14 | 14 | // Universal engine fields | |
| 15 | 15 | assert.Equal(t, "webkit", mgr.viper.GetString("engine.type")) | |
| 16 | 16 | assert.Equal(t, "default", mgr.viper.GetString("engine.profile")) | |
| 17 | - | assert.Equal(t, "no_third_party", mgr.viper.GetString("engine.cookie_policy")) | |
| 17 | + | assert.Equal(t, "always", mgr.viper.GetString("engine.cookie_policy")) | |
| 18 | 18 | assert.Equal(t, 4, mgr.viper.GetInt("engine.pool_prewarm_count")) | |
| 19 | 19 | assert.Equal(t, 256, mgr.viper.GetInt("engine.zoom_cache_size")) | |
| 20 | 20 | ||
| @@ -37,5 +37,5 @@ func TestNormalizeConfig_EngineCookiePolicy(t *testing.T) { | |||
| 37 | 37 | ||
| 38 | 38 | normalizeConfig(cfg) | |
| 39 | 39 | ||
| 40 | - | assert.Equal(t, CookiePolicyNoThirdParty, cfg.Engine.CookiePolicy) | |
| 40 | + | assert.Equal(t, CookiePolicyAlways, cfg.Engine.CookiePolicy) | |
| 41 | 41 | } | |
| @@ -14,7 +14,7 @@ func TestSetEngineDefaults(t *testing.T) { | |||||
| 14 | // Universal engine fields | 14 | // Universal engine fields | ||
| 15 | assert.Equal(t, "webkit", mgr.viper.GetString("engine.type")) | 15 | assert.Equal(t, "webkit", mgr.viper.GetString("engine.type")) | ||
| 16 | assert.Equal(t, "default", mgr.viper.GetString("engine.profile")) | 16 | assert.Equal(t, "default", mgr.viper.GetString("engine.profile")) | ||
| 17 | - | assert.Equal(t, "no_third_party", mgr.viper.GetString("engine.cookie_policy")) | 17 | + | assert.Equal(t, "always", mgr.viper.GetString("engine.cookie_policy")) |
| 18 | assert.Equal(t, 4, mgr.viper.GetInt("engine.pool_prewarm_count")) | 18 | assert.Equal(t, 4, mgr.viper.GetInt("engine.pool_prewarm_count")) | ||
| 19 | assert.Equal(t, 256, mgr.viper.GetInt("engine.zoom_cache_size")) | 19 | assert.Equal(t, 256, mgr.viper.GetInt("engine.zoom_cache_size")) | ||
| 20 | 20 | ||||
| @@ -37,5 +37,5 @@ func TestNormalizeConfig_EngineCookiePolicy(t *testing.T) { | |||||
| 37 | 37 | ||||
| 38 | normalizeConfig(cfg) | 38 | normalizeConfig(cfg) | ||
| 39 | 39 | ||||
| 40 | - | assert.Equal(t, CookiePolicyNoThirdParty, cfg.Engine.CookiePolicy) | 40 | + | assert.Equal(t, CookiePolicyAlways, cfg.Engine.CookiePolicy) |
| 41 | } | 41 | } | ||