-
Notifications
You must be signed in to change notification settings - Fork 473
TrackingCategory.RECOMMENDED does not block ads as expected #4191
Comments
Note: I tested on rottentomatoes.com which shows a banner ad at the top. CC @pocmo This seems important because tracking protection may be broken in our apps. |
I set it up using |
CC @Amejia481 |
On it! |
@mcomella I believe tracking protection does not block ads, it blocks scripts/cookies/content from trackers depending on which policy you choose. ( I have to confirm). For blocking ads we need an Adblocker. Ads not showing maybe a side effect in some cases, as they may depend on the scripts/cookies/content that we are blocking. If you want to confirm the categories, that you want are getting apply you can test verifying If we take https://rottentomatoes.com/ as a guinea pig and apply
A tracker may contain multiple categories, you can use the snippet below to not show duplicates: var categoriesBlocked = mutableSetOf<EngineSession.TrackingProtectionPolicy.TrackingCategory>()
session.trackersBlocked.forEach{
categoriesBlocked.addAll(it.trackingCategories.toSet())
} If we use the same site but just applying
When the page finishes loading The same could be seen if we apply just When the page finishes loading |
@Amejia481 Did you verify that this is still the case for WebView ( |
Checking! |
Issue discovered, working on a patch! |
@mcomella As you described above, until the fix lands you have to add the categories manually, sorry for that! |
Sorry I was not explicit about SystemWebView (FFTV is still on it) and about ^: a side effect of TP is that it blocks ads and the ad I usually use for testing wasn't blocked. I probably should have been clearer. :) |
I really appreciate you were very diligent double checking after the API refactoring. I'm covering with more tests to avoid similar issues in the future :), Sorry for the inconvenience, that this may cause you! |
… on SystemEngine
… on SystemEngine
And thanks for writing those tests. :) |
… on SystemEngine
I tried applying TrackingCategory.RECOMMENDED in FFTV but ads still appeared:
(This is how the default values for
TrackingProtectionPolicy.select
define it)I switched to adding these categories manually and it worked fine:
Looking at the code, these values are being added together:
android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/EngineSession.kt
Line 179 in 1c65263
However, these values look like they're supposed to be bit-packed because other values use bit-shift operators: I think they should be using
and
instead of+
.┆Issue is synchronized with this Jira Task
The text was updated successfully, but these errors were encountered: