Bug 1662362 - Record STATE_UNBLOCKED_UNSAFE_CONTENT event to content blocking log when unblock API of URL Classifier is called r=nhnt11,timhuang

Differential Revision: https://phabricator.services.mozilla.com/D88957
This commit is contained in:
Dimi Lee 2020-09-11 17:48:29 +00:00
Родитель 5763aba6d5
Коммит f3da525903
8 изменённых файлов: 23 добавлений и 3 удалений

Просмотреть файл

@ -145,6 +145,9 @@ UrlClassifierFeatureCryptominingProtection::ProcessChannel(
if (ChannelClassifierService::OnBeforeBlockChannel(aChannel, mName, list) ==
ChannelBlockDecision::Unblocked) {
ContentBlockingNotifier::OnEvent(
aChannel, nsIWebProgressListener::STATE_UNBLOCKED_UNSAFE_CONTENT,
false);
*aShouldContinue = true;
return NS_OK;
}

Просмотреть файл

@ -152,6 +152,10 @@ UrlClassifierFeatureFingerprintingProtection::ProcessChannel(
if (ChannelClassifierService::OnBeforeBlockChannel(aChannel, mName, list) ==
ChannelBlockDecision::Unblocked) {
ContentBlockingNotifier::OnEvent(
aChannel, nsIWebProgressListener::STATE_UNBLOCKED_UNSAFE_CONTENT,
false);
*aShouldContinue = true;
return NS_OK;
}

Просмотреть файл

@ -148,6 +148,10 @@ UrlClassifierFeatureSocialTrackingProtection::ProcessChannel(
if (ChannelClassifierService::OnBeforeBlockChannel(aChannel, mName, list) ==
ChannelBlockDecision::Unblocked) {
ContentBlockingNotifier::OnEvent(
aChannel, nsIWebProgressListener::STATE_UNBLOCKED_UNSAFE_CONTENT,
false);
*aShouldContinue = true;
return NS_OK;
}

Просмотреть файл

@ -152,6 +152,9 @@ UrlClassifierFeatureTrackingProtection::ProcessChannel(
if (ChannelClassifierService::OnBeforeBlockChannel(aChannel, mName, list) ==
ChannelBlockDecision::Unblocked) {
ContentBlockingNotifier::OnEvent(
aChannel, nsIWebProgressListener::STATE_UNBLOCKED_UNSAFE_CONTENT,
false);
*aShouldContinue = true;
return NS_OK;
}

Просмотреть файл

@ -158,6 +158,10 @@ Maybe<uint32_t> ContentBlockingLog::RecordLogParent(
aTrackingFullHashes);
break;
case nsIWebProgressListener::STATE_UNBLOCKED_UNSAFE_CONTENT:
RecordLogInternal(aOrigin, aType, blockedValue);
break;
default:
// Ignore nsIWebProgressListener::STATE_BLOCKED_UNSAFE_CONTENT;
break;

Просмотреть файл

@ -496,7 +496,7 @@ void ContentBlockingNotifier::OnDecision(BrowsingContext* aBrowsingContext,
/* static */
void ContentBlockingNotifier::OnEvent(nsIChannel* aTrackingChannel,
uint32_t aRejectedReason) {
uint32_t aRejectedReason, bool aBlocked) {
MOZ_ASSERT(XRE_IsParentProcess() && aTrackingChannel);
nsCOMPtr<nsIURI> uri;
@ -507,7 +507,7 @@ void ContentBlockingNotifier::OnEvent(nsIChannel* aTrackingChannel,
Unused << nsContentUtils::GetASCIIOrigin(uri, trackingOrigin);
}
return ContentBlockingNotifier::OnEvent(aTrackingChannel, true,
return ContentBlockingNotifier::OnEvent(aTrackingChannel, aBlocked,
aRejectedReason, trackingOrigin);
}

Просмотреть файл

@ -55,7 +55,8 @@ class ContentBlockingNotifier final {
static void OnDecision(dom::BrowsingContext* aBrowsingContext,
BlockingDecision aDecision, uint32_t aRejectedReason);
static void OnEvent(nsIChannel* aChannel, uint32_t aRejectedReason);
static void OnEvent(nsIChannel* aChannel, uint32_t aRejectedReason,
bool aBlocked = true);
static void OnEvent(
nsIChannel* aChannel, bool aBlocked, uint32_t aRejectedReason,

Просмотреть файл

@ -352,6 +352,7 @@ interface nsIWebProgressListener : nsISupports
const unsigned long STATE_COOKIES_BLOCKED_FOREIGN = 0x00000080;
const unsigned long STATE_BLOCKED_SOCIALTRACKING_CONTENT = 0x00010000;
const unsigned long STATE_LOADED_SOCIALTRACKING_CONTENT = 0x00020000;
const unsigned long STATE_UNBLOCKED_UNSAFE_CONTENT = 0x00000010;
/**
* Notification indicating the state has changed for one of the requests