Bug 1462470 - Part 1 - Notify frontend of loaded tracking content in annotation-only mode. r=ehsan
In order to notify the user that there is tracking content on the page
which could have been blocked by Tracking Protection, we need to mark
the document as having tracking content even when TP is off.
Part 2 will update the desktop frontend to handle this correctly and
show a different message when TP is on vs. off. Fennec should not be
affected by this change since it already prevents loaded state from
showing if TP is disabled:
https://searchfox.org/mozilla-central/rev/dc6d85680539cb7e5fe2843d38a30a0581bfefe1/mobile/android/chrome/content/browser.js#5669
https://searchfox.org/mozilla-central/rev/dc6d85680539cb7e5fe2843d38a30a0581bfefe1/mobile/android/modules/geckoview/GeckoViewProgress.jsm#112
MozReview-Commit-ID: LNF0zABNsx1
--- a/netwerk/base/nsChannelClassifier.cpp
+++ b/netwerk/base/nsChannelClassifier.cpp
@@ -1019,16 +1019,22 @@ TrackingURICallback::OnTrackerFound(nsre
nsCOMPtr<nsIChannel> channel = mChannelClassifier->GetChannel();
if (mChannelClassifier->ShouldEnableTrackingProtection()) {
mChannelClassifier->SetBlockedContent(channel, aErrorCode,
mList, mProvider, mFullHash);
channel->Cancel(aErrorCode);
} else {
MOZ_ASSERT(mChannelClassifier->ShouldEnableTrackingAnnotation());
+ // Even with TP disabled, we still want to show the user that there
+ // are unblocked trackers on the site, so notify the UI that we loaded
+ // tracking content. UI code can treat this notification differently
+ // depending on whether TP is enabled or disabled.
+ mChannelClassifier->NotifyTrackingProtectionDisabled(channel);
+
SetIsTrackingResourceHelper(channel);
if (CachedPrefs::GetInstance()->IsLowerNetworkPriority()) {
LowerPriorityHelper(channel);
}
}
}
} // end of unnamed namespace/