mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
Bug 1628388 - Add ACCEPT_FIRST_PARTY_AND_ISOLATE_OTHERS to CookieBehavior to support dFPI and add a setting to control it to GVE. r=esawin,geckoview-reviewers,agi
Differential Revision: https://phabricator.services.mozilla.com/D73473
This commit is contained in:
parent
e9737ef887
commit
cfe61718b3
@ -230,6 +230,7 @@ package org.mozilla.geckoview {
|
||||
ctor protected CookieBehavior();
|
||||
field public static final int ACCEPT_ALL = 0;
|
||||
field public static final int ACCEPT_FIRST_PARTY = 1;
|
||||
field public static final int ACCEPT_FIRST_PARTY_AND_ISOLATE_OTHERS = 5;
|
||||
field public static final int ACCEPT_NONE = 2;
|
||||
field public static final int ACCEPT_NON_TRACKERS = 4;
|
||||
field public static final int ACCEPT_VISITED = 3;
|
||||
|
@ -90,7 +90,8 @@ public class ContentBlocking {
|
||||
* Set the ETP behavior level.
|
||||
*
|
||||
* @param level The level of ETP blocking to use. Only takes effect if
|
||||
* cookie behavior is set to {@link ContentBlocking.CookieBehavior#ACCEPT_NON_TRACKERS}.
|
||||
* cookie behavior is set to {@link ContentBlocking.CookieBehavior#ACCEPT_NON_TRACKERS}
|
||||
* or {@link ContentBlocking.CookieBehavior#ACCEPT_FIRST_PARTY_AND_ISOLATE_OTHERS}.
|
||||
*
|
||||
* @return The Builder instance.
|
||||
*/
|
||||
@ -198,7 +199,8 @@ public class ContentBlocking {
|
||||
*
|
||||
* @param level The level of ETP blocking to use; must be one of {@link ContentBlocking.EtpLevel}
|
||||
* flags. Only takes effect if the cookie behavior is
|
||||
* {@link ContentBlocking.CookieBehavior#ACCEPT_NON_TRACKERS}.
|
||||
* {@link ContentBlocking.CookieBehavior#ACCEPT_NON_TRACKERS} or
|
||||
* {@link ContentBlocking.CookieBehavior#ACCEPT_FIRST_PARTY_AND_ISOLATE_OTHERS}.
|
||||
*
|
||||
* @return This Settings instance.
|
||||
*/
|
||||
@ -473,6 +475,13 @@ public class ContentBlocking {
|
||||
*/
|
||||
public static final int ACCEPT_NON_TRACKERS = 4;
|
||||
|
||||
/**
|
||||
* Enable dynamic first party isolation (dFPI); this will block third-party tracking
|
||||
* cookies in accordance with the ETP level and isolate non-tracking third-party
|
||||
* cookies.
|
||||
*/
|
||||
public static final int ACCEPT_FIRST_PARTY_AND_ISOLATE_OTHERS = 5;
|
||||
|
||||
protected CookieBehavior() {}
|
||||
}
|
||||
|
||||
|
@ -18,8 +18,13 @@ exclude: true
|
||||
extension that is bundled with the APK. This method is meant as a replacement
|
||||
for [`GeckoRuntime.registerWebExtension`][67.15], ⚠️ which is now deprecated
|
||||
and will be removed in GeckoView 81.
|
||||
- Added [`CookieBehavior.ACCEPT_FIRST_PARTY_AND_ISOLATE_OTHERS`][78.2] to allow
|
||||
enabling dynamic first party isolation; this will block tracking cookies and
|
||||
isolate all other third party cookies by keying them based on the first party
|
||||
from which they are accessed.
|
||||
|
||||
[78.1]: {{javadoc_uri}}/WebExtensionController.html#installBuiltIn-java.lang.String-
|
||||
[78.2]: {{javadoc_uri}}/ContentBlocking.CookieBehavior.html#ACCEPT_FIRST_PARTY_AND_ISOLATE_OTHERS
|
||||
|
||||
## v77
|
||||
- Added [`GeckoRuntime.appendAppNotesToCrashReport`][77.1] For adding app notes to the crash report.
|
||||
@ -683,4 +688,4 @@ exclude: true
|
||||
[65.24]: {{javadoc_uri}}/CrashReporter.html#sendCrashReport-android.content.Context-android.os.Bundle-java.lang.String-
|
||||
[65.25]: {{javadoc_uri}}/GeckoResult.html
|
||||
|
||||
[api-version]: b4568ed7ee3ee43aa741a01cb4571379d0399299
|
||||
[api-version]: eb4c8f11b68ce54cf780c4f08cde5f7d2a048093
|
||||
|
@ -383,6 +383,7 @@ public class GeckoViewActivity
|
||||
private boolean mFullAccessibilityTree;
|
||||
private boolean mUseTrackingProtection;
|
||||
private String mEnhancedTackingProtection;
|
||||
private boolean mUseDynamicFirstPartyIsolation;
|
||||
private boolean mAllowAutoplay;
|
||||
private boolean mUsePrivateBrowsing;
|
||||
private boolean mEnableRemoteDebugging;
|
||||
@ -441,6 +442,8 @@ public class GeckoViewActivity
|
||||
getString(R.string.key_tracking_protection), false);
|
||||
String enhancedTrackingProtection = preferences.getString(
|
||||
getString(R.string.key_enhanced_tracking_protection), "standard");
|
||||
boolean dfpi = preferences.getBoolean(
|
||||
getString(R.string.key_dfpi), false);
|
||||
boolean autoplay = preferences.getBoolean(
|
||||
getString(R.string.key_autoplay), false);
|
||||
int colorScheme = Integer.parseInt(preferences.getString(
|
||||
@ -492,6 +495,16 @@ public class GeckoViewActivity
|
||||
mEnhancedTackingProtection = enhancedTrackingProtection;
|
||||
}
|
||||
|
||||
if (mUseDynamicFirstPartyIsolation != dfpi) {
|
||||
if (sGeckoRuntime != null) {
|
||||
int cookieBehavior = dfpi ?
|
||||
ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY_AND_ISOLATE_OTHERS :
|
||||
ContentBlocking.CookieBehavior.ACCEPT_NON_TRACKERS;
|
||||
sGeckoRuntime.getSettings().getContentBlocking().setCookieBehavior(cookieBehavior);
|
||||
}
|
||||
mUseDynamicFirstPartyIsolation = dfpi;
|
||||
}
|
||||
|
||||
if (mAllowAutoplay != autoplay) {
|
||||
if (currentSession != null) {
|
||||
currentSession.reload();
|
||||
|
@ -52,6 +52,7 @@
|
||||
# Preference Keys
|
||||
<string name="key_tracking_protection">tracking_protection</string>
|
||||
<string name="key_enhanced_tracking_protection">enhanced_tracking_protection</string>
|
||||
<string name="key_dfpi">dfpi</string>
|
||||
<string name="key_autoplay">autoplay</string>
|
||||
<string name="key_remote_debugging">remote_debugging</string>
|
||||
<string name="key_allow_extensions_in_private_browsing">allow_extensions_in_private_browsing</string>
|
||||
|
@ -12,6 +12,9 @@
|
||||
app:entryValues="@array/enhanced_tracking_protection_values"
|
||||
app:defaultValue="standard">
|
||||
</ListPreference>
|
||||
<SwitchPreferenceCompat
|
||||
app:key="@string/key_dfpi"
|
||||
app:title="Enable Dynamic FPI"/>
|
||||
<SwitchPreferenceCompat
|
||||
app:key="@string/key_autoplay"
|
||||
app:title="Allow Autoplay"/>
|
||||
|
Loading…
Reference in New Issue
Block a user