mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Backed out 6 changesets (bug 1773691, bug 1773695) for causing Bp-hybrid bustages on UrlClassifierFeatureEmailTrackingProtection
Backed out changeset f402f1bd4caa (bug 1773695) Backed out changeset 001c38822c53 (bug 1773695) Backed out changeset 8ef4d3597d92 (bug 1773695) Backed out changeset f4770b2fe53d (bug 1773695) Backed out changeset fb625ae08f73 (bug 1773695) Backed out changeset 6c23adf9184f (bug 1773691)
This commit is contained in:
parent
3368585195
commit
b77dc7a479
@ -196,7 +196,6 @@ http://social-tracking.example.org:80
|
||||
http://itisatracker.org:80
|
||||
https://itisatracker.org:443
|
||||
http://trackertest.org:80
|
||||
http://email-tracking.example.org:80
|
||||
#
|
||||
# Used while testing TLS session ticket resumption for third-party trackers (bug 1500533)
|
||||
# (DO NOT USE THIS HOST IN OTHER TESTS!)
|
||||
@ -212,7 +211,6 @@ https://not-tracking.example.com:443
|
||||
https://tracking.example.org:443
|
||||
https://another-tracking.example.net:443
|
||||
https://social-tracking.example.org:443
|
||||
https://email-tracking.example.org:443
|
||||
|
||||
#
|
||||
# Used while testing flash blocking (Bug 1307604)
|
||||
|
@ -44,8 +44,6 @@ enum MozUrlClassificationFlags {
|
||||
"fingerprinting_content",
|
||||
"cryptomining",
|
||||
"cryptomining_content",
|
||||
"emailtracking",
|
||||
"emailtracking_content",
|
||||
"tracking",
|
||||
"tracking_ad",
|
||||
"tracking_analytics",
|
||||
|
@ -245,7 +245,6 @@ XPC_MSG_DEF(NS_ERROR_HARMFUL_URI , "The URI is harmful")
|
||||
XPC_MSG_DEF(NS_ERROR_FINGERPRINTING_URI , "The URI is fingerprinting")
|
||||
XPC_MSG_DEF(NS_ERROR_CRYPTOMINING_URI , "The URI is cryptomining")
|
||||
XPC_MSG_DEF(NS_ERROR_SOCIALTRACKING_URI , "The URI is social tracking")
|
||||
XPC_MSG_DEF(NS_ERROR_EMAILTRACKING_URI , "The URI is email tracking")
|
||||
|
||||
/* Profile manager error codes */
|
||||
XPC_MSG_DEF(NS_ERROR_DATABASE_CHANGED , "Flushing the profiles to disk would have overwritten changes made elsewhere.")
|
||||
|
@ -11695,12 +11695,6 @@
|
||||
value: true
|
||||
mirror: always
|
||||
|
||||
# Block 3rd party emailtracking resources.
|
||||
- name: privacy.trackingprotection.emailtracking.enabled
|
||||
type: bool
|
||||
value: @IS_NIGHTLY_BUILD@
|
||||
mirror: always
|
||||
|
||||
# Whether Origin Telemetry should be enabled.
|
||||
# NOTE: if telemetry.origin_telemetry_test_mode.enabled is enabled, this pref
|
||||
# won't have any effect.
|
||||
|
@ -3781,11 +3781,9 @@ pref("urlclassifier.features.socialtracking.blacklistTables", "social-tracking-p
|
||||
pref("urlclassifier.features.socialtracking.whitelistTables", "mozstd-trackwhite-digest256,google-trackwhite-digest256");
|
||||
pref("urlclassifier.features.socialtracking.annotate.blacklistTables", "social-tracking-protection-facebook-digest256,social-tracking-protection-linkedin-digest256,social-tracking-protection-twitter-digest256");
|
||||
pref("urlclassifier.features.socialtracking.annotate.whitelistTables", "mozstd-trackwhite-digest256,google-trackwhite-digest256");
|
||||
pref("urlclassifier.features.emailtracking.blocklistTables", "base-email-track-digest256");
|
||||
pref("urlclassifier.features.emailtracking.allowlistTables", "mozstd-trackwhite-digest256");
|
||||
|
||||
// These tables will never trigger a gethash call.
|
||||
pref("urlclassifier.disallow_completions", "goog-downloadwhite-digest256,base-track-digest256,mozstd-trackwhite-digest256,content-track-digest256,mozplugin-block-digest256,mozplugin2-block-digest256,goog-passwordwhite-proto,ads-track-digest256,social-track-digest256,analytics-track-digest256,base-fingerprinting-track-digest256,content-fingerprinting-track-digest256,base-cryptomining-track-digest256,content-cryptomining-track-digest256,fanboyannoyance-ads-digest256,fanboysocial-ads-digest256,easylist-ads-digest256,easyprivacy-ads-digest256,adguard-ads-digest256,social-tracking-protection-digest256,social-tracking-protection-facebook-digest256,social-tracking-protection-linkedin-digest256,social-tracking-protection-twitter-digest256,base-email-track-digest256,content-email-track-digest256");
|
||||
pref("urlclassifier.disallow_completions", "goog-downloadwhite-digest256,base-track-digest256,mozstd-trackwhite-digest256,content-track-digest256,mozplugin-block-digest256,mozplugin2-block-digest256,goog-passwordwhite-proto,ads-track-digest256,social-track-digest256,analytics-track-digest256,base-fingerprinting-track-digest256,content-fingerprinting-track-digest256,base-cryptomining-track-digest256,content-cryptomining-track-digest256,fanboyannoyance-ads-digest256,fanboysocial-ads-digest256,easylist-ads-digest256,easyprivacy-ads-digest256,adguard-ads-digest256,social-tracking-protection-digest256,social-tracking-protection-facebook-digest256,social-tracking-protection-linkedin-digest256,social-tracking-protection-twitter-digest256");
|
||||
|
||||
// Workaround for Google Recaptcha
|
||||
pref("urlclassifier.trackingAnnotationSkipURLs", "google.com/recaptcha/,*.google.com/recaptcha/");
|
||||
@ -3857,7 +3855,7 @@ pref("browser.safebrowsing.reportPhishURL", "https://%LOCALE%.phish-report.mozil
|
||||
|
||||
// Mozilla Safe Browsing provider (for tracking protection and plugin blocking)
|
||||
pref("browser.safebrowsing.provider.mozilla.pver", "2.2");
|
||||
pref("browser.safebrowsing.provider.mozilla.lists", "base-track-digest256,mozstd-trackwhite-digest256,google-trackwhite-digest256,content-track-digest256,mozplugin-block-digest256,mozplugin2-block-digest256,ads-track-digest256,social-track-digest256,analytics-track-digest256,base-fingerprinting-track-digest256,content-fingerprinting-track-digest256,base-cryptomining-track-digest256,content-cryptomining-track-digest256,fanboyannoyance-ads-digest256,fanboysocial-ads-digest256,easylist-ads-digest256,easyprivacy-ads-digest256,adguard-ads-digest256,social-tracking-protection-digest256,social-tracking-protection-facebook-digest256,social-tracking-protection-linkedin-digest256,social-tracking-protection-twitter-digest256,base-email-track-digest256,content-email-track-digest256");
|
||||
pref("browser.safebrowsing.provider.mozilla.lists", "base-track-digest256,mozstd-trackwhite-digest256,google-trackwhite-digest256,content-track-digest256,mozplugin-block-digest256,mozplugin2-block-digest256,ads-track-digest256,social-track-digest256,analytics-track-digest256,base-fingerprinting-track-digest256,content-fingerprinting-track-digest256,base-cryptomining-track-digest256,content-cryptomining-track-digest256,fanboyannoyance-ads-digest256,fanboysocial-ads-digest256,easylist-ads-digest256,easyprivacy-ads-digest256,adguard-ads-digest256,social-tracking-protection-digest256,social-tracking-protection-facebook-digest256,social-tracking-protection-linkedin-digest256,social-tracking-protection-twitter-digest256");
|
||||
pref("browser.safebrowsing.provider.mozilla.updateURL", "https://shavar.services.mozilla.com/downloads?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2");
|
||||
pref("browser.safebrowsing.provider.mozilla.gethashURL", "https://shavar.services.mozilla.com/gethash?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2");
|
||||
// Set to a date in the past to force immediate download in new profiles.
|
||||
|
@ -122,12 +122,6 @@ interface nsIClassifiedChannel : nsISupports
|
||||
CLASSIFIED_SOCIALTRACKING_LINKEDIN = 0x0800,
|
||||
CLASSIFIED_SOCIALTRACKING_TWITTER = 0x1000,
|
||||
|
||||
/**
|
||||
* The following are about email tracking.
|
||||
*/
|
||||
CLASSIFIED_EMAILTRACKING = 0x2000,
|
||||
CLASSIFIED_EMAILTRACKING_CONTENT = 0x4000,
|
||||
|
||||
/**
|
||||
* This is exposed to help to identify tracking classification using the
|
||||
* basic lists.
|
||||
|
@ -1326,7 +1326,6 @@ interface nsILoadInfo : nsISupports
|
||||
const uint32_t BLOCKING_REASON_CLASSIFY_CRYPTOMINING_URI = 2007;
|
||||
const uint32_t BLOCKING_REASON_CLASSIFY_FINGERPRINTING_URI = 2008;
|
||||
const uint32_t BLOCKING_REASON_CLASSIFY_SOCIALTRACKING_URI = 2009;
|
||||
const uint32_t BLOCKING_REASON_CLASSIFY_EMAILTRACKING_URI = 2010;
|
||||
const uint32_t BLOCKING_REASON_MIXED_BLOCKED = 3001;
|
||||
// The general reason comes from nsCSPContext::permitsInternal(),
|
||||
// which is way too generic to distinguish an exact reason.
|
||||
|
@ -176,10 +176,6 @@ nsresult UrlClassifierCommon::SetBlockedContent(nsIChannel* channel,
|
||||
NS_SetRequestBlockingReason(
|
||||
channel, nsILoadInfo::BLOCKING_REASON_CLASSIFY_SOCIALTRACKING_URI);
|
||||
break;
|
||||
case NS_ERROR_EMAILTRACKING_URI:
|
||||
NS_SetRequestBlockingReason(
|
||||
channel, nsILoadInfo::BLOCKING_REASON_CLASSIFY_EMAILTRACKING_URI);
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH(
|
||||
"Missing nsILoadInfo::BLOCKING_REASON* for the classification error");
|
||||
|
@ -1,210 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "UrlClassifierFeatureEmailTrackingProtection.h"
|
||||
|
||||
#include "ChannelClassifierService.h"
|
||||
#include "mozilla/AntiTrackingUtils.h"
|
||||
#include "mozilla/net/UrlClassifierCommon.h"
|
||||
#include "mozilla/StaticPrefs_privacy.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsILoadContext.h"
|
||||
#include "nsIHttpChannelInternal.h"
|
||||
|
||||
namespace mozilla::net {
|
||||
|
||||
namespace {
|
||||
|
||||
#define EMAIL_TRACKING_PROTECTION_FEATURE_NAME "emailtracking-protection"
|
||||
|
||||
#define URLCLASSIFIER_EMAIL_TRACKING_BLOCKLIST \
|
||||
"urlclassifier.features.emailtracking.blocklistTables"
|
||||
#define URLCLASSIFIER_EMAIL_TRACKING_BLOCKLIST_TEST_ENTRIES \
|
||||
"urlclassifier.features.emailtracking.blocklistHosts"
|
||||
#define URLCLASSIFIER_EMAIL_TRACKING_ENTITYLIST \
|
||||
"urlclassifier.features.emailtracking.allowlistTables"
|
||||
#define URLCLASSIFIER_EMAIL_TRACKING_ENTITYLIST_TEST_ENTRIES \
|
||||
"urlclassifier.features.emailtracking.allowlistHosts"
|
||||
#define URLCLASSIFIER_EMAIL_TRACKING_PROTECTION_EXCEPTION_URLS \
|
||||
"urlclassifier.features.emailtracking.skipURLs"
|
||||
#define TABLE_EMAIL_TRACKING_BLOCKLIST_PREF "emailtracking-blocklist-pref"
|
||||
#define TABLE_EMAIL_TRACKING_ENTITYLIST_PREF "emailtracking-allowlist-pref"
|
||||
|
||||
StaticRefPtr<UrlClassifierFeatureEmailTrackingProtection>
|
||||
gFeatureEmailTrackingProtection;
|
||||
|
||||
std::vector<UrlClassifierCommon::ClassificationData> sClassificationData = {
|
||||
{"base-email-track-"_ns,
|
||||
nsIClassifiedChannel::ClassificationFlags::CLASSIFIED_EMAILTRACKING},
|
||||
{"content-email-track-"_ns, nsIClassifiedChannel::ClassificationFlags::
|
||||
CLASSIFIED_EMAILTRACKING_CONTENT},
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
UrlClassifierFeatureEmailTrackingProtection::
|
||||
UrlClassifierFeatureEmailTrackingProtection()
|
||||
: UrlClassifierFeatureAntiTrackingBase(
|
||||
nsLiteralCString(EMAIL_TRACKING_PROTECTION_FEATURE_NAME),
|
||||
nsLiteralCString(URLCLASSIFIER_EMAIL_TRACKING_BLOCKLIST),
|
||||
nsLiteralCString(URLCLASSIFIER_EMAIL_TRACKING_ENTITYLIST),
|
||||
nsLiteralCString(URLCLASSIFIER_EMAIL_TRACKING_BLOCKLIST_TEST_ENTRIES),
|
||||
nsLiteralCString(
|
||||
URLCLASSIFIER_EMAIL_TRACKING_ENTITYLIST_TEST_ENTRIES),
|
||||
nsLiteralCString(TABLE_EMAIL_TRACKING_BLOCKLIST_PREF),
|
||||
nsLiteralCString(TABLE_EMAIL_TRACKING_ENTITYLIST_PREF),
|
||||
nsLiteralCString(
|
||||
URLCLASSIFIER_EMAIL_TRACKING_PROTECTION_EXCEPTION_URLS)) {}
|
||||
|
||||
/* static */
|
||||
const char* UrlClassifierFeatureEmailTrackingProtection::Name() {
|
||||
return EMAIL_TRACKING_PROTECTION_FEATURE_NAME;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void UrlClassifierFeatureEmailTrackingProtection::MaybeInitialize() {
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
UC_LOG_LEAK(("UrlClassifierFeatureEmailTrackingProtection::MaybeInitialize"));
|
||||
|
||||
if (!gFeatureEmailTrackingProtection) {
|
||||
gFeatureEmailTrackingProtection =
|
||||
new UrlClassifierFeatureEmailTrackingProtection();
|
||||
gFeatureEmailTrackingProtection->InitializePreferences();
|
||||
}
|
||||
}
|
||||
|
||||
/* static */
|
||||
void UrlClassifierFeatureEmailTrackingProtection::MaybeShutdown() {
|
||||
UC_LOG_LEAK(("UrlClassifierFeatureEmailTrackingProtection::MaybeShutdown"));
|
||||
|
||||
if (gFeatureEmailTrackingProtection) {
|
||||
gFeatureEmailTrackingProtection->ShutdownPreferences();
|
||||
gFeatureEmailTrackingProtection = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/* static */
|
||||
already_AddRefed<UrlClassifierFeatureEmailTrackingProtection>
|
||||
UrlClassifierFeatureEmailTrackingProtection::MaybeCreate(nsIChannel* aChannel) {
|
||||
MOZ_ASSERT(aChannel);
|
||||
|
||||
UC_LOG_LEAK(
|
||||
("UrlClassifierFeatureEmailTrackingProtection::MaybeCreate - channel %p",
|
||||
aChannel));
|
||||
|
||||
// Check if the email tracking protection is enabled.
|
||||
if (!StaticPrefs::privacy_trackingprotection_emailtracking_enabled()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool isThirdParty = AntiTrackingUtils::IsThirdPartyChannel(aChannel);
|
||||
if (!isThirdParty) {
|
||||
UC_LOG(
|
||||
("UrlClassifierFeatureEmailTrackingProtection::MaybeCreate - "
|
||||
"skipping first party or top-level load for channel %p",
|
||||
aChannel));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!UrlClassifierCommon::ShouldEnableProtectionForChannel(aChannel)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MaybeInitialize();
|
||||
MOZ_ASSERT(gFeatureEmailTrackingProtection);
|
||||
|
||||
RefPtr<UrlClassifierFeatureEmailTrackingProtection> self =
|
||||
gFeatureEmailTrackingProtection;
|
||||
return self.forget();
|
||||
}
|
||||
|
||||
/* static */
|
||||
already_AddRefed<nsIUrlClassifierFeature>
|
||||
UrlClassifierFeatureEmailTrackingProtection::GetIfNameMatches(
|
||||
const nsACString& aName) {
|
||||
if (!aName.EqualsLiteral(EMAIL_TRACKING_PROTECTION_FEATURE_NAME)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MaybeInitialize();
|
||||
MOZ_ASSERT(gFeatureEmailTrackingProtection);
|
||||
|
||||
RefPtr<UrlClassifierFeatureEmailTrackingProtection> self =
|
||||
gFeatureEmailTrackingProtection;
|
||||
return self.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
UrlClassifierFeatureEmailTrackingProtection::ProcessChannel(
|
||||
nsIChannel* aChannel, const nsTArray<nsCString>& aList,
|
||||
const nsTArray<nsCString>& aHashes, bool* aShouldContinue) {
|
||||
NS_ENSURE_ARG_POINTER(aChannel);
|
||||
NS_ENSURE_ARG_POINTER(aShouldContinue);
|
||||
|
||||
bool isAllowListed = UrlClassifierCommon::IsAllowListed(aChannel);
|
||||
|
||||
// This is a blocking feature.
|
||||
*aShouldContinue = isAllowListed;
|
||||
|
||||
if (isAllowListed) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsAutoCString list;
|
||||
UrlClassifierCommon::TablesToString(aList, list);
|
||||
|
||||
ChannelBlockDecision decision =
|
||||
ChannelClassifierService::OnBeforeBlockChannel(aChannel, mName, list);
|
||||
if (decision != ChannelBlockDecision::Blocked) {
|
||||
uint32_t event =
|
||||
decision == ChannelBlockDecision::Replaced
|
||||
? nsIWebProgressListener::STATE_REPLACED_TRACKING_CONTENT
|
||||
: nsIWebProgressListener::STATE_ALLOWED_TRACKING_CONTENT;
|
||||
ContentBlockingNotifier::OnEvent(aChannel, event, false);
|
||||
|
||||
*aShouldContinue = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
UrlClassifierCommon::SetBlockedContent(aChannel, NS_ERROR_EMAILTRACKING_URI,
|
||||
list, ""_ns, ""_ns);
|
||||
|
||||
UC_LOG(
|
||||
("UrlClassifierFeatureEmailTrackingProtection::ProcessChannel - "
|
||||
"cancelling channel %p",
|
||||
aChannel));
|
||||
|
||||
nsCOMPtr<nsIHttpChannelInternal> httpChannel = do_QueryInterface(aChannel);
|
||||
if (httpChannel) {
|
||||
Unused << httpChannel->CancelByURLClassifier(NS_ERROR_EMAILTRACKING_URI);
|
||||
} else {
|
||||
Unused << aChannel->Cancel(NS_ERROR_EMAILTRACKING_URI);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
UrlClassifierFeatureEmailTrackingProtection::GetURIByListType(
|
||||
nsIChannel* aChannel, nsIUrlClassifierFeature::listType aListType,
|
||||
nsIUrlClassifierFeature::URIType* aURIType, nsIURI** aURI) {
|
||||
NS_ENSURE_ARG_POINTER(aChannel);
|
||||
NS_ENSURE_ARG_POINTER(aURIType);
|
||||
NS_ENSURE_ARG_POINTER(aURI);
|
||||
|
||||
if (aListType == nsIUrlClassifierFeature::blocklist) {
|
||||
*aURIType = nsIUrlClassifierFeature::blocklistURI;
|
||||
return aChannel->GetURI(aURI);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aListType == nsIUrlClassifierFeature::entitylist);
|
||||
|
||||
*aURIType = nsIUrlClassifierFeature::pairwiseEntitylistURI;
|
||||
return UrlClassifierCommon::CreatePairwiseEntityListURI(aChannel, aURI);
|
||||
}
|
||||
|
||||
} // namespace mozilla::net
|
@ -1,47 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_net_UrlClassifierFeatureEmailTrackingProtection_h
|
||||
#define mozilla_net_UrlClassifierFeatureEmailTrackingProtection_h
|
||||
|
||||
#include "UrlClassifierFeatureBase.h"
|
||||
|
||||
class nsIChannel;
|
||||
|
||||
namespace mozilla::net {
|
||||
|
||||
class UrlClassifierFeatureEmailTrackingProtection final
|
||||
: public UrlClassifierFeatureAntiTrackingBase {
|
||||
public:
|
||||
static const char* Name();
|
||||
|
||||
static void MaybeShutdown();
|
||||
|
||||
static already_AddRefed<UrlClassifierFeatureEmailTrackingProtection>
|
||||
MaybeCreate(nsIChannel* aChannel);
|
||||
|
||||
static already_AddRefed<nsIUrlClassifierFeature> GetIfNameMatches(
|
||||
const nsACString& aName);
|
||||
|
||||
NS_IMETHOD ProcessChannel(nsIChannel* aChannel,
|
||||
const nsTArray<nsCString>& aList,
|
||||
const nsTArray<nsCString>& aHashes,
|
||||
bool* aShouldContinue) override;
|
||||
|
||||
NS_IMETHOD GetURIByListType(nsIChannel* aChannel,
|
||||
nsIUrlClassifierFeature::listType aListType,
|
||||
nsIUrlClassifierFeature::URIType* aURIType,
|
||||
nsIURI** aURI) override;
|
||||
|
||||
private:
|
||||
UrlClassifierFeatureEmailTrackingProtection();
|
||||
|
||||
static void MaybeInitialize();
|
||||
};
|
||||
|
||||
} // namespace mozilla::net
|
||||
|
||||
#endif // mozilla_net_UrlClassifierFeatureEmailTrackingProtection_h
|
@ -9,7 +9,6 @@
|
||||
// List of Features
|
||||
#include "UrlClassifierFeatureCryptominingAnnotation.h"
|
||||
#include "UrlClassifierFeatureCryptominingProtection.h"
|
||||
#include "UrlClassifierFeatureEmailTrackingProtection.h"
|
||||
#include "UrlClassifierFeatureFingerprintingAnnotation.h"
|
||||
#include "UrlClassifierFeatureFingerprintingProtection.h"
|
||||
#include "UrlClassifierFeatureLoginReputation.h"
|
||||
@ -35,7 +34,6 @@ void UrlClassifierFeatureFactory::Shutdown() {
|
||||
|
||||
UrlClassifierFeatureCryptominingAnnotation::MaybeShutdown();
|
||||
UrlClassifierFeatureCryptominingProtection::MaybeShutdown();
|
||||
UrlClassifierFeatureEmailTrackingProtection::MaybeShutdown();
|
||||
UrlClassifierFeatureFingerprintingAnnotation::MaybeShutdown();
|
||||
UrlClassifierFeatureFingerprintingProtection::MaybeShutdown();
|
||||
UrlClassifierFeatureLoginReputation::MaybeShutdown();
|
||||
@ -60,12 +58,6 @@ void UrlClassifierFeatureFactory::GetFeaturesFromChannel(
|
||||
// feature order, and this could produce different results with a different
|
||||
// feature ordering.
|
||||
|
||||
// Email Tracking Protection
|
||||
feature = UrlClassifierFeatureEmailTrackingProtection::MaybeCreate(aChannel);
|
||||
if (feature) {
|
||||
aFeatures.AppendElement(feature);
|
||||
}
|
||||
|
||||
// Cryptomining Protection
|
||||
feature = UrlClassifierFeatureCryptominingProtection::MaybeCreate(aChannel);
|
||||
if (feature) {
|
||||
@ -148,13 +140,6 @@ UrlClassifierFeatureFactory::GetFeatureByName(const nsACString& aName) {
|
||||
return feature.forget();
|
||||
}
|
||||
|
||||
// Email Tracking Protection
|
||||
feature =
|
||||
UrlClassifierFeatureEmailTrackingProtection::GetIfNameMatches(aName);
|
||||
if (feature) {
|
||||
return feature.forget();
|
||||
}
|
||||
|
||||
// Fingerprinting Annotation
|
||||
feature =
|
||||
UrlClassifierFeatureFingerprintingAnnotation::GetIfNameMatches(aName);
|
||||
@ -230,12 +215,6 @@ void UrlClassifierFeatureFactory::GetFeatureNames(nsTArray<nsCString>& aArray) {
|
||||
aArray.AppendElement(name);
|
||||
}
|
||||
|
||||
// Email Tracking Protection
|
||||
name.Assign(UrlClassifierFeatureEmailTrackingProtection::Name());
|
||||
if (!name.IsEmpty()) {
|
||||
aArray.AppendElement(name);
|
||||
}
|
||||
|
||||
// Fingerprinting Annotation
|
||||
name.Assign(UrlClassifierFeatureFingerprintingAnnotation::Name());
|
||||
if (!name.IsEmpty()) {
|
||||
@ -319,9 +298,6 @@ static const BlockingErrorCode sBlockingErrorCodes[] = {
|
||||
{NS_ERROR_SOCIALTRACKING_URI,
|
||||
nsIWebProgressListener::STATE_BLOCKED_SOCIALTRACKING_CONTENT,
|
||||
"TrackerUriBlocked", "Tracking Protection"_ns},
|
||||
{NS_ERROR_EMAILTRACKING_URI,
|
||||
nsIWebProgressListener::STATE_BLOCKED_EMAILTRACKING_CONTENT,
|
||||
"TrackerUriBlocked", "Tracking Protection"_ns},
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
@ -36,7 +36,6 @@ UNIFIED_SOURCES += [
|
||||
"UrlClassifierFeatureCryptominingAnnotation.cpp",
|
||||
"UrlClassifierFeatureCryptominingProtection.cpp",
|
||||
"UrlClassifierFeatureCustomTables.cpp",
|
||||
"UrlClassifierFeatureEmailTrackingProtection.cpp",
|
||||
"UrlClassifierFeatureFactory.cpp",
|
||||
"UrlClassifierFeatureFingerprintingAnnotation.cpp",
|
||||
"UrlClassifierFeatureFingerprintingProtection.cpp",
|
||||
|
@ -352,8 +352,7 @@
|
||||
"id": "UrlClassificationFlags",
|
||||
"type": "string",
|
||||
"enum": ["fingerprinting", "fingerprinting_content", "cryptomining", "cryptomining_content",
|
||||
"emailtracking", "emailtracking_content", "tracking", "tracking_ad",
|
||||
"tracking_analytics", "tracking_social", "tracking_content",
|
||||
"tracking", "tracking_ad", "tracking_analytics", "tracking_social", "tracking_content",
|
||||
"any_basic_tracking", "any_strict_tracking", "any_social_tracking"],
|
||||
"description": "Tracking flags that match our internal tracking classification"
|
||||
},
|
||||
|
@ -63,8 +63,6 @@ static const ClassificationStruct classificationArray[] = {
|
||||
{CF::CLASSIFIED_FINGERPRINTING_CONTENT, MUC::Fingerprinting_content},
|
||||
{CF::CLASSIFIED_CRYPTOMINING, MUC::Cryptomining},
|
||||
{CF::CLASSIFIED_CRYPTOMINING_CONTENT, MUC::Cryptomining_content},
|
||||
{CF::CLASSIFIED_EMAILTRACKING, MUC::Emailtracking},
|
||||
{CF::CLASSIFIED_EMAILTRACKING_CONTENT, MUC::Emailtracking_content},
|
||||
{CF::CLASSIFIED_TRACKING, MUC::Tracking},
|
||||
{CF::CLASSIFIED_TRACKING_AD, MUC::Tracking_ad},
|
||||
{CF::CLASSIFIED_TRACKING_ANALYTICS, MUC::Tracking_analytics},
|
||||
|
@ -253,25 +253,6 @@ const FEATURES = [
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "emailtracking-protection",
|
||||
list: [
|
||||
"urlclassifier.features.emailtracking.blocklistTables",
|
||||
"urlclassifier.features.emailtracking.allowlistTables",
|
||||
],
|
||||
enabled() {
|
||||
return Services.prefs.getBoolPref(
|
||||
"privacy.trackingprotection.emailtracking.enabled",
|
||||
false
|
||||
);
|
||||
},
|
||||
update() {
|
||||
return Services.prefs.getBoolPref(
|
||||
"browser.safebrowsing.features.emailtracking.update",
|
||||
this.enabled()
|
||||
);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
var SafeBrowsing = {
|
||||
|
@ -19,9 +19,6 @@ const SOCIAL_ANNOTATION_TABLE_PREF =
|
||||
const SOCIAL_TRACKING_TABLE_NAME = "mochitest4-track-simple";
|
||||
const SOCIAL_TRACKING_TABLE_PREF =
|
||||
"urlclassifier.features.socialtracking.blacklistTables";
|
||||
const EMAIL_TRACKING_TABLE_NAME = "mochitest5-track-simple";
|
||||
const EMAIL_TRACKING_TABLE_PREF =
|
||||
"urlclassifier.features.emailtracking.blocklistTables";
|
||||
|
||||
let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
|
||||
@ -39,7 +36,6 @@ var UrlClassifierTestUtils = {
|
||||
let trackingURL3 = "trackertest.org/";
|
||||
let entitylistedURL = "itisatrap.org/?resource=itisatracker.org";
|
||||
let socialTrackingURL = "social-tracking.example.org/";
|
||||
let emailTrackingURL = "email-tracking.example.org/";
|
||||
|
||||
let annotationUpdate =
|
||||
"n:1000\ni:" +
|
||||
@ -116,15 +112,6 @@ var UrlClassifierTestUtils = {
|
||||
"\n" +
|
||||
socialTrackingURL +
|
||||
"\n";
|
||||
let emailTrackingUpdate =
|
||||
"n:1000\ni:" +
|
||||
EMAIL_TRACKING_TABLE_NAME +
|
||||
"\nad:1\n" +
|
||||
"a:1:32:" +
|
||||
emailTrackingURL.length +
|
||||
"\n" +
|
||||
emailTrackingURL +
|
||||
"\n";
|
||||
let entitylistUpdate =
|
||||
"n:1000\ni:" +
|
||||
ENTITYLIST_TABLE_NAME +
|
||||
@ -161,11 +148,6 @@ var UrlClassifierTestUtils = {
|
||||
name: SOCIAL_TRACKING_TABLE_NAME,
|
||||
update: socialTrackingUpdate,
|
||||
},
|
||||
{
|
||||
pref: EMAIL_TRACKING_TABLE_PREF,
|
||||
name: EMAIL_TRACKING_TABLE_NAME,
|
||||
update: emailTrackingUpdate,
|
||||
},
|
||||
{
|
||||
pref: ENTITYLIST_TABLE_PREF,
|
||||
name: ENTITYLIST_TABLE_NAME,
|
||||
@ -201,7 +183,6 @@ var UrlClassifierTestUtils = {
|
||||
Services.prefs.clearUserPref(ANNOTATION_ENTITYLIST_TABLE_PREF);
|
||||
Services.prefs.clearUserPref(TRACKING_TABLE_PREF);
|
||||
Services.prefs.clearUserPref(SOCIAL_TRACKING_TABLE_PREF);
|
||||
Services.prefs.clearUserPref(EMAIL_TRACKING_TABLE_PREF);
|
||||
Services.prefs.clearUserPref(ENTITYLIST_TABLE_PREF);
|
||||
},
|
||||
|
||||
|
@ -60,6 +60,5 @@ skip-if = verify
|
||||
[test_fingerprinting_annotate.html]
|
||||
[test_cryptomining.html]
|
||||
[test_cryptomining_annotate.html]
|
||||
[test_emailtracking.html]
|
||||
[test_socialtracking.html]
|
||||
[test_socialtracking_annotate.html]
|
||||
|
@ -38,7 +38,6 @@ async function runTest(test) {
|
||||
[ "privacy.trackingprotection.enabled", false ],
|
||||
[ "privacy.trackingprotection.annotate_channels", false ],
|
||||
[ "privacy.trackingprotection.cryptomining.enabled", true ],
|
||||
[ "privacy.trackingprotection.emailtracking.enabled", false ],
|
||||
[ "privacy.trackingprotection.fingerprinting.enabled", false ],
|
||||
[ "privacy.trackingprotection.socialtracking.enabled", false ],
|
||||
]});
|
||||
|
@ -21,7 +21,6 @@ runTests(SpecialPowers.Ci.nsIClassifiedChannel.CLASSIFIED_CRYPTOMINING,
|
||||
["urlclassifier.features.socialtracking.annotate.blacklistHosts", ""],
|
||||
["urlclassifier.features.socialtracking.annotate.blacklistTables", ""],
|
||||
["privacy.trackingprotection.socialtracking.enabled", false],
|
||||
["privacy.trackingprotection.emailtracking.enabled", false],
|
||||
],
|
||||
false /* a tracking resource */);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
@ -1,129 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test the email tracking classifier</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
var tests = [
|
||||
// All disabled.
|
||||
{ config: [ false, false ], loadExpected: true },
|
||||
|
||||
// Just entitylisted.
|
||||
{ config: [ false, true ], loadExpected: true },
|
||||
|
||||
// Just blocklisted.
|
||||
{ config: [ true, false ], loadExpected: false },
|
||||
|
||||
// entitylist + blocklist: entitylist wins
|
||||
{ config: [ true, true ], loadExpected: true },
|
||||
];
|
||||
|
||||
function prefValue(value, what) {
|
||||
return value ? what : "";
|
||||
}
|
||||
|
||||
async function runTest(test) {
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
[ "urlclassifier.features.emailtracking.blocklistHosts", prefValue(test.config[0], "example.com") ],
|
||||
[ "urlclassifier.features.emailtracking.allowlistHosts", prefValue(test.config[1], "mochi.test,mochi.xorigin-test") ],
|
||||
[ "urlclassifier.features.emailtracking.blocklistTables", prefValue(test.config[0], "mochitest5-track-simple") ],
|
||||
[ "urlclassifier.features.emailtracking.allowlistTables", "" ],
|
||||
[ "privacy.trackingprotection.enabled", false ],
|
||||
[ "privacy.trackingprotection.annotate_channels", false ],
|
||||
[ "privacy.trackingprotection.cryptomining.enabled", false ],
|
||||
[ "privacy.trackingprotection.emailtracking.enabled", true ],
|
||||
[ "privacy.trackingprotection.fingerprinting.enabled", false ],
|
||||
[ "privacy.trackingprotection.socialtracking.enabled", false ],
|
||||
]});
|
||||
|
||||
info("Testing: " + JSON.stringify(test.config) + "\n");
|
||||
|
||||
// Let's load an image with a random query string to avoid network cache.
|
||||
let result = await new Promise(resolve => {
|
||||
let image = new Image();
|
||||
image.src = "http://example.com/tests/toolkit/components/url-classifier/tests/mochitest/raptor.jpg?" + Math.random();
|
||||
image.onload = _ => resolve(true);
|
||||
image.onerror = _ => resolve(false);
|
||||
});
|
||||
|
||||
is(result, test.loadExpected, "Image loading happened correctly");
|
||||
|
||||
// Let's load an image with a random query string to avoid network cache.
|
||||
result = await new Promise(resolve => {
|
||||
let image = new Image();
|
||||
image.src = "http://email-tracking.example.org/tests/toolkit/components/url-classifier/tests/mochitest/raptor.jpg?" + Math.random();
|
||||
image.onload = _ => resolve(true);
|
||||
image.onerror = _ => resolve(false);
|
||||
});
|
||||
|
||||
is(result, test.loadExpected, "Image loading happened correctly (by table)");
|
||||
|
||||
// Let's load a script with a random query string to avoid network cache.
|
||||
result = await new Promise(resolve => {
|
||||
let script = document.createElement("script");
|
||||
script.setAttribute(
|
||||
"src",
|
||||
"http://example.com/tests/toolkit/components/url-classifier/tests/mochitest/evil.js?" +
|
||||
Math.random()
|
||||
);
|
||||
script.onload = _ => resolve(true);
|
||||
script.onerror = _ => resolve(false);
|
||||
document.body.appendChild(script);
|
||||
});
|
||||
|
||||
is(result, test.loadExpected, "Script loading happened correctly");
|
||||
|
||||
// Let's load a script with a random query string to avoid network cache.
|
||||
result = await new Promise(resolve => {
|
||||
let script = document.createElement("script");
|
||||
script.setAttribute(
|
||||
"src",
|
||||
"http://email-tracking.example.org/tests/toolkit/components/url-classifier/tests/mochitest/evil.js?" +
|
||||
Math.random()
|
||||
);
|
||||
script.onload = _ => resolve(true);
|
||||
script.onerror = _ => resolve(false);
|
||||
document.body.appendChild(script);
|
||||
});
|
||||
|
||||
is(result, test.loadExpected, "Script loading happened correctly (by table)");
|
||||
}
|
||||
|
||||
async function runTests() {
|
||||
let chromeScript = SpecialPowers.loadChromeScript(_ => {
|
||||
const {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm");
|
||||
|
||||
addMessageListener("loadTrackers", __ => {
|
||||
return UrlClassifierTestUtils.addTestTrackers();
|
||||
});
|
||||
|
||||
addMessageListener("unloadTrackers", __ => {
|
||||
UrlClassifierTestUtils.cleanupTestTrackers();
|
||||
});
|
||||
});
|
||||
|
||||
await chromeScript.sendQuery("loadTrackers");
|
||||
|
||||
for (let test in tests) {
|
||||
await runTest(tests[test]);
|
||||
}
|
||||
|
||||
await chromeScript.sendQuery("unloadTrackers");
|
||||
|
||||
chromeScript.destroy();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runTests();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -38,7 +38,6 @@ async function runTest(test) {
|
||||
[ "privacy.trackingprotection.enabled", false ],
|
||||
[ "privacy.trackingprotection.annotate_channels", false ],
|
||||
[ "privacy.trackingprotection.cryptomining.enabled", false ],
|
||||
[ "privacy.trackingprotection.emailtracking.enabled", false ],
|
||||
[ "privacy.trackingprotection.fingerprinting.enabled", true ],
|
||||
[ "privacy.trackingprotection.socialtracking.enabled", false ],
|
||||
]});
|
||||
|
@ -21,7 +21,6 @@ runTests(SpecialPowers.Ci.nsIClassifiedChannel.CLASSIFIED_FINGERPRINTING,
|
||||
["urlclassifier.features.socialtracking.annotate.blacklistHosts", ""],
|
||||
["urlclassifier.features.socialtracking.annotate.blacklistTables", ""],
|
||||
["privacy.trackingprotection.socialtracking.enabled", false],
|
||||
["privacy.trackingprotection.emailtracking.enabled", false],
|
||||
],
|
||||
true /* a tracking resource */);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
@ -38,7 +38,6 @@ async function runTest(test) {
|
||||
[ "privacy.trackingprotection.enabled", false ],
|
||||
[ "privacy.trackingprotection.annotate_channels", false ],
|
||||
[ "privacy.trackingprotection.cryptomining.enabled", false ],
|
||||
[ "privacy.trackingprotection.emailtracking.enabled", false ],
|
||||
[ "privacy.trackingprotection.fingerprinting.enabled", false ],
|
||||
[ "privacy.trackingprotection.socialtracking.enabled", true ],
|
||||
]});
|
||||
|
@ -22,7 +22,6 @@ runTests(SpecialPowers.Ci.nsIClassifiedChannel.CLASSIFIED_SOCIALTRACKING,
|
||||
["urlclassifier.features.cryptomining.annotate.blacklistTables", ""],
|
||||
["privacy.trackingprotection.cryptomining.enabled", false],
|
||||
["privacy.trackingprotection.socialtracking.enabled", true],
|
||||
["privacy.trackingprotection.emailtracking.enabled", false],
|
||||
],
|
||||
false /* a tracking resource */);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
@ -324,12 +324,6 @@ interface nsIWebProgressListener : nsISupports
|
||||
*
|
||||
* STATE_ALLOWED_TRACKING_CONTENT
|
||||
* Tracking content which should be blocked from loading was allowed.
|
||||
*
|
||||
* STATE_BLOCKED_EMAILTRACING_CONTENT
|
||||
* EmailTracking content has been blocked from loading.
|
||||
*
|
||||
* STATE_LOADED_EMAILTRACKING_CONTENT
|
||||
* EmailTracking content has been loaded.
|
||||
*/
|
||||
const unsigned long STATE_BLOCKED_TRACKING_CONTENT = 0x00001000;
|
||||
const unsigned long STATE_LOADED_LEVEL_1_TRACKING_CONTENT = 0x00002000;
|
||||
@ -352,8 +346,6 @@ interface nsIWebProgressListener : nsISupports
|
||||
const unsigned long STATE_LOADED_SOCIALTRACKING_CONTENT = 0x00020000;
|
||||
const unsigned long STATE_REPLACED_TRACKING_CONTENT = 0x00000010;
|
||||
const unsigned long STATE_ALLOWED_TRACKING_CONTENT = 0x00000020;
|
||||
const unsigned long STATE_BLOCKED_EMAILTRACKING_CONTENT = 0x00400000;
|
||||
const unsigned long STATE_LOADED_EMAILTRACKING_CONTENT = 0x00800000;
|
||||
|
||||
/**
|
||||
* Flag for HTTPS-Only Mode upgrades
|
||||
|
@ -945,7 +945,6 @@ with modules["URILOADER"]:
|
||||
errors["NS_ERROR_FINGERPRINTING_URI"] = FAILURE(41)
|
||||
errors["NS_ERROR_CRYPTOMINING_URI"] = FAILURE(42)
|
||||
errors["NS_ERROR_SOCIALTRACKING_URI"] = FAILURE(43)
|
||||
errors["NS_ERROR_EMAILTRACKING_URI"] = FAILURE(44)
|
||||
# Used when "Save Link As..." doesn't see the headers quickly enough to
|
||||
# choose a filename. See nsContextMenu.js.
|
||||
errors["NS_ERROR_SAVE_LINK_AS_TIMEOUT"] = FAILURE(32)
|
||||
|
Loading…
Reference in New Issue
Block a user