зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1517641 - [1.0] Add experimental ad-blocking category to the Tracking Protection API. r=snorp,geckoview-reviewers,dimi
Differential Revision: https://phabricator.services.mozilla.com/D16700 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
4b7040c7b5
Коммит
5114dc76d2
|
@ -621,6 +621,7 @@ package org.mozilla.geckoview {
|
|||
public static interface GeckoSession.TrackingProtectionDelegate {
|
||||
method @android.support.annotation.UiThread public void onTrackerBlocked(@android.support.annotation.NonNull org.mozilla.geckoview.GeckoSession, @android.support.annotation.Nullable java.lang.String, int);
|
||||
field public static final int CATEGORY_AD = 1;
|
||||
field public static final int CATEGORY_AD_EXT = 64;
|
||||
field public static final int CATEGORY_ALL = 31;
|
||||
field public static final int CATEGORY_ANALYTIC = 2;
|
||||
field public static final int CATEGORY_CONTENT = 8;
|
||||
|
|
|
@ -3816,7 +3816,7 @@ public class GeckoSession implements Parcelable {
|
|||
@IntDef(flag = true,
|
||||
value = { CATEGORY_NONE, CATEGORY_AD, CATEGORY_ANALYTIC,
|
||||
CATEGORY_SOCIAL, CATEGORY_CONTENT, CATEGORY_ALL,
|
||||
CATEGORY_TEST })
|
||||
CATEGORY_TEST, CATEGORY_AD_EXT })
|
||||
/* package */ @interface Category {}
|
||||
|
||||
static final int CATEGORY_NONE = 0;
|
||||
|
@ -3844,6 +3844,10 @@ public class GeckoSession implements Parcelable {
|
|||
* Block all known trackers.
|
||||
*/
|
||||
static final int CATEGORY_ALL = (1 << 5) - 1;
|
||||
/**
|
||||
* Experimental: Block advertisements.
|
||||
*/
|
||||
static final int CATEGORY_AD_EXT = 1 << 6;
|
||||
|
||||
/**
|
||||
* A tracking element has been blocked from loading.
|
||||
|
|
|
@ -14,6 +14,13 @@ import org.mozilla.geckoview.GeckoSession.TrackingProtectionDelegate;
|
|||
private static final String ANALYTIC = "analytics-track-digest256";
|
||||
private static final String SOCIAL = "social-track-digest256";
|
||||
private static final String CONTENT = "content-track-digest256";
|
||||
private static final String[] AD_EXT = new String[] {
|
||||
"fanboy-annoyance-digest256",
|
||||
"fanboy-social-digest256",
|
||||
"easylist-digest25",
|
||||
"easyprivacy-digest25",
|
||||
"adguard-digest25"
|
||||
};
|
||||
|
||||
/* package */ static String buildPrefValue(int categories) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
@ -36,6 +43,11 @@ import org.mozilla.geckoview.GeckoSession.TrackingProtectionDelegate;
|
|||
if ((categories & TrackingProtectionDelegate.CATEGORY_CONTENT) != 0) {
|
||||
builder.append(CONTENT).append(',');
|
||||
}
|
||||
if ((categories & TrackingProtectionDelegate.CATEGORY_AD_EXT) != 0) {
|
||||
for (final String l: AD_EXT) {
|
||||
builder.append(l).append(',');
|
||||
}
|
||||
}
|
||||
// Trim final ','.
|
||||
return builder.substring(0, builder.length() - 1);
|
||||
}
|
||||
|
@ -57,6 +69,12 @@ import org.mozilla.geckoview.GeckoSession.TrackingProtectionDelegate;
|
|||
if (list.indexOf(CONTENT) != -1) {
|
||||
category |= TrackingProtectionDelegate.CATEGORY_CONTENT;
|
||||
}
|
||||
for (final String l: AD_EXT) {
|
||||
if (list.indexOf(l) != -1) {
|
||||
category |= TrackingProtectionDelegate.CATEGORY_AD_EXT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return category;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ description: GeckoView API Changelog.
|
|||
- Added `@UiThread` to `GeckoSession.releaseSession` and `GeckoSession.setSession`
|
||||
|
||||
## v65
|
||||
- Added experimental ad-blocking category to `GeckoSession.TrackingProtectionDelegate`.
|
||||
|
||||
- Moved [`CompositorController`][65.1], [`DynamicToolbarAnimator`][65.2],
|
||||
[`OverscrollEdgeEffect`][65.3], [`PanZoomController`][65.4] from
|
||||
`org.mozilla.gecko.gfx` to [`org.mozilla.geckoview`][65.5]
|
||||
|
@ -113,4 +115,4 @@ description: GeckoView API Changelog.
|
|||
[65.24]: ../CrashReporter.html#sendCrashReport-android.content.Context-android.os.Bundle-java.lang.String-
|
||||
[65.25]: ../GeckoResult.html
|
||||
|
||||
[api-version]: e7a6a3ed65c75f7cb278b693adfa09cae5238ca2
|
||||
[api-version]: a38f6e16fd8ad8dc947d349b595c6c1e98fce83b
|
||||
|
|
|
@ -5571,7 +5571,7 @@ pref("urlclassifier.features.cryptomining.blacklistTables", "");
|
|||
pref("urlclassifier.features.cryptomining.whitelistTables", "");
|
||||
|
||||
// These tables will never trigger a gethash call.
|
||||
pref("urlclassifier.disallow_completions", "test-malware-simple,test-harmful-simple,test-phish-simple,test-unwanted-simple,test-track-simple,test-trackwhite-simple,test-block-simple,goog-downloadwhite-digest256,base-track-digest256,mozstd-trackwhite-digest256,content-track-digest256,mozplugin-block-digest256,mozplugin2-block-digest256,block-flash-digest256,except-flash-digest256,allow-flashallow-digest256,except-flashallow-digest256,block-flashsubdoc-digest256,except-flashsubdoc-digest256,goog-passwordwhite-proto,ads-track-digest256,social-track-digest256,analytics-track-digest256,base-fingerprinting-track-digest256,content-fingerprinting-track-digest256,base-cryptomining-track-digest256,content-cryptomining-track-digest256");
|
||||
pref("urlclassifier.disallow_completions", "test-malware-simple,test-harmful-simple,test-phish-simple,test-unwanted-simple,test-track-simple,test-trackwhite-simple,test-block-simple,goog-downloadwhite-digest256,base-track-digest256,mozstd-trackwhite-digest256,content-track-digest256,mozplugin-block-digest256,mozplugin2-block-digest256,block-flash-digest256,except-flash-digest256,allow-flashallow-digest256,except-flashallow-digest256,block-flashsubdoc-digest256,except-flashsubdoc-digest256,goog-passwordwhite-proto,ads-track-digest256,social-track-digest256,analytics-track-digest256,base-fingerprinting-track-digest256,content-fingerprinting-track-digest256,base-cryptomining-track-digest256,content-cryptomining-track-digest256,fanboy-annoyance-digest256,fanboy-social-digest256,easylist-digest256,easyprivacy-digest256,adguard-digest256");
|
||||
|
||||
// Number of random entries to send with a gethash request
|
||||
pref("urlclassifier.gethashnoise", 4);
|
||||
|
@ -5640,7 +5640,7 @@ pref("browser.safebrowsing.reportPhishURL", "https://%LOCALE%.phish-report.mozil
|
|||
|
||||
// Mozilla Safe Browsing provider (for tracking protection and plugin blocking)
|
||||
pref("browser.safebrowsing.provider.mozilla.pver", "2.2");
|
||||
pref("browser.safebrowsing.provider.mozilla.lists", "base-track-digest256,mozstd-trackwhite-digest256,content-track-digest256,mozplugin-block-digest256,mozplugin2-block-digest256,block-flash-digest256,except-flash-digest256,allow-flashallow-digest256,except-flashallow-digest256,block-flashsubdoc-digest256,except-flashsubdoc-digest256,ads-track-digest256,social-track-digest256,analytics-track-digest256,base-fingerprinting-track-digest256,content-fingerprinting-track-digest256,base-cryptomining-track-digest256,content-cryptomining-track-digest256");
|
||||
pref("browser.safebrowsing.provider.mozilla.lists", "base-track-digest256,mozstd-trackwhite-digest256,content-track-digest256,mozplugin-block-digest256,mozplugin2-block-digest256,block-flash-digest256,except-flash-digest256,allow-flashallow-digest256,except-flashallow-digest256,block-flashsubdoc-digest256,except-flashsubdoc-digest256,ads-track-digest256,social-track-digest256,analytics-track-digest256,base-fingerprinting-track-digest256,content-fingerprinting-track-digest256,base-cryptomining-track-digest256,content-cryptomining-track-digest256,fanboy-annoyance-digest256,fanboy-social-digest256,easylist-digest256,easyprivacy-digest256,adguard-digest256");
|
||||
pref("browser.safebrowsing.provider.mozilla.updateURL", "https://shavar.services.mozilla.com/downloads?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2");
|
||||
pref("browser.safebrowsing.provider.mozilla.gethashURL", "https://shavar.services.mozilla.com/gethash?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2");
|
||||
// Set to a date in the past to force immediate download in new profiles.
|
||||
|
|
Загрузка…
Ссылка в новой задаче