Bug 1901808 - Align content blocking flags from nslWebProgressListener with ContentBlockingController r=calu,geckoview-reviewers,android-reviewers,owlish

Differential Revision: https://phabricator.services.mozilla.com/D214962
This commit is contained in:
Nicholas Poon 2024-07-03 22:08:19 +00:00
parent 6643cb9df9
commit 08bf814646
5 changed files with 20 additions and 2 deletions

View File

@ -1502,6 +1502,7 @@ internal fun ContentBlockingController.LogEntry.BlockingData.unBlockedBySmartBlo
internal fun ContentBlockingController.LogEntry.BlockingData.getBlockedCategory(): TrackingCategory {
return when (category) {
Event.BLOCKED_FINGERPRINTING_CONTENT -> TrackingCategory.FINGERPRINTING
Event.BLOCKED_SUSPICIOUS_FINGERPRINTING -> TrackingCategory.FINGERPRINTING
Event.BLOCKED_CRYPTOMINING_CONTENT -> TrackingCategory.CRYPTOMINING
Event.BLOCKED_SOCIALTRACKING_CONTENT, Event.COOKIES_BLOCKED_SOCIALTRACKER -> TrackingCategory.MOZILLA_SOCIAL
Event.BLOCKED_TRACKING_CONTENT -> TrackingCategory.SCRIPTS_AND_SUB_RESOURCES

View File

@ -3638,8 +3638,10 @@ class GeckoEngineTest {
val blockedTrackingContent = createBlockingData(Event.BLOCKED_TRACKING_CONTENT)
val blockedFingerprintingContent = createBlockingData(Event.BLOCKED_FINGERPRINTING_CONTENT)
val blockedSuspiciousFingerprinting = createBlockingData(Event.BLOCKED_SUSPICIOUS_FINGERPRINTING)
val blockedCyptominingContent = createBlockingData(Event.BLOCKED_CRYPTOMINING_CONTENT)
val blockedSocialContent = createBlockingData(Event.BLOCKED_SOCIALTRACKING_CONTENT)
val purgedBounceTracker = createBlockingData(Event.PURGED_BOUNCETRACKER)
val loadedTrackingLevel1Content = createBlockingData(Event.LOADED_LEVEL_1_TRACKING_CONTENT)
val loadedTrackingLevel2Content = createBlockingData(Event.LOADED_LEVEL_2_TRACKING_CONTENT)
@ -3654,11 +3656,13 @@ class GeckoEngineTest {
loadedTrackingLevel2Content,
blockedFingerprintingContent,
loadedFingerprintingContent,
blockedSuspiciousFingerprinting,
blockedCyptominingContent,
loadedCyptominingContent,
blockedCookiePermission,
blockedSocialContent,
loadedSocialContent,
purgedBounceTracker,
loadedCookieSocialTracker,
blockedCookieSocialTracker,
unBlockedBySmartBlock,

View File

@ -611,6 +611,7 @@ package org.mozilla.geckoview {
field public static final int BLOCKED_EMAILTRACKING_CONTENT = 4194304;
field public static final int BLOCKED_FINGERPRINTING_CONTENT = 64;
field public static final int BLOCKED_SOCIALTRACKING_CONTENT = 65536;
field public static final int BLOCKED_SUSPICIOUS_FINGERPRINTING = 4;
field public static final int BLOCKED_TRACKING_CONTENT = 4096;
field public static final int BLOCKED_UNSAFE_CONTENT = 16384;
field public static final int COOKIES_BLOCKED_ALL = 1073741824;
@ -629,6 +630,7 @@ package org.mozilla.geckoview {
field public static final int LOADED_LEVEL_1_TRACKING_CONTENT = 8192;
field public static final int LOADED_LEVEL_2_TRACKING_CONTENT = 1048576;
field public static final int LOADED_SOCIALTRACKING_CONTENT = 131072;
field public static final int PURGED_BOUNCETRACKER = 7;
field public static final int REPLACED_TRACKING_CONTENT = 16;
}

View File

@ -119,6 +119,12 @@ public class ContentBlockingController {
/** Indicates that content that would have been blocked has instead been allowed by a shim. */
public static final int ALLOWED_TRACKING_CONTENT = 0x00000020;
/** Indicates that bounce trackers have been purged. */
public static final int PURGED_BOUNCETRACKER = 0x00000007;
/** Indicates that suspicious fingerprinting content has been blocked */
public static final int BLOCKED_SUSPICIOUS_FINGERPRINTING = 0x00000004;
protected Event() {}
}
@ -140,7 +146,8 @@ public class ContentBlockingController {
Event.COOKIES_BLOCKED_FOREIGN, Event.BLOCKED_SOCIALTRACKING_CONTENT,
Event.LOADED_SOCIALTRACKING_CONTENT, Event.REPLACED_TRACKING_CONTENT,
Event.LOADED_EMAILTRACKING_LEVEL_1_CONTENT, Event.LOADED_EMAILTRACKING_LEVEL_2_CONTENT,
Event.BLOCKED_EMAILTRACKING_CONTENT
Event.BLOCKED_EMAILTRACKING_CONTENT, Event.PURGED_BOUNCETRACKER,
Event.BLOCKED_SUSPICIOUS_FINGERPRINTING
})
public @interface LogEvent {}

View File

@ -17,9 +17,13 @@ exclude: true
- Added [`ERROR_ADMIN_INSTALL_ONLY`][129.1] to `WebExtension.InstallException.ErrorCodes`. ([bug 1902222]({{bugzilla}}1902222))
- Added [`ContentDelegate.onHideDynamicToolbar`][129.2] to notify
the app that it must fully-collapse its dynamic toolbar ([bug 1855990]({{bugzilla}}1855990))
- Added [`PURGED_BOUNCETRACKER`][129.3] and [`BLOCKED_SUSPICIOUS_FINGERPRINTING`][129.4]
to `ContentBlockingController.Event`. ([bug 1901808]({{bugzilla}}1901808))
[129.1]: {{javadoc_uri}}/WebExtension.InstallException.ErrorCodes.html#ERROR_ADMIN_INSTALL_ONLY
[129.2]: {{javadoc_uri}}/GeckoSession.ContentDelegate.html#onHideDynamicToolbar(org.mozilla.geckoview.GeckoSession)
[129.3]: {{javadoc_uri}}/ContentBlockingController.Event.html#PURGED_BOUNCETRACKER
[129.4]: {{javadoc_uri}}/ContentBlockingController.Event.html#BLOCKED_SUSPICIOUS_FINGERPRINTING
## v128
- ⚠️ Removed deprecated [`GeckoSession.NavigationDelegate.onLocationChange`][128.1]
@ -1579,4 +1583,4 @@ to allow adding gecko profiler markers.
[65.24]: {{javadoc_uri}}/CrashReporter.html#sendCrashReport(android.content.Context,android.os.Bundle,java.lang.String)
[65.25]: {{javadoc_uri}}/GeckoResult.html
[api-version]: df1c42b393736fbba4f1533bc754f7317cac329f
[api-version]: e5657049256d78169432f7eafe2f8855db73ab6f