Bug 1462470 - Part 1 - Notify frontend of loaded tracking content in annotation-only mode. r=ehsan draft
authorJohann Hofmann <jhofmann@mozilla.com>
Thu, 24 May 2018 12:44:42 +0200
changeset 805346 d5d2a8a28fb551b0d844af499621af25f4485789
parent 801214 89d79c2258be1c420153e1adc54338b0165fc88e
child 805347 17dce2365fe064e659cea208fdb2d6b0d7626792
push id112640
push userjhofmann@mozilla.com
push dateThu, 07 Jun 2018 18:37:45 +0000
reviewersehsan
bugs1462470
milestone62.0a1
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
netwerk/base/nsChannelClassifier.cpp
--- 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/