Confirmed users
908
edits
(→Engineering: Add a partial code walkthrough covering tracking annotations) |
(→Code walkthrough: add a walktrough of the actual classification) |
||
| Line 33: | Line 33: | ||
=== Code walkthrough === | === Code walkthrough === | ||
The classification for tracking protection, separate from the [[Security/Safe_Browsing#Code_walkthrough|full Safe Browsing classification]], | |||
is kicked off in [https://searchfox.org/mozilla-central/rev/8affe6e83188787eb61fe0528eeb6eef6081ba06/netwerk/protocol/http/nsHttpChannel.cpp#6385 <tt>nsHttpChannel::BeginConnectContinue()</tt>] and goes like this: | |||
1. we asynchronously [https://searchfox.org/mozilla-central/rev/8affe6e83188787eb61fe0528eeb6eef6081ba06/netwerk/base/nsChannelClassifier.cpp#1225 check the blacklist] | |||
2. if there's a match, we then [https://searchfox.org/mozilla-central/rev/8affe6e83188787eb61fe0528eeb6eef6081ba06/netwerk/base/nsChannelClassifier.cpp#974 check the entity whitelist] | |||
3. if it doesn't match the whitelist, we [https://searchfox.org/mozilla-central/rev/8affe6e83188787eb61fe0528eeb6eef6081ba06/netwerk/base/nsChannelClassifier.cpp#1011 treat it as a tracker] | |||
4. we either [https://searchfox.org/mozilla-central/rev/8affe6e83188787eb61fe0528eeb6eef6081ba06/netwerk/base/nsChannelClassifier.cpp#1023 cancel the channel] (for full tracking protection) or [https://searchfox.org/mozilla-central/rev/8affe6e83188787eb61fe0528eeb6eef6081ba06/netwerk/base/nsChannelClassifier.cpp#1027 set a tracking flag] (for tracking annotations only) | |||
Note that only [https://searchfox.org/mozilla-central/rev/8affe6e83188787eb61fe0528eeb6eef6081ba06/netwerk/base/nsChannelClassifier.cpp#319 eligible resources] are run through the classifier: | |||
- must not be a [https://searchfox.org/mozilla-central/rev/8affe6e83188787eb61fe0528eeb6eef6081ba06/netwerk/base/nsChannelClassifier.cpp#355-375 first-party or top-level load] | |||
- addons can request [https://searchfox.org/mozilla-central/rev/8affe6e83188787eb61fe0528eeb6eef6081ba06/netwerk/base/nsChannelClassifier.cpp#384-386 permission to load tracking resources] | |||
- we check the permission manager for any [https://searchfox.org/mozilla-central/rev/8affe6e83188787eb61fe0528eeb6eef6081ba06/netwerk/base/nsChannelClassifier.cpp#406-431 manual user overrides] (and an [https://searchfox.org/mozilla-central/rev/8affe6e83188787eb61fe0528eeb6eef6081ba06/netwerk/base/nsChannelClassifier.cpp#433-450 in-memory list in Private Browsing]) | |||
Tracking annotations are used in four different places: | Tracking annotations are used in four different places: | ||