mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-19 09:25:34 +00:00
[fenix] Closes https://github.com/mozilla-mobile/fenix/issues/26858: Remove unused nimbus engine-settings total-cookie-protection-enabled feature.
This commit is contained in:
parent
20e15ac7f3
commit
6db2c727ec
@ -7,9 +7,6 @@ engine-settings:
|
|||||||
tabs-prioritization-enabled:
|
tabs-prioritization-enabled:
|
||||||
type: boolean
|
type: boolean
|
||||||
description: "If true, enables tabs prioritization feature."
|
description: "If true, enables tabs prioritization feature."
|
||||||
total-cookie-protection-enabled:
|
|
||||||
type: boolean
|
|
||||||
description: "If true, enables the total cookie protection in all browsing modes."
|
|
||||||
homescreen:
|
homescreen:
|
||||||
description: The homescreen that the user goes to when they press home or new tab.
|
description: The homescreen that the user goes to when they press home or new tab.
|
||||||
hasExposure: true
|
hasExposure: true
|
||||||
|
@ -5,10 +5,8 @@
|
|||||||
package org.mozilla.fenix.components
|
package org.mozilla.fenix.components
|
||||||
|
|
||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import androidx.annotation.VisibleForTesting
|
|
||||||
import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy
|
import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy
|
||||||
import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy.CookiePolicy
|
import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy.CookiePolicy
|
||||||
import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicyForSessionTypes
|
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
import org.mozilla.fenix.utils.Settings
|
import org.mozilla.fenix.utils.Settings
|
||||||
|
|
||||||
@ -42,22 +40,16 @@ class TrackingProtectionPolicyFactory(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return when {
|
return when {
|
||||||
normalMode && privateMode -> trackingProtectionPolicy.applyTCPIfNeeded(settings)
|
normalMode && privateMode -> trackingProtectionPolicy
|
||||||
normalMode && !privateMode -> trackingProtectionPolicy.applyTCPIfNeeded(settings).forRegularSessionsOnly()
|
normalMode && !privateMode -> trackingProtectionPolicy.forRegularSessionsOnly()
|
||||||
!normalMode && privateMode -> trackingProtectionPolicy.applyTCPIfNeeded(settings).forPrivateSessionsOnly()
|
!normalMode && privateMode -> trackingProtectionPolicy.forPrivateSessionsOnly()
|
||||||
else -> TrackingProtectionPolicy.none()
|
else -> TrackingProtectionPolicy.none()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createCustomTrackingProtectionPolicy(): TrackingProtectionPolicy {
|
private fun createCustomTrackingProtectionPolicy(): TrackingProtectionPolicy {
|
||||||
val cookiePolicy = if (settings.enabledTotalCookieProtection) {
|
|
||||||
CookiePolicy.ACCEPT_FIRST_PARTY_AND_ISOLATE_OTHERS
|
|
||||||
} else {
|
|
||||||
getCustomCookiePolicy()
|
|
||||||
}
|
|
||||||
|
|
||||||
return TrackingProtectionPolicy.select(
|
return TrackingProtectionPolicy.select(
|
||||||
cookiePolicy = cookiePolicy,
|
cookiePolicy = getCustomCookiePolicy(),
|
||||||
trackingCategories = getCustomTrackingCategories(),
|
trackingCategories = getCustomTrackingCategories(),
|
||||||
cookiePurging = getCustomCookiePurgingPolicy()
|
cookiePurging = getCustomCookiePurgingPolicy()
|
||||||
).let {
|
).let {
|
||||||
@ -111,20 +103,3 @@ class TrackingProtectionPolicyFactory(
|
|||||||
return settings.blockRedirectTrackersInCustomTrackingProtection
|
return settings.blockRedirectTrackersInCustomTrackingProtection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
|
||||||
internal fun TrackingProtectionPolicyForSessionTypes.applyTCPIfNeeded(settings: Settings):
|
|
||||||
TrackingProtectionPolicyForSessionTypes {
|
|
||||||
val updatedCookiePolicy = if (settings.enabledTotalCookieProtection) {
|
|
||||||
CookiePolicy.ACCEPT_FIRST_PARTY_AND_ISOLATE_OTHERS
|
|
||||||
} else {
|
|
||||||
cookiePolicy
|
|
||||||
}
|
|
||||||
|
|
||||||
return TrackingProtectionPolicy.select(
|
|
||||||
trackingCategories = trackingCategories,
|
|
||||||
cookiePolicy = updatedCookiePolicy,
|
|
||||||
strictSocialTrackingProtection = strictSocialTrackingProtection,
|
|
||||||
cookiePurging = cookiePurging
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
@ -584,9 +584,6 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
|||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
val enabledTotalCookieProtection: Boolean
|
|
||||||
get() = mr2022Sections[Mr2022Section.TCP_FEATURE] == true
|
|
||||||
|
|
||||||
val enabledTotalCookieProtectionSetting: Boolean
|
val enabledTotalCookieProtectionSetting: Boolean
|
||||||
get() = mr2022Sections[Mr2022Section.TCP_FEATURE] == true
|
get() = mr2022Sections[Mr2022Section.TCP_FEATURE] == true
|
||||||
|
|
||||||
|
@ -137,44 +137,6 @@ class TrackingProtectionPolicyFactoryTest {
|
|||||||
expected.assertPolicyEquals(always, checkPrivacy = false)
|
expected.assertPolicyEquals(always, checkPrivacy = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
fun `GIVEN TCP is enabled by nimbus WHEN applyTCPIfNeeded THEN cookie policy should be TCP`() {
|
|
||||||
val settings: Settings = mockk(relaxed = true)
|
|
||||||
every { settings.enabledTotalCookieProtection } returns true
|
|
||||||
|
|
||||||
val policies = arrayOf(
|
|
||||||
TrackingProtectionPolicy.strict(), TrackingProtectionPolicy.recommended(),
|
|
||||||
TrackingProtectionPolicy.select()
|
|
||||||
)
|
|
||||||
|
|
||||||
for (policy in policies) {
|
|
||||||
val adaptedPolicy = policy.applyTCPIfNeeded(settings)
|
|
||||||
assertEquals(
|
|
||||||
CookiePolicy.ACCEPT_FIRST_PARTY_AND_ISOLATE_OTHERS,
|
|
||||||
adaptedPolicy.cookiePolicy
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun `GIVEN TCP is NOT enabled by nimbus WHEN applyTCPIfNeeded THEN reuse cookie policy`() {
|
|
||||||
val settings: Settings = mockk(relaxed = true)
|
|
||||||
|
|
||||||
every { settings.enabledTotalCookieProtection } returns false
|
|
||||||
|
|
||||||
val policies = arrayOf(
|
|
||||||
TrackingProtectionPolicy.strict(), TrackingProtectionPolicy.recommended(),
|
|
||||||
TrackingProtectionPolicy.select()
|
|
||||||
)
|
|
||||||
|
|
||||||
for (policy in policies) {
|
|
||||||
val adaptedPolicy = policy.applyTCPIfNeeded(settings)
|
|
||||||
assertEquals(
|
|
||||||
policy.cookiePolicy,
|
|
||||||
adaptedPolicy.cookiePolicy
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `GIVEN custom policy WHEN cookie policy social THEN tracking policy should have cookie policy allow non-trackers`() {
|
fun `GIVEN custom policy WHEN cookie policy social THEN tracking policy should have cookie policy allow non-trackers`() {
|
||||||
val expected = TrackingProtectionPolicy.select(
|
val expected = TrackingProtectionPolicy.select(
|
||||||
|
@ -226,10 +226,6 @@ features:
|
|||||||
description: If true, enables tabs prioritization feature.
|
description: If true, enables tabs prioritization feature.
|
||||||
type: Boolean
|
type: Boolean
|
||||||
default: true
|
default: true
|
||||||
total-cookie-protection-enabled:
|
|
||||||
description: If true, enables the total cookie protection in all browsing modes.
|
|
||||||
type: Boolean
|
|
||||||
default: false
|
|
||||||
types:
|
types:
|
||||||
objects:
|
objects:
|
||||||
MessageData:
|
MessageData:
|
||||||
|
Loading…
Reference in New Issue
Block a user