зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 5 changesets (bug 1533074) for eslint failure
Backed out changeset 36c6a7178a5c (bug 1533074) Backed out changeset 7e6a8fadff5b (bug 1533074) Backed out changeset 2a0494fed543 (bug 1533074) Backed out changeset 38470d2dd98c (bug 1533074) Backed out changeset af4e03d1f5c8 (bug 1533074)
This commit is contained in:
Родитель
21180cb43c
Коммит
3ef1df6038
|
@ -1247,9 +1247,7 @@ pref("services.sync.prefs.sync.privacy.fuzzyfox.clockgrainus", false);
|
|||
pref("services.sync.prefs.sync.privacy.sanitize.sanitizeOnShutdown", true);
|
||||
pref("services.sync.prefs.sync.privacy.trackingprotection.enabled", true);
|
||||
pref("services.sync.prefs.sync.privacy.trackingprotection.cryptomining.enabled", true);
|
||||
pref("services.sync.prefs.sync.privacy.trackingprotection.cryptomining.annotate.enabled", true);
|
||||
pref("services.sync.prefs.sync.privacy.trackingprotection.fingerprinting.enabled", true);
|
||||
pref("services.sync.prefs.sync.privacy.trackingprotection.fingerprinting.annotate.enabled", true);
|
||||
pref("services.sync.prefs.sync.privacy.trackingprotection.pbmode.enabled", true);
|
||||
pref("services.sync.prefs.sync.privacy.resistFingerprinting", true);
|
||||
pref("services.sync.prefs.sync.privacy.reduceTimerPrecision", true);
|
||||
|
|
|
@ -5,18 +5,15 @@
|
|||
"use strict";
|
||||
|
||||
const TRACKING_PAGE = "http://example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
|
||||
const CM_PROTECTION_PREF = "privacy.trackingprotection.cryptomining.enabled";
|
||||
const CM_ANNOTATION_PREF = "privacy.trackingprotection.cryptomining.annotate.enabled";
|
||||
const CM_PREF = "privacy.trackingprotection.cryptomining.enabled";
|
||||
|
||||
add_task(async function setup() {
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
[ ContentBlocking.prefIntroCount, ContentBlocking.MAX_INTROS ],
|
||||
[ "urlclassifier.features.cryptomining.blacklistHosts", "cryptomining.example.com" ],
|
||||
[ "urlclassifier.features.cryptomining.annotate.blacklistHosts", "cryptomining.example.com" ],
|
||||
[ "privacy.trackingprotection.enabled", false ],
|
||||
[ "privacy.trackingprotection.annotate_channels", false ],
|
||||
[ "privacy.trackingprotection.fingerprinting.enabled", false ],
|
||||
[ "privacy.trackingprotection.fingerprinting.annotate.enabled", false ],
|
||||
]});
|
||||
});
|
||||
|
||||
|
@ -107,8 +104,7 @@ async function testSubview(hasException) {
|
|||
}
|
||||
|
||||
add_task(async function test() {
|
||||
Services.prefs.setBoolPref(CM_PROTECTION_PREF, true);
|
||||
Services.prefs.setBoolPref(CM_ANNOTATION_PREF, true);
|
||||
Services.prefs.setBoolPref(CM_PREF, true);
|
||||
|
||||
await testIdentityState(false);
|
||||
await testIdentityState(true);
|
||||
|
@ -116,7 +112,6 @@ add_task(async function test() {
|
|||
await testSubview(false);
|
||||
await testSubview(true);
|
||||
|
||||
Services.prefs.clearUserPref(CM_PROTECTION_PREF);
|
||||
Services.prefs.clearUserPref(CM_ANNOTATION_PREF);
|
||||
Services.prefs.clearUserPref(CM_PREF);
|
||||
});
|
||||
|
||||
|
|
|
@ -5,18 +5,15 @@
|
|||
"use strict";
|
||||
|
||||
const TRACKING_PAGE = "http://example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
|
||||
const FP_PROTECTION_PREF = "privacy.trackingprotection.fingerprinting.enabled";
|
||||
const FP_ANNOTATION_PREF = "privacy.trackingprotection.fingerprinting.annotate.enabled";
|
||||
const FP_PREF = "privacy.trackingprotection.fingerprinting.enabled";
|
||||
|
||||
add_task(async function setup() {
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
[ ContentBlocking.prefIntroCount, ContentBlocking.MAX_INTROS ],
|
||||
[ "urlclassifier.features.fingerprinting.blacklistHosts", "fingerprinting.example.com" ],
|
||||
[ "urlclassifier.features.fingerprinting.annotate.blacklistHosts", "fingerprinting.example.com" ],
|
||||
[ "privacy.trackingprotection.enabled", false ],
|
||||
[ "privacy.trackingprotection.annotate_channels", false ],
|
||||
[ "privacy.trackingprotection.cryptomining.enabled", false ],
|
||||
[ "privacy.trackingprotection.cryptomining.annotate.enabled", false ],
|
||||
]});
|
||||
});
|
||||
|
||||
|
@ -107,8 +104,7 @@ async function testSubview(hasException) {
|
|||
}
|
||||
|
||||
add_task(async function test() {
|
||||
Services.prefs.setBoolPref(FP_PROTECTION_PREF, true);
|
||||
Services.prefs.setBoolPref(FP_ANNOTATION_PREF, true);
|
||||
Services.prefs.setBoolPref(FP_PREF, true);
|
||||
|
||||
await testIdentityState(false);
|
||||
await testIdentityState(true);
|
||||
|
@ -116,6 +112,6 @@ add_task(async function test() {
|
|||
await testSubview(false);
|
||||
await testSubview(true);
|
||||
|
||||
Services.prefs.clearUserPref(FP_PROTECTION_PREF);
|
||||
Services.prefs.clearUserPref(FP_ANNOTATION_PREF);
|
||||
Services.prefs.clearUserPref(FP_PREF);
|
||||
});
|
||||
|
||||
|
|
|
@ -3340,7 +3340,7 @@ void ScriptLoader::HandleLoadError(ScriptLoadRequest* aRequest,
|
|||
nsresult aResult) {
|
||||
/*
|
||||
* Handle script not loading error because source was an tracking URL (or
|
||||
* fingerprinting, cryptomining, etc).
|
||||
* fingerprinting, cryptoming, etc).
|
||||
* We make a note of this script node by including it in a dedicated
|
||||
* array of blocked tracking nodes under its parent document.
|
||||
*/
|
||||
|
|
|
@ -2007,32 +2007,22 @@ VARCACHE_PREF(
|
|||
)
|
||||
|
||||
// Block 3rd party fingerprinting resources.
|
||||
# define PREF_VALUE false
|
||||
VARCACHE_PREF(
|
||||
"privacy.trackingprotection.fingerprinting.enabled",
|
||||
privacy_trackingprotection_fingerprinting_enabled,
|
||||
bool, false
|
||||
)
|
||||
|
||||
// Annotate fingerprinting resources.
|
||||
VARCACHE_PREF(
|
||||
"privacy.trackingprotection.fingerprinting.annotate.enabled",
|
||||
privacy_trackingprotection_fingerprinting_annotate_enabled,
|
||||
bool, false
|
||||
bool, PREF_VALUE
|
||||
)
|
||||
#undef PREF_VALUE
|
||||
|
||||
// Block 3rd party cryptomining resources.
|
||||
# define PREF_VALUE false
|
||||
VARCACHE_PREF(
|
||||
"privacy.trackingprotection.cryptomining.enabled",
|
||||
privacy_trackingprotection_cryptomining_enabled,
|
||||
bool, false
|
||||
)
|
||||
|
||||
// Annotate cryptomining resources.
|
||||
VARCACHE_PREF(
|
||||
"privacy.trackingprotection.cryptomining.annotate.enabled",
|
||||
privacy_trackingprotection_cryptomining_annotate_enabled,
|
||||
bool, false
|
||||
bool, PREF_VALUE
|
||||
)
|
||||
#undef PREF_VALUE
|
||||
|
||||
// Lower the priority of network loads for resources on the tracking protection
|
||||
// list. Note that this requires the
|
||||
|
|
|
@ -48,8 +48,7 @@ SimpleChannelParent::NotifyCookieBlocked(uint32_t aRejectedReason) {
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SimpleChannelParent::NotifyClassificationFlags(uint32_t aClassificationFlags,
|
||||
bool aIsThirdParty) {
|
||||
SimpleChannelParent::NotifyTrackingResource(bool aIsThirdParty) {
|
||||
// Nothing to do.
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -67,15 +67,12 @@ interface nsIParentChannel : nsIStreamListener
|
|||
|
||||
/**
|
||||
* Called to notify the HttpChannelChild that the resource being loaded
|
||||
* has been classified.
|
||||
* @param aClassificationFlags
|
||||
* What classifier identifies this channel.
|
||||
* is on the tracking protection list.
|
||||
* @param aIsThirdParty
|
||||
* Whether or not the resourced is considered first-party
|
||||
* with the URI of the window.
|
||||
*/
|
||||
[noscript] void notifyClassificationFlags(in uint32_t aClassificationFlags,
|
||||
in bool aIsThirdParty);
|
||||
[noscript] void notifyTrackingResource(in bool aIsThirdParty);
|
||||
|
||||
/**
|
||||
* Called to invoke deletion of the IPC protocol.
|
||||
|
|
|
@ -54,7 +54,7 @@ class CookieServiceParent : public PCookieServiceParent {
|
|||
|
||||
mozilla::ipc::IPCResult RecvPrepareCookieList(
|
||||
const URIParams &aHost, const bool &aIsForeign,
|
||||
const bool &aIsTrackingResource,
|
||||
const bool &aIsTackingResource,
|
||||
const bool &aFirstPartyStorageAccessGranted,
|
||||
const bool &aIsSafeTopLevelNav, const bool &aIsSameSiteForeign,
|
||||
const OriginAttributes &aAttrs);
|
||||
|
|
|
@ -48,8 +48,7 @@ DataChannelParent::NotifyCookieBlocked(uint32_t aRejectedReason) {
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DataChannelParent::NotifyClassificationFlags(uint32_t aClassificationFlags,
|
||||
bool aIsThirdParty) {
|
||||
DataChannelParent::NotifyTrackingResource(bool aIsThirdParty) {
|
||||
// Nothing to do.
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -48,8 +48,7 @@ FileChannelParent::NotifyCookieBlocked(uint32_t aRejectedReason) {
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FileChannelParent::NotifyClassificationFlags(uint32_t aClassificationFlags,
|
||||
bool aIsThirdParty) {
|
||||
FileChannelParent::NotifyTrackingResource(bool aIsThirdParty) {
|
||||
// Nothing to do.
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -516,8 +516,7 @@ FTPChannelParent::NotifyCookieBlocked(uint32_t aRejectedReason) {
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FTPChannelParent::NotifyClassificationFlags(uint32_t aClassificationFlags,
|
||||
bool aIsThirdParty) {
|
||||
FTPChannelParent::NotifyTrackingResource(bool aIsThirdParty) {
|
||||
// One day, this should probably be filled in.
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -344,22 +344,21 @@ IPCResult HttpBackgroundChannelChild::RecvNotifyCookieBlocked(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
IPCResult HttpBackgroundChannelChild::RecvNotifyClassificationFlags(
|
||||
const uint32_t& aClassificationFlags, const bool& aIsThirdParty) {
|
||||
IPCResult HttpBackgroundChannelChild::RecvNotifyTrackingResource(
|
||||
const bool& aIsThirdParty) {
|
||||
LOG(
|
||||
("HttpBackgroundChannelChild::RecvNotifyClassificationFlags "
|
||||
"classificationFlags=%" PRIu32 ", thirdparty=%d [this=%p]\n",
|
||||
aClassificationFlags, static_cast<int>(aIsThirdParty), this));
|
||||
("HttpBackgroundChannelChild::RecvNotifyTrackingResource thirdparty=%d "
|
||||
"[this=%p]\n",
|
||||
static_cast<int>(aIsThirdParty), this));
|
||||
MOZ_ASSERT(OnSocketThread());
|
||||
|
||||
if (NS_WARN_IF(!mChannelChild)) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
// NotifyClassificationFlags has no order dependency to OnStartRequest.
|
||||
// NotifyTrackingResource has no order dependency to OnStartRequest.
|
||||
// It this be handled as soon as possible
|
||||
mChannelChild->ProcessNotifyClassificationFlags(aClassificationFlags,
|
||||
aIsThirdParty);
|
||||
mChannelChild->ProcessNotifyTrackingResource(aIsThirdParty);
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
|
|
@ -71,8 +71,7 @@ class HttpBackgroundChannelChild final : public PHttpBackgroundChannelChild {
|
|||
|
||||
IPCResult RecvNotifyCookieBlocked(const uint32_t& aRejectedReason);
|
||||
|
||||
IPCResult RecvNotifyClassificationFlags(const uint32_t& aClassificationFlags,
|
||||
const bool& aIsThirdParty);
|
||||
IPCResult RecvNotifyTrackingResource(const bool& aIsThirdParty);
|
||||
|
||||
IPCResult RecvNotifyFlashPluginStateChanged(
|
||||
const nsIHttpChannel::FlashPluginState& aState);
|
||||
|
|
|
@ -405,12 +405,11 @@ bool HttpBackgroundChannelParent::OnNotifyCookieBlocked(
|
|||
return SendNotifyCookieBlocked(aRejectedReason);
|
||||
}
|
||||
|
||||
bool HttpBackgroundChannelParent::OnNotifyClassificationFlags(
|
||||
uint32_t aClassificationFlags, bool aIsThirdParty) {
|
||||
bool HttpBackgroundChannelParent::OnNotifyTrackingResource(bool aIsThirdParty) {
|
||||
LOG(
|
||||
("HttpBackgroundChannelParent::OnNotifyClassificationFlags "
|
||||
"classificationFlags=%" PRIu32 ", thirdparty=%d [this=%p]\n",
|
||||
aClassificationFlags, static_cast<int>(aIsThirdParty), this));
|
||||
("HttpBackgroundChannelParent::OnNotifyTrackingResource thirdparty=%d "
|
||||
"[this=%p]\n",
|
||||
static_cast<int>(aIsThirdParty), this));
|
||||
AssertIsInMainProcess();
|
||||
|
||||
if (NS_WARN_IF(!mIPCOpened)) {
|
||||
|
@ -420,10 +419,10 @@ bool HttpBackgroundChannelParent::OnNotifyClassificationFlags(
|
|||
if (!IsOnBackgroundThread()) {
|
||||
MutexAutoLock lock(mBgThreadMutex);
|
||||
nsresult rv = mBackgroundThread->Dispatch(
|
||||
NewRunnableMethod<uint32_t, bool>(
|
||||
"net::HttpBackgroundChannelParent::OnNotifyClassificationFlags",
|
||||
this, &HttpBackgroundChannelParent::OnNotifyClassificationFlags,
|
||||
aClassificationFlags, aIsThirdParty),
|
||||
NewRunnableMethod<bool>(
|
||||
"net::HttpBackgroundChannelParent::OnNotifyTrackingResource", this,
|
||||
&HttpBackgroundChannelParent::OnNotifyTrackingResource,
|
||||
aIsThirdParty),
|
||||
NS_DISPATCH_NORMAL);
|
||||
|
||||
MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv));
|
||||
|
@ -431,7 +430,7 @@ bool HttpBackgroundChannelParent::OnNotifyClassificationFlags(
|
|||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
return SendNotifyClassificationFlags(aClassificationFlags, aIsThirdParty);
|
||||
return SendNotifyTrackingResource(aIsThirdParty);
|
||||
}
|
||||
|
||||
bool HttpBackgroundChannelParent::OnNotifyFlashPluginStateChanged(
|
||||
|
|
|
@ -73,9 +73,8 @@ class HttpBackgroundChannelParent final : public PHttpBackgroundChannelParent {
|
|||
// To send NotifyCookieBlocked message over background channel.
|
||||
bool OnNotifyCookieBlocked(uint32_t aRejectedReason);
|
||||
|
||||
// To send NotifyClassificationFlags message over background channel.
|
||||
bool OnNotifyClassificationFlags(uint32_t aClassificationFlags,
|
||||
bool aIsThirdParty);
|
||||
// To send NotifyTrackingResource message over background channel.
|
||||
bool OnNotifyTrackingResource(bool aIsThirdParty);
|
||||
|
||||
// To send NotifyFlashPluginStateChanged message over background channel.
|
||||
bool OnNotifyFlashPluginStateChanged(nsIHttpChannel::FlashPluginState aState);
|
||||
|
|
|
@ -64,7 +64,6 @@
|
|||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/Move.h"
|
||||
#include "mozilla/net/PartiallySeekableInputStream.h"
|
||||
#include "mozilla/net/UrlClassifierCommon.h"
|
||||
#include "mozilla/InputStreamLengthHelper.h"
|
||||
#include "nsIHttpHeaderVisitor.h"
|
||||
#include "nsIMIMEInputStream.h"
|
||||
|
@ -169,8 +168,8 @@ HttpBaseChannel::HttpBaseChannel()
|
|||
mReqContentLength(0U),
|
||||
mStatus(NS_OK),
|
||||
mCanceled(false),
|
||||
mFirstPartyClassificationFlags(0),
|
||||
mThirdPartyClassificationFlags(0),
|
||||
mIsFirstPartyTrackingResource(false),
|
||||
mIsThirdPartyTrackingResource(false),
|
||||
mFlashPluginState(nsIHttpChannel::FlashPluginUnknown),
|
||||
mLoadFlags(LOAD_NORMAL),
|
||||
mCaps(0),
|
||||
|
@ -309,17 +308,16 @@ void HttpBaseChannel::ReleaseMainThreadOnlyReferences() {
|
|||
NS_DispatchToMainThread(new ProxyReleaseRunnable(std::move(arrayToRelease)));
|
||||
}
|
||||
|
||||
void HttpBaseChannel::AddClassificationFlags(uint32_t aClassificationFlags,
|
||||
bool aIsThirdParty) {
|
||||
LOG(
|
||||
("HttpBaseChannel::AddClassificationFlags classificationFlags=%d "
|
||||
"thirdparty=%d %p",
|
||||
aClassificationFlags, static_cast<int>(aIsThirdParty), this));
|
||||
void HttpBaseChannel::SetIsTrackingResource(bool aIsThirdParty) {
|
||||
LOG(("HttpBaseChannel::SetIsTrackingResource thirdparty=%d %p",
|
||||
static_cast<int>(aIsThirdParty), this));
|
||||
|
||||
if (aIsThirdParty) {
|
||||
mThirdPartyClassificationFlags |= aClassificationFlags;
|
||||
MOZ_ASSERT(!mIsFirstPartyTrackingResource);
|
||||
mIsThirdPartyTrackingResource = true;
|
||||
} else {
|
||||
mFirstPartyClassificationFlags |= aClassificationFlags;
|
||||
MOZ_ASSERT(!mIsThirdPartyTrackingResource);
|
||||
mIsFirstPartyTrackingResource = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1472,61 +1470,18 @@ NS_IMETHODIMP HttpBaseChannel::SetTopLevelContentWindowId(uint64_t aWindowId) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
HttpBaseChannel::IsTrackingResource() const {
|
||||
MOZ_ASSERT(!mFirstPartyClassificationFlags ||
|
||||
!mThirdPartyClassificationFlags);
|
||||
return UrlClassifierCommon::IsTrackingClassificationFlag(
|
||||
mThirdPartyClassificationFlags) ||
|
||||
UrlClassifierCommon::IsTrackingClassificationFlag(
|
||||
mFirstPartyClassificationFlags);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpBaseChannel::GetIsTrackingResource(bool* aIsTrackingResource) {
|
||||
*aIsTrackingResource = IsTrackingResource();
|
||||
MOZ_ASSERT(!(mIsFirstPartyTrackingResource && mIsThirdPartyTrackingResource));
|
||||
*aIsTrackingResource =
|
||||
mIsThirdPartyTrackingResource || mIsFirstPartyTrackingResource;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
HttpBaseChannel::IsThirdPartyTrackingResource() const {
|
||||
MOZ_ASSERT(
|
||||
!(mFirstPartyClassificationFlags && mThirdPartyClassificationFlags));
|
||||
return UrlClassifierCommon::IsTrackingClassificationFlag(
|
||||
mThirdPartyClassificationFlags);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpBaseChannel::GetIsThirdPartyTrackingResource(bool* aIsTrackingResource) {
|
||||
*aIsTrackingResource = IsThirdPartyTrackingResource();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpBaseChannel::GetClassificationFlags(uint32_t* aFlags) {
|
||||
MOZ_ASSERT(!mFirstPartyClassificationFlags ||
|
||||
!mThirdPartyClassificationFlags);
|
||||
if (mThirdPartyClassificationFlags) {
|
||||
*aFlags = mThirdPartyClassificationFlags;
|
||||
} else {
|
||||
*aFlags = mFirstPartyClassificationFlags;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpBaseChannel::GetFirstPartyClassificationFlags(uint32_t* aFlags) {
|
||||
MOZ_ASSERT(
|
||||
!(mFirstPartyClassificationFlags && mFirstPartyClassificationFlags));
|
||||
*aFlags = mFirstPartyClassificationFlags;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpBaseChannel::GetThirdPartyClassificationFlags(uint32_t* aFlags) {
|
||||
MOZ_ASSERT(
|
||||
!(mFirstPartyClassificationFlags && mThirdPartyClassificationFlags));
|
||||
*aFlags = mThirdPartyClassificationFlags;
|
||||
MOZ_ASSERT(!(mIsFirstPartyTrackingResource && mIsThirdPartyTrackingResource));
|
||||
*aIsTrackingResource = mIsThirdPartyTrackingResource;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1540,21 +1495,23 @@ HttpBaseChannel::GetFlashPluginState(nsIHttpChannel::FlashPluginState* aState) {
|
|||
NS_IMETHODIMP
|
||||
HttpBaseChannel::OverrideTrackingFlagsForDocumentCookieAccessor(
|
||||
nsIHttpChannel* aDocumentChannel) {
|
||||
LOG(("HttpBaseChannel::OverrideTrackingFlagsForDocumentCookieAccessor() %p",
|
||||
this));
|
||||
LOG(
|
||||
("HttpBaseChannel::OverrideTrackingFlagsForDocumentCookieAccessor() %p "
|
||||
"mIsFirstPartyTrackingResource=%d mIsThirdPartyTrackingResource=%d",
|
||||
this, static_cast<int>(mIsFirstPartyTrackingResource),
|
||||
static_cast<int>(mIsThirdPartyTrackingResource)));
|
||||
|
||||
// The semantics we'd like to achieve here are that document.cookie
|
||||
// should follow the same rules that the document is subject to with
|
||||
// regards to content blocking. Therefore we need to propagate the
|
||||
// same flags from the document channel to the fake channel here.
|
||||
if (aDocumentChannel->GetIsThirdPartyTrackingResource()) {
|
||||
mIsThirdPartyTrackingResource = true;
|
||||
} else {
|
||||
mIsFirstPartyTrackingResource = true;
|
||||
}
|
||||
|
||||
mThirdPartyClassificationFlags =
|
||||
aDocumentChannel->GetThirdPartyClassificationFlags();
|
||||
mFirstPartyClassificationFlags =
|
||||
aDocumentChannel->GetFirstPartyClassificationFlags();
|
||||
|
||||
MOZ_ASSERT(
|
||||
!(mFirstPartyClassificationFlags && mThirdPartyClassificationFlags));
|
||||
MOZ_ASSERT(!(mIsFirstPartyTrackingResource && mIsThirdPartyTrackingResource));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -239,11 +239,6 @@ class HttpBaseChannel : public nsHashPropertyBag,
|
|||
NS_IMETHOD GetIsTrackingResource(bool *aIsTrackingResource) override;
|
||||
NS_IMETHOD GetIsThirdPartyTrackingResource(
|
||||
bool *aIsTrackingResource) override;
|
||||
NS_IMETHOD GetClassificationFlags(uint32_t *aIsClassificationFlags) override;
|
||||
NS_IMETHOD GetFirstPartyClassificationFlags(
|
||||
uint32_t *aIsClassificationFlags) override;
|
||||
NS_IMETHOD GetThirdPartyClassificationFlags(
|
||||
uint32_t *aIsClassificationFlags) override;
|
||||
NS_IMETHOD OverrideTrackingFlagsForDocumentCookieAccessor(
|
||||
nsIHttpChannel *aDocumentChannel) override;
|
||||
NS_IMETHOD GetFlashPluginState(
|
||||
|
@ -422,7 +417,7 @@ class HttpBaseChannel : public nsHashPropertyBag,
|
|||
// |EnsureUploadStreamIsCloneableComplete| to main thread.
|
||||
virtual void OnCopyComplete(nsresult aStatus);
|
||||
|
||||
void AddClassificationFlags(uint32_t aFlags, bool aIsThirdParty);
|
||||
void SetIsTrackingResource(bool aIsThirdParty);
|
||||
|
||||
void SetFlashPluginState(nsIHttpChannel::FlashPluginState aState);
|
||||
|
||||
|
@ -538,9 +533,6 @@ class HttpBaseChannel : public nsHashPropertyBag,
|
|||
bool MaybeWaitForUploadStreamLength(nsIStreamListener *aListener,
|
||||
nsISupports *aContext);
|
||||
|
||||
bool IsThirdPartyTrackingResource() const;
|
||||
bool IsTrackingResource() const;
|
||||
|
||||
friend class PrivateBrowsingChannel<HttpBaseChannel>;
|
||||
friend class InterceptFailedOnStop;
|
||||
|
||||
|
@ -670,8 +662,8 @@ class HttpBaseChannel : public nsHashPropertyBag,
|
|||
// Use Release-Acquire ordering to ensure the OMT ODA is ignored while channel
|
||||
// is canceled on main thread.
|
||||
Atomic<bool, ReleaseAcquire> mCanceled;
|
||||
Atomic<uint32_t, ReleaseAcquire> mFirstPartyClassificationFlags;
|
||||
Atomic<uint32_t, ReleaseAcquire> mThirdPartyClassificationFlags;
|
||||
Atomic<bool, ReleaseAcquire> mIsFirstPartyTrackingResource;
|
||||
Atomic<bool, ReleaseAcquire> mIsThirdPartyTrackingResource;
|
||||
Atomic<uint32_t, ReleaseAcquire> mFlashPluginState;
|
||||
|
||||
uint32_t mLoadFlags;
|
||||
|
|
|
@ -1874,15 +1874,14 @@ void HttpChannelChild::ProcessNotifyCookieBlocked(uint32_t aRejectedReason) {
|
|||
NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
void HttpChannelChild::ProcessNotifyClassificationFlags(
|
||||
uint32_t aClassificationFlags, bool aIsThirdParty) {
|
||||
void HttpChannelChild::ProcessNotifyTrackingResource(bool aIsThirdParty) {
|
||||
LOG(
|
||||
("HttpChannelChild::ProcessNotifyClassificationFlags thirdparty=%d "
|
||||
"flags=%" PRIu32 " [this=%p]\n",
|
||||
static_cast<int>(aIsThirdParty), aClassificationFlags, this));
|
||||
("HttpChannelChild::ProcessNotifyTrackingResource thirdparty=%d "
|
||||
"[this=%p]\n",
|
||||
static_cast<int>(aIsThirdParty), this));
|
||||
MOZ_ASSERT(OnSocketThread());
|
||||
|
||||
AddClassificationFlags(aClassificationFlags, aIsThirdParty);
|
||||
SetIsTrackingResource(aIsThirdParty);
|
||||
}
|
||||
|
||||
void HttpChannelChild::ProcessNotifyFlashPluginStateChanged(
|
||||
|
|
|
@ -266,8 +266,7 @@ class HttpChannelChild final : public PHttpChannelChild,
|
|||
uint32_t aAcceptedReason);
|
||||
void ProcessNotifyCookieAllowed();
|
||||
void ProcessNotifyCookieBlocked(uint32_t aRejectedReason);
|
||||
void ProcessNotifyClassificationFlags(uint32_t aClassificationFlags,
|
||||
bool aIsThirdParty);
|
||||
void ProcessNotifyTrackingResource(bool aIsThirdParty);
|
||||
void ProcessNotifyFlashPluginStateChanged(
|
||||
nsIHttpChannel::FlashPluginState aState);
|
||||
void ProcessSetClassifierMatchedInfo(const nsCString& aList,
|
||||
|
|
|
@ -1850,16 +1850,12 @@ HttpChannelParent::SetClassifierMatchedInfo(const nsACString& aList,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpChannelParent::NotifyClassificationFlags(uint32_t aClassificationFlags,
|
||||
bool aIsThirdParty) {
|
||||
LOG(
|
||||
("HttpChannelParent::NotifyClassificationFlags "
|
||||
"classificationFlags=%" PRIu32 ", thirdparty=%d [this=%p]\n",
|
||||
aClassificationFlags, static_cast<int>(aIsThirdParty), this));
|
||||
HttpChannelParent::NotifyTrackingResource(bool aIsThirdParty) {
|
||||
LOG(("HttpChannelParent::NotifyTrackingResource thirdparty=%d [this=%p]\n",
|
||||
static_cast<int>(aIsThirdParty), this));
|
||||
if (!mIPCClosed) {
|
||||
MOZ_ASSERT(mBgParent);
|
||||
Unused << mBgParent->OnNotifyClassificationFlags(aClassificationFlags,
|
||||
aIsThirdParty);
|
||||
Unused << mBgParent->OnNotifyTrackingResource(aIsThirdParty);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -88,16 +88,6 @@ NullHttpChannel::GetIsTrackingResource(bool *aIsTrackingResource) {
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NullHttpChannel::GetIsThirdPartyTrackingResource(bool *aIsTrackingResource) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NullHttpChannel::GetClassificationFlags(uint32_t *aClassificationFlags) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NullHttpChannel::GetFlashPluginState(
|
||||
nsIHttpChannel::FlashPluginState *aResult) {
|
||||
|
@ -105,14 +95,7 @@ NullHttpChannel::GetFlashPluginState(
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NullHttpChannel::GetFirstPartyClassificationFlags(
|
||||
uint32_t *aClassificationFlags) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NullHttpChannel::GetThirdPartyClassificationFlags(
|
||||
uint32_t *aClassificationFlags) {
|
||||
NullHttpChannel::GetIsThirdPartyTrackingResource(bool *aIsTrackingResource) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,8 +64,9 @@ child:
|
|||
// Tell the child that tracking cookies are blocked for this load.
|
||||
async NotifyCookieBlocked(uint32_t aRejectedReason);
|
||||
|
||||
// Tell the child that the resource being loaded has been classified.
|
||||
async NotifyClassificationFlags(uint32_t aClassificationFlags, bool aIsThirdParty);
|
||||
// Tell the child that the resource being loaded is on the tracking
|
||||
// protection list.
|
||||
async NotifyTrackingResource(bool aIsThirdParty);
|
||||
|
||||
// Tell the child that the current channel's document is not allowed to load
|
||||
// flash content.
|
||||
|
|
|
@ -11,9 +11,9 @@ namespace mozilla {
|
|||
namespace net {
|
||||
|
||||
// This protocol provides a mechanism for the "child intercept" mode of
|
||||
// ServiceWorker operation to work correctly with Classified channels.
|
||||
// ServiceWorkers should not be allowed for third-party iframes which are
|
||||
// annotated as tracking origins.
|
||||
// ServiceWorker operation to work correctly with Tracking Protection
|
||||
// annotations. ServiceWorkers should not be allowed for third-party iframes
|
||||
// which are annotated as tracking origins.
|
||||
//
|
||||
// In child intercept mode, the decision to intercept a channel is made in the
|
||||
// child process without consulting the parent process. The decision is based
|
||||
|
@ -39,7 +39,7 @@ protocol PTrackingDummyChannel
|
|||
manager PNecko;
|
||||
|
||||
child:
|
||||
async __delete__(uint32_t aClassificationFlags);
|
||||
async __delete__(bool aTrackingResource);
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
|
|
@ -78,7 +78,7 @@ TrackingDummyChannel::TrackingDummyChannel(nsIURI* aURI, nsIURI* aTopWindowURI,
|
|||
nsILoadInfo* aLoadInfo)
|
||||
: mTopWindowURI(aTopWindowURI),
|
||||
mTopWindowURIResult(aTopWindowURIResult),
|
||||
mClassificationFlags(0) {
|
||||
mIsTrackingResource(false) {
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
|
||||
SetOriginalURI(aURI);
|
||||
|
@ -94,13 +94,12 @@ TrackingDummyChannel::~TrackingDummyChannel() {
|
|||
mTopWindowURI.forget());
|
||||
}
|
||||
|
||||
uint32_t TrackingDummyChannel::ClassificationFlags() const {
|
||||
return mClassificationFlags;
|
||||
bool TrackingDummyChannel::IsTrackingResource() const {
|
||||
return mIsTrackingResource;
|
||||
}
|
||||
|
||||
void TrackingDummyChannel::AddClassificationFlags(
|
||||
uint32_t aClassificationFlags) {
|
||||
mClassificationFlags |= aClassificationFlags;
|
||||
void TrackingDummyChannel::SetIsTrackingResource() {
|
||||
mIsTrackingResource = true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -66,9 +66,9 @@ class TrackingDummyChannel final : public nsIChannel,
|
|||
TrackingDummyChannel(nsIURI* aURI, nsIURI* aTopWindowURI,
|
||||
nsresult aTopWindowURIResult, nsILoadInfo* aLoadInfo);
|
||||
|
||||
uint32_t ClassificationFlags() const;
|
||||
bool IsTrackingResource() const;
|
||||
|
||||
void AddClassificationFlags(uint32_t);
|
||||
void SetIsTrackingResource();
|
||||
|
||||
private:
|
||||
~TrackingDummyChannel();
|
||||
|
@ -78,7 +78,7 @@ class TrackingDummyChannel final : public nsIChannel,
|
|||
nsCOMPtr<nsIURI> mTopWindowURI;
|
||||
nsresult mTopWindowURIResult;
|
||||
|
||||
uint32_t mClassificationFlags;
|
||||
bool mIsTrackingResource;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(TrackingDummyChannel, TRACKING_DUMMY_CHANNEL_IID)
|
||||
|
|
|
@ -68,7 +68,7 @@ void TrackingDummyChannelChild::Initialize(
|
|||
}
|
||||
|
||||
mozilla::ipc::IPCResult TrackingDummyChannelChild::Recv__delete__(
|
||||
const uint32_t& aClassificationFlags) {
|
||||
const bool& aTrackingResource) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (!mChannel) {
|
||||
|
@ -78,7 +78,9 @@ mozilla::ipc::IPCResult TrackingDummyChannelChild::Recv__delete__(
|
|||
nsCOMPtr<nsIHttpChannel> channel = std::move(mChannel);
|
||||
|
||||
RefPtr<HttpBaseChannel> httpChannel = do_QueryObject(channel);
|
||||
httpChannel->AddClassificationFlags(aClassificationFlags, mIsThirdParty);
|
||||
if (aTrackingResource) {
|
||||
httpChannel->SetIsTrackingResource(mIsThirdParty);
|
||||
}
|
||||
|
||||
bool storageGranted = AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
|
||||
httpChannel, mURI, nullptr);
|
||||
|
|
|
@ -34,7 +34,7 @@ class TrackingDummyChannelChild final : public PTrackingDummyChannelChild {
|
|||
const std::function<void(bool)>& aCallback);
|
||||
|
||||
mozilla::ipc::IPCResult Recv__delete__(
|
||||
const uint32_t& aClassificationFlags) override;
|
||||
const bool& aTrackingResource) override;
|
||||
|
||||
nsCOMPtr<nsIHttpChannel> mChannel;
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
|
|
|
@ -37,7 +37,7 @@ void TrackingDummyChannelParent::Init(nsIURI* aURI, nsIURI* aTopWindowURI,
|
|||
bool willCallback = NS_SUCCEEDED(AsyncUrlChannelClassifier::CheckChannel(
|
||||
channel, [self = std::move(self), channel]() {
|
||||
if (self->mIPCActive) {
|
||||
Unused << Send__delete__(self, channel->ClassificationFlags());
|
||||
Unused << Send__delete__(self, channel->IsTrackingResource());
|
||||
}
|
||||
}));
|
||||
|
||||
|
|
|
@ -650,7 +650,7 @@ nsresult nsHttpChannel::Connect() {
|
|||
return RedirectToInterceptedChannel();
|
||||
}
|
||||
|
||||
bool isTrackingResource = IsThirdPartyTrackingResource();
|
||||
bool isTrackingResource = mIsThirdPartyTrackingResource; // is atomic
|
||||
LOG(("nsHttpChannel %p tracking resource=%d, cos=%u", this,
|
||||
isTrackingResource, mClassOfService));
|
||||
|
||||
|
@ -2350,7 +2350,7 @@ nsresult nsHttpChannel::ProcessResponse() {
|
|||
nsCOMPtr<nsILoadContextInfo> lci = GetLoadContextInfo(this);
|
||||
mozilla::net::Predictor::UpdateCacheability(
|
||||
referrer, mURI, httpStatus, mRequestHead, mResponseHead, lci,
|
||||
IsThirdPartyTrackingResource());
|
||||
mIsThirdPartyTrackingResource);
|
||||
}
|
||||
|
||||
// Only allow 407 (authentication required) to continue
|
||||
|
@ -3908,7 +3908,7 @@ nsresult nsHttpChannel::OpenCacheEntryInternal(
|
|||
extension.Append("TRR");
|
||||
}
|
||||
|
||||
if (IsThirdPartyTrackingResource() &&
|
||||
if (mIsThirdPartyTrackingResource &&
|
||||
!AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(this, mURI,
|
||||
nullptr)) {
|
||||
nsCOMPtr<nsIURI> topWindowURI;
|
||||
|
|
|
@ -495,55 +495,10 @@ interface nsIHttpChannel : nsIChannel
|
|||
[must_use] attribute uint64_t topLevelContentWindowId;
|
||||
|
||||
/**
|
||||
* Returns the classification flags if the channel has been processed by
|
||||
* URL-Classifier features and is considered first-party.
|
||||
*/
|
||||
[infallible] readonly attribute unsigned long firstPartyClassificationFlags;
|
||||
|
||||
/**
|
||||
* Returns the classification flags if the channel has been processed by
|
||||
* URL-Classifier features and is considered third-party with the top
|
||||
* window URI.
|
||||
*/
|
||||
[infallible] readonly attribute unsigned long thirdPartyClassificationFlags;
|
||||
|
||||
/*
|
||||
* Returns the classification flags if the channel has been processed by
|
||||
* URL-Classifier features. This value is equal to
|
||||
* "firstPartyClassificationFlags || thirdPartyClassificationFlags".
|
||||
*
|
||||
* Note that top-level channels could be classified as well.
|
||||
* In order to identify third-party resources specifically, use
|
||||
* classificationThirdPartyFlags;
|
||||
*/
|
||||
[infallible] readonly attribute unsigned long classificationFlags;
|
||||
|
||||
cenum ClassificationFlags : 32 {
|
||||
/**
|
||||
* The resource is on the fingerprinting list. This is only available if
|
||||
* the privacy.trackingprotection.fingerprinting_annotate_enabled pref.
|
||||
*/
|
||||
CLASSIFIED_FINGERPRINTING = 0x01,
|
||||
|
||||
/**
|
||||
* The resource is on the cryptomining list. This is only available if
|
||||
* the privacy.trackingprotection.cryptomining_annotate_enabled pref is set.
|
||||
*/
|
||||
CLASSIFIED_CRYPTOMINING = 0x02,
|
||||
|
||||
/**
|
||||
* The resource is on the tracking protection list. This is only available
|
||||
* if the privacy.trackingprotection.annotate_channels pref.
|
||||
*/
|
||||
CLASSIFIED_TRACKING = 0x04,
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns true if the channel has loaded a resource that is classified as
|
||||
* tracker.
|
||||
* This is a helper attribute which returns the same value of
|
||||
* (classificationFlags & CLASSIFIED_TRACKING) ||
|
||||
* (classificationFlags & CLASSIFIED_FINGERPRINTING)
|
||||
* Returns true if the channel has loaded a resource that is on the tracking
|
||||
* protection list. This is only available if the
|
||||
* privacy.trackingprotection.annotate_channels pref is set and its value
|
||||
* should only be relied on after the channel has established a connection.
|
||||
*
|
||||
* Note that top-level channels could be marked as tracking
|
||||
* resource. In order to identify third-party tracking resources
|
||||
|
@ -552,13 +507,11 @@ interface nsIHttpChannel : nsIChannel
|
|||
[infallible] readonly attribute boolean isTrackingResource;
|
||||
|
||||
/**
|
||||
* Returns the classification flags if the channel has been processed by
|
||||
* URL-Classifier features and is considered third-party with the top
|
||||
* window URI.
|
||||
*
|
||||
* This is a helper attribute which returns the same value of
|
||||
* (thirdPartyClassificationFlags & CLASSIFIED_TRACKING) ||
|
||||
* (thirdPartyClassificationFlags & CLASSIFIED_FINGERPRINTING)
|
||||
* Returns true if the channel has loaded a resource that is on the tracking
|
||||
* protection list and is considered third-party with the top window URI.
|
||||
* This is only available if the privacy.trackingprotection.annotate_channels
|
||||
* pref is set and its value should only be relied on after the channel has
|
||||
* established a connection.
|
||||
*/
|
||||
[infallible] readonly attribute boolean isThirdPartyTrackingResource;
|
||||
|
||||
|
|
|
@ -712,6 +712,13 @@ nsViewSourceChannel::GetIsTrackingResource(bool *aIsTrackingResource) {
|
|||
: mHttpChannel->GetIsTrackingResource(aIsTrackingResource);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewSourceChannel::GetFlashPluginState(
|
||||
nsIHttpChannel::FlashPluginState *aResult) {
|
||||
return !mHttpChannel ? NS_ERROR_NULL_POINTER
|
||||
: mHttpChannel->GetFlashPluginState(aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewSourceChannel::GetIsThirdPartyTrackingResource(
|
||||
bool *aIsTrackingResource) {
|
||||
|
@ -720,36 +727,6 @@ nsViewSourceChannel::GetIsThirdPartyTrackingResource(
|
|||
aIsTrackingResource);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewSourceChannel::GetClassificationFlags(uint32_t *aClassificationFlags) {
|
||||
return !mHttpChannel
|
||||
? NS_ERROR_NULL_POINTER
|
||||
: mHttpChannel->GetClassificationFlags(aClassificationFlags);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewSourceChannel::GetFirstPartyClassificationFlags(
|
||||
uint32_t *aClassificationFlags) {
|
||||
return !mHttpChannel ? NS_ERROR_NULL_POINTER
|
||||
: mHttpChannel->GetFirstPartyClassificationFlags(
|
||||
aClassificationFlags);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewSourceChannel::GetThirdPartyClassificationFlags(
|
||||
uint32_t *aClassificationFlags) {
|
||||
return !mHttpChannel ? NS_ERROR_NULL_POINTER
|
||||
: mHttpChannel->GetThirdPartyClassificationFlags(
|
||||
aClassificationFlags);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewSourceChannel::GetFlashPluginState(
|
||||
nsIHttpChannel::FlashPluginState *aResult) {
|
||||
return !mHttpChannel ? NS_ERROR_NULL_POINTER
|
||||
: mHttpChannel->GetFlashPluginState(aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewSourceChannel::OverrideTrackingFlagsForDocumentCookieAccessor(
|
||||
nsIHttpChannel *aDocumentChannel) {
|
||||
|
|
|
@ -416,8 +416,7 @@ bool FeatureData::MaybeCompleteClassification(nsIChannel* aChannel) {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!mBlacklistTables.IsEmpty() &&
|
||||
nsContentUtils::IsURIInList(mBlacklistTables[0]->URI(), skipList)) {
|
||||
if (nsContentUtils::IsURIInList(mBlacklistTables[0]->URI(), skipList)) {
|
||||
UC_LOG(
|
||||
("FeatureData::MaybeCompleteClassification[%p] - uri found in skiplist",
|
||||
this));
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include "mozilla/AntiTrackingCommon.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "mozilla/net/HttpBaseChannel.h"
|
||||
#include "mozilla/net/UrlClassifierFeatureFactory.h"
|
||||
#include "mozilla/StaticPrefs.h"
|
||||
#include "mozIThirdPartyUtil.h"
|
||||
|
@ -23,8 +22,6 @@
|
|||
#include "nsIScriptError.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "TrackingDummyChannel.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
@ -278,188 +275,5 @@ nsresult UrlClassifierCommon::CreatePairwiseWhiteListURI(nsIChannel* aChannel,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
void SetClassificationFlagsHelper(nsIChannel* aChannel,
|
||||
uint32_t aClassificationFlags,
|
||||
bool aIsThirdParty) {
|
||||
MOZ_ASSERT(aChannel);
|
||||
|
||||
nsCOMPtr<nsIParentChannel> parentChannel;
|
||||
NS_QueryNotificationCallbacks(aChannel, parentChannel);
|
||||
if (parentChannel) {
|
||||
// This channel is a parent-process proxy for a child process
|
||||
// request. We should notify the child process as well.
|
||||
parentChannel->NotifyClassificationFlags(aClassificationFlags,
|
||||
aIsThirdParty);
|
||||
}
|
||||
|
||||
RefPtr<HttpBaseChannel> httpChannel = do_QueryObject(aChannel);
|
||||
if (httpChannel) {
|
||||
httpChannel->AddClassificationFlags(aClassificationFlags, aIsThirdParty);
|
||||
}
|
||||
|
||||
RefPtr<TrackingDummyChannel> dummyChannel = do_QueryObject(aChannel);
|
||||
if (dummyChannel) {
|
||||
dummyChannel->AddClassificationFlags(aClassificationFlags);
|
||||
}
|
||||
}
|
||||
|
||||
void LowerPriorityHelper(nsIChannel* aChannel) {
|
||||
MOZ_ASSERT(aChannel);
|
||||
|
||||
bool isBlockingResource = false;
|
||||
|
||||
nsCOMPtr<nsIClassOfService> cos(do_QueryInterface(aChannel));
|
||||
if (cos) {
|
||||
if (nsContentUtils::IsTailingEnabled()) {
|
||||
uint32_t cosFlags = 0;
|
||||
cos->GetClassFlags(&cosFlags);
|
||||
isBlockingResource =
|
||||
cosFlags & (nsIClassOfService::UrgentStart |
|
||||
nsIClassOfService::Leader | nsIClassOfService::Unblocked);
|
||||
|
||||
// Requests not allowed to be tailed are usually those with higher
|
||||
// prioritization. That overweights being a tracker: don't throttle
|
||||
// them when not in background.
|
||||
if (!(cosFlags & nsIClassOfService::TailForbidden)) {
|
||||
cos->AddClassFlags(nsIClassOfService::Throttleable);
|
||||
}
|
||||
} else {
|
||||
// Yes, we even don't want to evaluate the isBlockingResource when tailing
|
||||
// is off see bug 1395525.
|
||||
|
||||
cos->AddClassFlags(nsIClassOfService::Throttleable);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isBlockingResource) {
|
||||
nsCOMPtr<nsISupportsPriority> p = do_QueryInterface(aChannel);
|
||||
if (p) {
|
||||
if (UC_LOG_ENABLED()) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
aChannel->GetURI(getter_AddRefs(uri));
|
||||
nsAutoCString spec;
|
||||
uri->GetAsciiSpec(spec);
|
||||
spec.Truncate(
|
||||
std::min(spec.Length(), UrlClassifierCommon::sMaxSpecLength));
|
||||
UC_LOG(("Setting PRIORITY_LOWEST for channel[%p] (%s)", aChannel,
|
||||
spec.get()));
|
||||
}
|
||||
p->SetPriority(nsISupportsPriority::PRIORITY_LOWEST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// static
|
||||
void UrlClassifierCommon::AnnotateChannel(
|
||||
nsIChannel* aChannel,
|
||||
AntiTrackingCommon::ContentBlockingAllowListPurpose aPurpose,
|
||||
uint32_t aClassificationFlags, uint32_t aLoadingState) {
|
||||
MOZ_ASSERT(aChannel);
|
||||
MOZ_ASSERT(aPurpose == AntiTrackingCommon::eTrackingProtection ||
|
||||
aPurpose == AntiTrackingCommon::eTrackingAnnotations ||
|
||||
aPurpose == AntiTrackingCommon::eFingerprinting ||
|
||||
aPurpose == AntiTrackingCommon::eCryptomining);
|
||||
|
||||
nsCOMPtr<nsIURI> chanURI;
|
||||
nsresult rv = aChannel->GetURI(getter_AddRefs(chanURI));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
UC_LOG(
|
||||
("UrlClassifierCommon::AnnotateChannel nsIChannel::GetURI(%p) failed",
|
||||
(void*)aChannel));
|
||||
return;
|
||||
}
|
||||
|
||||
bool isThirdPartyWithTopLevelWinURI =
|
||||
nsContentUtils::IsThirdPartyWindowOrChannel(nullptr, aChannel, chanURI);
|
||||
|
||||
UC_LOG(("UrlClassifierCommon::AnnotateChannel, annotating channel[%p]",
|
||||
aChannel));
|
||||
|
||||
SetClassificationFlagsHelper(aChannel, aClassificationFlags,
|
||||
isThirdPartyWithTopLevelWinURI);
|
||||
|
||||
if (isThirdPartyWithTopLevelWinURI || IsAllowListed(aChannel, aPurpose)) {
|
||||
UrlClassifierCommon::NotifyChannelClassifierProtectionDisabled(
|
||||
aChannel, aLoadingState);
|
||||
}
|
||||
|
||||
if (isThirdPartyWithTopLevelWinURI &&
|
||||
StaticPrefs::privacy_trackingprotection_lower_network_priority()) {
|
||||
LowerPriorityHelper(aChannel);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
bool UrlClassifierCommon::IsAllowListed(
|
||||
nsIChannel* aChannel,
|
||||
AntiTrackingCommon::ContentBlockingAllowListPurpose aPurpose) {
|
||||
MOZ_ASSERT(aPurpose == AntiTrackingCommon::eTrackingProtection ||
|
||||
aPurpose == AntiTrackingCommon::eTrackingAnnotations ||
|
||||
aPurpose == AntiTrackingCommon::eFingerprinting ||
|
||||
aPurpose == AntiTrackingCommon::eCryptomining);
|
||||
|
||||
nsCOMPtr<nsIHttpChannelInternal> channel = do_QueryInterface(aChannel);
|
||||
if (!channel) {
|
||||
UC_LOG(("nsChannelClassifier: Not an HTTP channel"));
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> topWinURI;
|
||||
nsresult rv = channel->GetTopWindowURI(getter_AddRefs(topWinURI));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!topWinURI && StaticPrefs::channelclassifier_allowlist_example()) {
|
||||
UC_LOG(("nsChannelClassifier: Allowlisting test domain"));
|
||||
nsCOMPtr<nsIIOService> ios = services::GetIOService();
|
||||
if (NS_WARN_IF(!ios)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
rv = ios->NewURI(NS_LITERAL_CSTRING("http://allowlisted.example.com"),
|
||||
nullptr, nullptr, getter_AddRefs(topWinURI));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool isAllowListed = false;
|
||||
rv = AntiTrackingCommon::IsOnContentBlockingAllowList(
|
||||
topWinURI, NS_UsePrivateBrowsing(aChannel), aPurpose, isAllowListed);
|
||||
if (NS_FAILED(rv)) { // normal for some loads, no need to print a warning
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isAllowListed) {
|
||||
if (UC_LOG_ENABLED()) {
|
||||
nsCOMPtr<nsIURI> chanURI;
|
||||
nsresult rv = aChannel->GetURI(getter_AddRefs(chanURI));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return isAllowListed;
|
||||
}
|
||||
|
||||
nsCString chanSpec = chanURI->GetSpecOrDefault();
|
||||
chanSpec.Truncate(
|
||||
std::min(chanSpec.Length(), UrlClassifierCommon::sMaxSpecLength));
|
||||
UC_LOG(("nsChannelClassifier: User override on channel[%p] (%s)",
|
||||
aChannel, chanSpec.get()));
|
||||
}
|
||||
}
|
||||
|
||||
return isAllowListed;
|
||||
}
|
||||
|
||||
// static
|
||||
bool UrlClassifierCommon::IsTrackingClassificationFlag(uint32_t aFlag) {
|
||||
return (aFlag & nsIHttpChannel::ClassificationFlags::CLASSIFIED_TRACKING) ||
|
||||
(aFlag &
|
||||
nsIHttpChannel::ClassificationFlags::CLASSIFIED_FINGERPRINTING);
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -42,17 +42,6 @@ class UrlClassifierCommon final {
|
|||
static nsresult CreatePairwiseWhiteListURI(nsIChannel* aChannel,
|
||||
nsIURI** aURI);
|
||||
|
||||
static void AnnotateChannel(
|
||||
nsIChannel* aChannel,
|
||||
AntiTrackingCommon::ContentBlockingAllowListPurpose aPurpose,
|
||||
uint32_t aClassificationFlags, uint32_t aLoadingState);
|
||||
|
||||
static bool IsAllowListed(
|
||||
nsIChannel* aChannel,
|
||||
AntiTrackingCommon::ContentBlockingAllowListPurpose aPurpose);
|
||||
|
||||
static bool IsTrackingClassificationFlag(uint32_t aFlag);
|
||||
|
||||
private:
|
||||
// aBlockedReason must be one of the nsIWebProgressListener state.
|
||||
static void NotifyChannelBlocked(nsIChannel* aChannel,
|
||||
|
|
|
@ -164,5 +164,65 @@ UrlClassifierFeatureBase::GetSkipHostList(nsACString& aList) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool UrlClassifierFeatureBase::IsAllowListed(
|
||||
nsIChannel* aChannel,
|
||||
AntiTrackingCommon::ContentBlockingAllowListPurpose aPurpose) {
|
||||
MOZ_ASSERT(aPurpose == AntiTrackingCommon::eTrackingProtection ||
|
||||
aPurpose == AntiTrackingCommon::eTrackingAnnotations ||
|
||||
aPurpose == AntiTrackingCommon::eFingerprinting ||
|
||||
aPurpose == AntiTrackingCommon::eCryptomining);
|
||||
|
||||
nsCOMPtr<nsIHttpChannelInternal> channel = do_QueryInterface(aChannel);
|
||||
if (!channel) {
|
||||
UC_LOG(("nsChannelClassifier: Not an HTTP channel"));
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> topWinURI;
|
||||
nsresult rv = channel->GetTopWindowURI(getter_AddRefs(topWinURI));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!topWinURI && StaticPrefs::channelclassifier_allowlist_example()) {
|
||||
UC_LOG(("nsChannelClassifier: Allowlisting test domain"));
|
||||
nsCOMPtr<nsIIOService> ios = services::GetIOService();
|
||||
if (NS_WARN_IF(!ios)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
rv = ios->NewURI(NS_LITERAL_CSTRING("http://allowlisted.example.com"),
|
||||
nullptr, nullptr, getter_AddRefs(topWinURI));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool isAllowListed = false;
|
||||
rv = AntiTrackingCommon::IsOnContentBlockingAllowList(
|
||||
topWinURI, NS_UsePrivateBrowsing(aChannel), aPurpose, isAllowListed);
|
||||
if (NS_FAILED(rv)) { // normal for some loads, no need to print a warning
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isAllowListed) {
|
||||
if (UC_LOG_ENABLED()) {
|
||||
nsCOMPtr<nsIURI> chanURI;
|
||||
nsresult rv = aChannel->GetURI(getter_AddRefs(chanURI));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return isAllowListed;
|
||||
}
|
||||
|
||||
nsCString chanSpec = chanURI->GetSpecOrDefault();
|
||||
chanSpec.Truncate(
|
||||
std::min(chanSpec.Length(), UrlClassifierCommon::sMaxSpecLength));
|
||||
UC_LOG(("nsChannelClassifier: User override on channel[%p] (%s)",
|
||||
aChannel, chanSpec.get()));
|
||||
}
|
||||
}
|
||||
|
||||
return isAllowListed;
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -58,6 +58,10 @@ class UrlClassifierFeatureBase : public nsIUrlClassifierFeature,
|
|||
void InitializePreferences();
|
||||
void ShutdownPreferences();
|
||||
|
||||
bool IsAllowListed(
|
||||
nsIChannel* aChannel,
|
||||
AntiTrackingCommon::ContentBlockingAllowListPurpose aPurpose);
|
||||
|
||||
private:
|
||||
nsCString mName;
|
||||
|
||||
|
|
|
@ -1,158 +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 "UrlClassifierFeatureCryptominingAnnotation.h"
|
||||
|
||||
#include "mozilla/AntiTrackingCommon.h"
|
||||
#include "mozilla/net/UrlClassifierCommon.h"
|
||||
#include "mozilla/StaticPrefs.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
namespace {
|
||||
|
||||
#define CRYPTOMINING_ANNOTATION_FEATURE_NAME "cryptomining-annotation"
|
||||
|
||||
#define URLCLASSIFIER_CRYPTOMINING_ANNOTATION_BLACKLIST \
|
||||
"urlclassifier.features.cryptomining.annotate.blacklistTables"
|
||||
#define URLCLASSIFIER_CRYPTOMINING_ANNOTATION_BLACKLIST_TEST_ENTRIES \
|
||||
"urlclassifier.features.cryptomining.annotate.blacklistHosts"
|
||||
#define URLCLASSIFIER_CRYPTOMINING_ANNOTATION_WHITELIST \
|
||||
"urlclassifier.features.cryptomining.annotate.whitelistTables"
|
||||
#define URLCLASSIFIER_CRYPTOMINING_ANNOTATION_WHITELIST_TEST_ENTRIES \
|
||||
"urlclassifier.features.cryptomining.annotate.whitelistHosts"
|
||||
#define TABLE_CRYPTOMINING_ANNOTATION_BLACKLIST_PREF \
|
||||
"cryptomining-annotate-blacklist-pref"
|
||||
#define TABLE_CRYPTOMINING_ANNOTATION_WHITELIST_PREF \
|
||||
"cryptomining-annotate-whitelist-pref"
|
||||
|
||||
StaticRefPtr<UrlClassifierFeatureCryptominingAnnotation>
|
||||
gFeatureCryptominingAnnotation;
|
||||
|
||||
} // namespace
|
||||
|
||||
UrlClassifierFeatureCryptominingAnnotation::
|
||||
UrlClassifierFeatureCryptominingAnnotation()
|
||||
: UrlClassifierFeatureBase(
|
||||
NS_LITERAL_CSTRING(CRYPTOMINING_ANNOTATION_FEATURE_NAME),
|
||||
NS_LITERAL_CSTRING(URLCLASSIFIER_CRYPTOMINING_ANNOTATION_BLACKLIST),
|
||||
NS_LITERAL_CSTRING(URLCLASSIFIER_CRYPTOMINING_ANNOTATION_WHITELIST),
|
||||
NS_LITERAL_CSTRING(
|
||||
URLCLASSIFIER_CRYPTOMINING_ANNOTATION_BLACKLIST_TEST_ENTRIES),
|
||||
NS_LITERAL_CSTRING(
|
||||
URLCLASSIFIER_CRYPTOMINING_ANNOTATION_WHITELIST_TEST_ENTRIES),
|
||||
NS_LITERAL_CSTRING(TABLE_CRYPTOMINING_ANNOTATION_BLACKLIST_PREF),
|
||||
NS_LITERAL_CSTRING(TABLE_CRYPTOMINING_ANNOTATION_WHITELIST_PREF),
|
||||
EmptyCString()) {}
|
||||
|
||||
/* static */ const char* UrlClassifierFeatureCryptominingAnnotation::Name() {
|
||||
return CRYPTOMINING_ANNOTATION_FEATURE_NAME;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void UrlClassifierFeatureCryptominingAnnotation::MaybeInitialize() {
|
||||
UC_LOG(("UrlClassifierFeatureCryptominingAnnotation: MaybeInitialize"));
|
||||
|
||||
if (!gFeatureCryptominingAnnotation) {
|
||||
gFeatureCryptominingAnnotation =
|
||||
new UrlClassifierFeatureCryptominingAnnotation();
|
||||
gFeatureCryptominingAnnotation->InitializePreferences();
|
||||
}
|
||||
}
|
||||
|
||||
/* static */
|
||||
void UrlClassifierFeatureCryptominingAnnotation::MaybeShutdown() {
|
||||
UC_LOG(("UrlClassifierFeatureCryptominingAnnotation: MaybeShutdown"));
|
||||
|
||||
if (gFeatureCryptominingAnnotation) {
|
||||
gFeatureCryptominingAnnotation->ShutdownPreferences();
|
||||
gFeatureCryptominingAnnotation = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/* static */
|
||||
already_AddRefed<UrlClassifierFeatureCryptominingAnnotation>
|
||||
UrlClassifierFeatureCryptominingAnnotation::MaybeCreate(nsIChannel* aChannel) {
|
||||
MOZ_ASSERT(aChannel);
|
||||
|
||||
UC_LOG(
|
||||
("UrlClassifierFeatureCryptominingAnnotation: MaybeCreate for channel %p",
|
||||
aChannel));
|
||||
|
||||
if (!StaticPrefs::
|
||||
privacy_trackingprotection_cryptomining_annotate_enabled()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!UrlClassifierCommon::ShouldEnableClassifier(aChannel)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MaybeInitialize();
|
||||
MOZ_ASSERT(gFeatureCryptominingAnnotation);
|
||||
|
||||
RefPtr<UrlClassifierFeatureCryptominingAnnotation> self =
|
||||
gFeatureCryptominingAnnotation;
|
||||
return self.forget();
|
||||
}
|
||||
|
||||
/* static */
|
||||
already_AddRefed<nsIUrlClassifierFeature>
|
||||
UrlClassifierFeatureCryptominingAnnotation::GetIfNameMatches(
|
||||
const nsACString& aName) {
|
||||
if (!aName.EqualsLiteral(CRYPTOMINING_ANNOTATION_FEATURE_NAME)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MaybeInitialize();
|
||||
MOZ_ASSERT(gFeatureCryptominingAnnotation);
|
||||
|
||||
RefPtr<UrlClassifierFeatureCryptominingAnnotation> self =
|
||||
gFeatureCryptominingAnnotation;
|
||||
return self.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
UrlClassifierFeatureCryptominingAnnotation::ProcessChannel(
|
||||
nsIChannel* aChannel, const nsACString& aList, bool* aShouldContinue) {
|
||||
NS_ENSURE_ARG_POINTER(aChannel);
|
||||
NS_ENSURE_ARG_POINTER(aShouldContinue);
|
||||
|
||||
// This is not a blocking feature.
|
||||
*aShouldContinue = true;
|
||||
|
||||
UC_LOG(
|
||||
("UrlClassifierFeatureCryptominingAnnotation::ProcessChannel, annotating "
|
||||
"channel[%p]",
|
||||
aChannel));
|
||||
|
||||
UrlClassifierCommon::AnnotateChannel(
|
||||
aChannel, AntiTrackingCommon::eCryptomining,
|
||||
nsIHttpChannel::ClassificationFlags::CLASSIFIED_CRYPTOMINING,
|
||||
nsIWebProgressListener::STATE_LOADED_CRYPTOMINING_CONTENT);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
UrlClassifierFeatureCryptominingAnnotation::GetURIByListType(
|
||||
nsIChannel* aChannel, nsIUrlClassifierFeature::listType aListType,
|
||||
nsIURI** aURI) {
|
||||
NS_ENSURE_ARG_POINTER(aChannel);
|
||||
NS_ENSURE_ARG_POINTER(aURI);
|
||||
|
||||
if (aListType == nsIUrlClassifierFeature::blacklist) {
|
||||
return aChannel->GetURI(aURI);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aListType == nsIUrlClassifierFeature::whitelist);
|
||||
return UrlClassifierCommon::CreatePairwiseWhiteListURI(aChannel, aURI);
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
|
@ -1,46 +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_UrlClassifierFeatureCryptominingAnnotation_h
|
||||
#define mozilla_net_UrlClassifierFeatureCryptominingAnnotation_h
|
||||
|
||||
#include "UrlClassifierFeatureBase.h"
|
||||
|
||||
class nsIChannel;
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
class UrlClassifierFeatureCryptominingAnnotation final
|
||||
: public UrlClassifierFeatureBase {
|
||||
public:
|
||||
static const char* Name();
|
||||
|
||||
static void MaybeShutdown();
|
||||
|
||||
static already_AddRefed<UrlClassifierFeatureCryptominingAnnotation>
|
||||
MaybeCreate(nsIChannel* aChannel);
|
||||
|
||||
static already_AddRefed<nsIUrlClassifierFeature> GetIfNameMatches(
|
||||
const nsACString& aName);
|
||||
|
||||
NS_IMETHOD ProcessChannel(nsIChannel* aChannel, const nsACString& aList,
|
||||
bool* aShouldContinue) override;
|
||||
|
||||
NS_IMETHOD GetURIByListType(nsIChannel* aChannel,
|
||||
nsIUrlClassifierFeature::listType aListType,
|
||||
nsIURI** aURI) override;
|
||||
|
||||
private:
|
||||
UrlClassifierFeatureCryptominingAnnotation();
|
||||
|
||||
static void MaybeInitialize();
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_net_UrlClassifierFeatureCryptominingAnnotation_h
|
|
@ -17,7 +17,7 @@ namespace net {
|
|||
|
||||
namespace {
|
||||
|
||||
#define CRYPTOMINING_FEATURE_NAME "cryptomining-protection"
|
||||
#define CRYPTOMINING_FEATURE_NAME "cryptomining"
|
||||
|
||||
#define URLCLASSIFIER_CRYPTOMINING_BLACKLIST \
|
||||
"urlclassifier.features.cryptomining.blacklistTables"
|
||||
|
@ -143,30 +143,38 @@ UrlClassifierFeatureCryptominingProtection::ProcessChannel(
|
|||
NS_ENSURE_ARG_POINTER(aChannel);
|
||||
NS_ENSURE_ARG_POINTER(aShouldContinue);
|
||||
|
||||
bool isAllowListed = UrlClassifierCommon::IsAllowListed(
|
||||
aChannel, AntiTrackingCommon::eCryptomining);
|
||||
bool isAllowListed =
|
||||
IsAllowListed(aChannel, AntiTrackingCommon::eCryptomining);
|
||||
|
||||
// This is a blocking feature.
|
||||
*aShouldContinue = isAllowListed;
|
||||
|
||||
if (isAllowListed) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
UrlClassifierCommon::SetBlockedContent(aChannel, NS_ERROR_CRYPTOMINING_URI,
|
||||
aList, EmptyCString(), EmptyCString());
|
||||
|
||||
UC_LOG(
|
||||
("UrlClassifierFeatureCryptominingProtection::ProcessChannel, "
|
||||
"cancelling "
|
||||
"channel[%p]",
|
||||
aChannel));
|
||||
nsCOMPtr<nsIHttpChannelInternal> httpChannel = do_QueryInterface(aChannel);
|
||||
|
||||
if (httpChannel) {
|
||||
Unused << httpChannel->CancelByChannelClassifier(NS_ERROR_CRYPTOMINING_URI);
|
||||
// Even with cryptomining blocking disabled, we still want to show the user
|
||||
// that there are unblocked cryptominers on the site, so notify the UI that
|
||||
// we loaded cryptomining content. UI code can treat this notification
|
||||
// differently depending on whether cryptomining blocking is enabled or
|
||||
// disabled.
|
||||
UrlClassifierCommon::NotifyChannelClassifierProtectionDisabled(
|
||||
aChannel, nsIWebProgressListener::STATE_LOADED_CRYPTOMINING_CONTENT);
|
||||
} else {
|
||||
Unused << aChannel->Cancel(NS_ERROR_CRYPTOMINING_URI);
|
||||
UrlClassifierCommon::SetBlockedContent(aChannel, NS_ERROR_CRYPTOMINING_URI,
|
||||
aList, EmptyCString(),
|
||||
EmptyCString());
|
||||
|
||||
UC_LOG(
|
||||
("UrlClassifierFeatureCryptominingProtection::ProcessChannel, "
|
||||
"cancelling "
|
||||
"channel[%p]",
|
||||
aChannel));
|
||||
nsCOMPtr<nsIHttpChannelInternal> httpChannel = do_QueryInterface(aChannel);
|
||||
|
||||
if (httpChannel) {
|
||||
Unused << httpChannel->CancelByChannelClassifier(
|
||||
NS_ERROR_CRYPTOMINING_URI);
|
||||
} else {
|
||||
Unused << aChannel->Cancel(NS_ERROR_CRYPTOMINING_URI);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -7,9 +7,7 @@
|
|||
#include "mozilla/net/UrlClassifierFeatureFactory.h"
|
||||
|
||||
// List of Features
|
||||
#include "UrlClassifierFeatureCryptominingAnnotation.h"
|
||||
#include "UrlClassifierFeatureCryptominingProtection.h"
|
||||
#include "UrlClassifierFeatureFingerprintingAnnotation.h"
|
||||
#include "UrlClassifierFeatureFingerprintingProtection.h"
|
||||
#include "UrlClassifierFeatureFlash.h"
|
||||
#include "UrlClassifierFeatureLoginReputation.h"
|
||||
|
@ -30,9 +28,7 @@ void UrlClassifierFeatureFactory::Shutdown() {
|
|||
return;
|
||||
}
|
||||
|
||||
UrlClassifierFeatureCryptominingAnnotation::MaybeShutdown();
|
||||
UrlClassifierFeatureCryptominingProtection::MaybeShutdown();
|
||||
UrlClassifierFeatureFingerprintingAnnotation::MaybeShutdown();
|
||||
UrlClassifierFeatureFingerprintingProtection::MaybeShutdown();
|
||||
UrlClassifierFeatureFlash::MaybeShutdown();
|
||||
UrlClassifierFeatureLoginReputation::MaybeShutdown();
|
||||
|
@ -73,18 +69,6 @@ void UrlClassifierFeatureFactory::GetFeaturesFromChannel(
|
|||
aFeatures.AppendElement(feature);
|
||||
}
|
||||
|
||||
// Cryptomining Annotation
|
||||
feature = UrlClassifierFeatureCryptominingAnnotation::MaybeCreate(aChannel);
|
||||
if (feature) {
|
||||
aFeatures.AppendElement(feature);
|
||||
}
|
||||
|
||||
// Fingerprinting Annotation
|
||||
feature = UrlClassifierFeatureFingerprintingAnnotation::MaybeCreate(aChannel);
|
||||
if (feature) {
|
||||
aFeatures.AppendElement(feature);
|
||||
}
|
||||
|
||||
// Tracking Annotation
|
||||
feature = UrlClassifierFeatureTrackingAnnotation::MaybeCreate(aChannel);
|
||||
if (feature) {
|
||||
|
@ -118,25 +102,12 @@ UrlClassifierFeatureFactory::GetFeatureByName(const nsACString& aName) {
|
|||
|
||||
nsCOMPtr<nsIUrlClassifierFeature> feature;
|
||||
|
||||
// Cryptomining Annotation
|
||||
feature = UrlClassifierFeatureCryptominingAnnotation::GetIfNameMatches(aName);
|
||||
if (feature) {
|
||||
return feature.forget();
|
||||
}
|
||||
|
||||
// Cryptomining Protection
|
||||
feature = UrlClassifierFeatureCryptominingProtection::GetIfNameMatches(aName);
|
||||
if (feature) {
|
||||
return feature.forget();
|
||||
}
|
||||
|
||||
// Fingerprinting Annotation
|
||||
feature =
|
||||
UrlClassifierFeatureFingerprintingAnnotation::GetIfNameMatches(aName);
|
||||
if (feature) {
|
||||
return feature.forget();
|
||||
}
|
||||
|
||||
// Fingerprinting Protection
|
||||
feature =
|
||||
UrlClassifierFeatureFingerprintingProtection::GetIfNameMatches(aName);
|
||||
|
@ -183,26 +154,13 @@ void UrlClassifierFeatureFactory::GetFeatureNames(nsTArray<nsCString>& aArray) {
|
|||
return;
|
||||
}
|
||||
|
||||
nsAutoCString name;
|
||||
|
||||
// Cryptomining Annotation
|
||||
name.Assign(UrlClassifierFeatureCryptominingAnnotation::Name());
|
||||
if (!name.IsEmpty()) {
|
||||
aArray.AppendElement(name);
|
||||
}
|
||||
|
||||
// Cryptomining Protection
|
||||
nsAutoCString name;
|
||||
name.Assign(UrlClassifierFeatureCryptominingProtection::Name());
|
||||
if (!name.IsEmpty()) {
|
||||
aArray.AppendElement(name);
|
||||
}
|
||||
|
||||
// Fingerprinting Annotation
|
||||
name.Assign(UrlClassifierFeatureFingerprintingAnnotation::Name());
|
||||
if (!name.IsEmpty()) {
|
||||
aArray.AppendElement(name);
|
||||
}
|
||||
|
||||
// Fingerprinting Protection
|
||||
name.Assign(UrlClassifierFeatureFingerprintingProtection::Name());
|
||||
if (!name.IsEmpty()) {
|
||||
|
|
|
@ -1,160 +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 "UrlClassifierFeatureFingerprintingAnnotation.h"
|
||||
|
||||
#include "mozilla/AntiTrackingCommon.h"
|
||||
#include "mozilla/net/UrlClassifierCommon.h"
|
||||
#include "mozilla/StaticPrefs.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
namespace {
|
||||
|
||||
#define FINGERPRINTING_ANNOTATION_FEATURE_NAME "fingerprinting-annotation"
|
||||
|
||||
#define URLCLASSIFIER_FINGERPRINTING_ANNOTATION_BLACKLIST \
|
||||
"urlclassifier.features.fingerprinting.annotate.blacklistTables"
|
||||
#define URLCLASSIFIER_FINGERPRINTING_ANNOTATION_BLACKLIST_TEST_ENTRIES \
|
||||
"urlclassifier.features.fingerprinting.annotate.blacklistHosts"
|
||||
#define URLCLASSIFIER_FINGERPRINTING_ANNOTATION_WHITELIST \
|
||||
"urlclassifier.features.fingerprinting.annotate.whitelistTables"
|
||||
#define URLCLASSIFIER_FINGERPRINTING_ANNOTATION_WHITELIST_TEST_ENTRIES \
|
||||
"urlclassifier.features.fingerprinting.annotate.whitelistHosts"
|
||||
#define TABLE_FINGERPRINTING_ANNOTATION_BLACKLIST_PREF \
|
||||
"fingerprinting-annotate-blacklist-pref"
|
||||
#define TABLE_FINGERPRINTING_ANNOTATION_WHITELIST_PREF \
|
||||
"fingerprinting-annotate-whitelist-pref"
|
||||
|
||||
StaticRefPtr<UrlClassifierFeatureFingerprintingAnnotation>
|
||||
gFeatureFingerprintingAnnotation;
|
||||
|
||||
} // namespace
|
||||
|
||||
UrlClassifierFeatureFingerprintingAnnotation::
|
||||
UrlClassifierFeatureFingerprintingAnnotation()
|
||||
: UrlClassifierFeatureBase(
|
||||
NS_LITERAL_CSTRING(FINGERPRINTING_ANNOTATION_FEATURE_NAME),
|
||||
NS_LITERAL_CSTRING(URLCLASSIFIER_FINGERPRINTING_ANNOTATION_BLACKLIST),
|
||||
NS_LITERAL_CSTRING(URLCLASSIFIER_FINGERPRINTING_ANNOTATION_WHITELIST),
|
||||
NS_LITERAL_CSTRING(
|
||||
URLCLASSIFIER_FINGERPRINTING_ANNOTATION_BLACKLIST_TEST_ENTRIES),
|
||||
NS_LITERAL_CSTRING(
|
||||
URLCLASSIFIER_FINGERPRINTING_ANNOTATION_WHITELIST_TEST_ENTRIES),
|
||||
NS_LITERAL_CSTRING(TABLE_FINGERPRINTING_ANNOTATION_BLACKLIST_PREF),
|
||||
NS_LITERAL_CSTRING(TABLE_FINGERPRINTING_ANNOTATION_WHITELIST_PREF),
|
||||
EmptyCString()) {}
|
||||
|
||||
/* static */ const char* UrlClassifierFeatureFingerprintingAnnotation::Name() {
|
||||
return FINGERPRINTING_ANNOTATION_FEATURE_NAME;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void UrlClassifierFeatureFingerprintingAnnotation::MaybeInitialize() {
|
||||
UC_LOG(("UrlClassifierFeatureFingerprintingAnnotation: MaybeInitialize"));
|
||||
|
||||
if (!gFeatureFingerprintingAnnotation) {
|
||||
gFeatureFingerprintingAnnotation =
|
||||
new UrlClassifierFeatureFingerprintingAnnotation();
|
||||
gFeatureFingerprintingAnnotation->InitializePreferences();
|
||||
}
|
||||
}
|
||||
|
||||
/* static */
|
||||
void UrlClassifierFeatureFingerprintingAnnotation::MaybeShutdown() {
|
||||
UC_LOG(("UrlClassifierFeatureFingerprintingAnnotation: MaybeShutdown"));
|
||||
|
||||
if (gFeatureFingerprintingAnnotation) {
|
||||
gFeatureFingerprintingAnnotation->ShutdownPreferences();
|
||||
gFeatureFingerprintingAnnotation = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/* static */
|
||||
already_AddRefed<UrlClassifierFeatureFingerprintingAnnotation>
|
||||
UrlClassifierFeatureFingerprintingAnnotation::MaybeCreate(
|
||||
nsIChannel* aChannel) {
|
||||
MOZ_ASSERT(aChannel);
|
||||
|
||||
UC_LOG(
|
||||
("UrlClassifierFeatureFingerprintingAnnotation: MaybeCreate for channel "
|
||||
"%p",
|
||||
aChannel));
|
||||
|
||||
if (!StaticPrefs::
|
||||
privacy_trackingprotection_fingerprinting_annotate_enabled()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!UrlClassifierCommon::ShouldEnableClassifier(aChannel)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MaybeInitialize();
|
||||
MOZ_ASSERT(gFeatureFingerprintingAnnotation);
|
||||
|
||||
RefPtr<UrlClassifierFeatureFingerprintingAnnotation> self =
|
||||
gFeatureFingerprintingAnnotation;
|
||||
return self.forget();
|
||||
}
|
||||
|
||||
/* static */
|
||||
already_AddRefed<nsIUrlClassifierFeature>
|
||||
UrlClassifierFeatureFingerprintingAnnotation::GetIfNameMatches(
|
||||
const nsACString& aName) {
|
||||
if (!aName.EqualsLiteral(FINGERPRINTING_ANNOTATION_FEATURE_NAME)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MaybeInitialize();
|
||||
MOZ_ASSERT(gFeatureFingerprintingAnnotation);
|
||||
|
||||
RefPtr<UrlClassifierFeatureFingerprintingAnnotation> self =
|
||||
gFeatureFingerprintingAnnotation;
|
||||
return self.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
UrlClassifierFeatureFingerprintingAnnotation::ProcessChannel(
|
||||
nsIChannel* aChannel, const nsACString& aList, bool* aShouldContinue) {
|
||||
NS_ENSURE_ARG_POINTER(aChannel);
|
||||
NS_ENSURE_ARG_POINTER(aShouldContinue);
|
||||
|
||||
// This is not a blocking feature.
|
||||
*aShouldContinue = true;
|
||||
|
||||
UC_LOG(
|
||||
("UrlClassifierFeatureFingerprintingAnnotation::ProcessChannel, "
|
||||
"annotating channel[%p]",
|
||||
aChannel));
|
||||
|
||||
UrlClassifierCommon::AnnotateChannel(
|
||||
aChannel, AntiTrackingCommon::eFingerprinting,
|
||||
nsIHttpChannel::ClassificationFlags::CLASSIFIED_FINGERPRINTING,
|
||||
nsIWebProgressListener::STATE_LOADED_FINGERPRINTING_CONTENT);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
UrlClassifierFeatureFingerprintingAnnotation::GetURIByListType(
|
||||
nsIChannel* aChannel, nsIUrlClassifierFeature::listType aListType,
|
||||
nsIURI** aURI) {
|
||||
NS_ENSURE_ARG_POINTER(aChannel);
|
||||
NS_ENSURE_ARG_POINTER(aURI);
|
||||
|
||||
if (aListType == nsIUrlClassifierFeature::blacklist) {
|
||||
return aChannel->GetURI(aURI);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aListType == nsIUrlClassifierFeature::whitelist);
|
||||
return UrlClassifierCommon::CreatePairwiseWhiteListURI(aChannel, aURI);
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
|
@ -1,46 +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_UrlClassifierFeatureFingerprintingAnnotation_h
|
||||
#define mozilla_net_UrlClassifierFeatureFingerprintingAnnotation_h
|
||||
|
||||
#include "UrlClassifierFeatureBase.h"
|
||||
|
||||
class nsIChannel;
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
class UrlClassifierFeatureFingerprintingAnnotation final
|
||||
: public UrlClassifierFeatureBase {
|
||||
public:
|
||||
static const char* Name();
|
||||
|
||||
static void MaybeShutdown();
|
||||
|
||||
static already_AddRefed<UrlClassifierFeatureFingerprintingAnnotation>
|
||||
MaybeCreate(nsIChannel* aChannel);
|
||||
|
||||
static already_AddRefed<nsIUrlClassifierFeature> GetIfNameMatches(
|
||||
const nsACString& aName);
|
||||
|
||||
NS_IMETHOD ProcessChannel(nsIChannel* aChannel, const nsACString& aList,
|
||||
bool* aShouldContinue) override;
|
||||
|
||||
NS_IMETHOD GetURIByListType(nsIChannel* aChannel,
|
||||
nsIUrlClassifierFeature::listType aListType,
|
||||
nsIURI** aURI) override;
|
||||
|
||||
private:
|
||||
UrlClassifierFeatureFingerprintingAnnotation();
|
||||
|
||||
static void MaybeInitialize();
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_net_UrlClassifierFeatureFingerprintingAnnotation_h
|
|
@ -17,7 +17,7 @@ namespace net {
|
|||
|
||||
namespace {
|
||||
|
||||
#define FINGERPRINTING_FEATURE_NAME "fingerprinting-protection"
|
||||
#define FINGERPRINTING_FEATURE_NAME "fingerprinting"
|
||||
|
||||
#define URLCLASSIFIER_FINGERPRINTING_BLACKLIST \
|
||||
"urlclassifier.features.fingerprinting.blacklistTables"
|
||||
|
@ -147,31 +147,38 @@ UrlClassifierFeatureFingerprintingProtection::ProcessChannel(
|
|||
NS_ENSURE_ARG_POINTER(aChannel);
|
||||
NS_ENSURE_ARG_POINTER(aShouldContinue);
|
||||
|
||||
bool isAllowListed = UrlClassifierCommon::IsAllowListed(
|
||||
aChannel, AntiTrackingCommon::eFingerprinting);
|
||||
bool isAllowListed =
|
||||
IsAllowListed(aChannel, AntiTrackingCommon::eFingerprinting);
|
||||
|
||||
// This is a blocking feature.
|
||||
*aShouldContinue = isAllowListed;
|
||||
|
||||
if (isAllowListed) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
UrlClassifierCommon::SetBlockedContent(aChannel, NS_ERROR_FINGERPRINTING_URI,
|
||||
aList, EmptyCString(), EmptyCString());
|
||||
|
||||
UC_LOG(
|
||||
("UrlClassifierFeatureFingerprintingProtection::ProcessChannel, "
|
||||
"cancelling "
|
||||
"channel[%p]",
|
||||
aChannel));
|
||||
nsCOMPtr<nsIHttpChannelInternal> httpChannel = do_QueryInterface(aChannel);
|
||||
|
||||
if (httpChannel) {
|
||||
Unused << httpChannel->CancelByChannelClassifier(
|
||||
NS_ERROR_FINGERPRINTING_URI);
|
||||
// Even with fingerprinting blocking 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 fingerprinting blocking is enabled or
|
||||
// not.
|
||||
UrlClassifierCommon::NotifyChannelClassifierProtectionDisabled(
|
||||
aChannel, nsIWebProgressListener::STATE_LOADED_FINGERPRINTING_CONTENT);
|
||||
} else {
|
||||
Unused << aChannel->Cancel(NS_ERROR_FINGERPRINTING_URI);
|
||||
UrlClassifierCommon::SetBlockedContent(aChannel,
|
||||
NS_ERROR_FINGERPRINTING_URI, aList,
|
||||
EmptyCString(), EmptyCString());
|
||||
|
||||
UC_LOG(
|
||||
("UrlClassifierFeatureFingerprintingProtection::ProcessChannel, "
|
||||
"cancelling "
|
||||
"channel[%p]",
|
||||
aChannel));
|
||||
nsCOMPtr<nsIHttpChannelInternal> httpChannel = do_QueryInterface(aChannel);
|
||||
|
||||
if (httpChannel) {
|
||||
Unused << httpChannel->CancelByChannelClassifier(
|
||||
NS_ERROR_FINGERPRINTING_URI);
|
||||
} else {
|
||||
Unused << aChannel->Cancel(NS_ERROR_FINGERPRINTING_URI);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -8,10 +8,13 @@
|
|||
|
||||
#include "mozilla/AntiTrackingCommon.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/net/HttpBaseChannel.h"
|
||||
#include "mozilla/StaticPrefs.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/net/UrlClassifierCommon.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "TrackingDummyChannel.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
@ -35,6 +38,74 @@ namespace {
|
|||
|
||||
StaticRefPtr<UrlClassifierFeatureTrackingAnnotation> gFeatureTrackingAnnotation;
|
||||
|
||||
static void SetIsTrackingResourceHelper(nsIChannel* aChannel,
|
||||
bool aIsThirdParty) {
|
||||
MOZ_ASSERT(aChannel);
|
||||
|
||||
nsCOMPtr<nsIParentChannel> parentChannel;
|
||||
NS_QueryNotificationCallbacks(aChannel, parentChannel);
|
||||
if (parentChannel) {
|
||||
// This channel is a parent-process proxy for a child process
|
||||
// request. We should notify the child process as well.
|
||||
parentChannel->NotifyTrackingResource(aIsThirdParty);
|
||||
}
|
||||
|
||||
RefPtr<HttpBaseChannel> httpChannel = do_QueryObject(aChannel);
|
||||
if (httpChannel) {
|
||||
httpChannel->SetIsTrackingResource(aIsThirdParty);
|
||||
}
|
||||
|
||||
RefPtr<TrackingDummyChannel> dummyChannel = do_QueryObject(aChannel);
|
||||
if (dummyChannel) {
|
||||
dummyChannel->SetIsTrackingResource();
|
||||
}
|
||||
}
|
||||
|
||||
static void LowerPriorityHelper(nsIChannel* aChannel) {
|
||||
MOZ_ASSERT(aChannel);
|
||||
|
||||
bool isBlockingResource = false;
|
||||
|
||||
nsCOMPtr<nsIClassOfService> cos(do_QueryInterface(aChannel));
|
||||
if (cos) {
|
||||
if (nsContentUtils::IsTailingEnabled()) {
|
||||
uint32_t cosFlags = 0;
|
||||
cos->GetClassFlags(&cosFlags);
|
||||
isBlockingResource =
|
||||
cosFlags & (nsIClassOfService::UrgentStart |
|
||||
nsIClassOfService::Leader | nsIClassOfService::Unblocked);
|
||||
|
||||
// Requests not allowed to be tailed are usually those with higher
|
||||
// prioritization. That overweights being a tracker: don't throttle
|
||||
// them when not in background.
|
||||
if (!(cosFlags & nsIClassOfService::TailForbidden)) {
|
||||
cos->AddClassFlags(nsIClassOfService::Throttleable);
|
||||
}
|
||||
} else {
|
||||
// Yes, we even don't want to evaluate the isBlockingResource when tailing
|
||||
// is off see bug 1395525.
|
||||
|
||||
cos->AddClassFlags(nsIClassOfService::Throttleable);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isBlockingResource) {
|
||||
nsCOMPtr<nsISupportsPriority> p = do_QueryInterface(aChannel);
|
||||
if (p) {
|
||||
if (UC_LOG_ENABLED()) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
aChannel->GetURI(getter_AddRefs(uri));
|
||||
nsAutoCString spec;
|
||||
uri->GetAsciiSpec(spec);
|
||||
spec.Truncate(
|
||||
std::min(spec.Length(), UrlClassifierCommon::sMaxSpecLength));
|
||||
UC_LOG(("Setting PRIORITY_LOWEST for channel[%p] (%s)", aChannel,
|
||||
spec.get()));
|
||||
}
|
||||
p->SetPriority(nsISupportsPriority::PRIORITY_LOWEST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -124,10 +195,42 @@ UrlClassifierFeatureTrackingAnnotation::ProcessChannel(nsIChannel* aChannel,
|
|||
// This is not a blocking feature.
|
||||
*aShouldContinue = true;
|
||||
|
||||
UrlClassifierCommon::AnnotateChannel(
|
||||
aChannel, AntiTrackingCommon::eTrackingAnnotations,
|
||||
nsIHttpChannel::ClassificationFlags::CLASSIFIED_TRACKING,
|
||||
nsIWebProgressListener::STATE_LOADED_TRACKING_CONTENT);
|
||||
nsCOMPtr<nsIURI> chanURI;
|
||||
nsresult rv = aChannel->GetURI(getter_AddRefs(chanURI));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
UC_LOG(
|
||||
("UrlClassifierFeatureTrackingAnnotation::ProcessChannel "
|
||||
"nsIChannel::GetURI(%p) failed",
|
||||
(void*)aChannel));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool isThirdPartyWithTopLevelWinURI =
|
||||
nsContentUtils::IsThirdPartyWindowOrChannel(nullptr, aChannel, chanURI);
|
||||
|
||||
bool isAllowListed =
|
||||
IsAllowListed(aChannel, AntiTrackingCommon::eTrackingAnnotations);
|
||||
|
||||
UC_LOG(
|
||||
("UrlClassifierFeatureTrackingAnnotation::ProcessChannel, annotating "
|
||||
"channel[%p]",
|
||||
aChannel));
|
||||
|
||||
SetIsTrackingResourceHelper(aChannel, isThirdPartyWithTopLevelWinURI);
|
||||
|
||||
if (isThirdPartyWithTopLevelWinURI || isAllowListed) {
|
||||
// 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.
|
||||
UrlClassifierCommon::NotifyChannelClassifierProtectionDisabled(
|
||||
aChannel, nsIWebProgressListener::STATE_LOADED_TRACKING_CONTENT);
|
||||
}
|
||||
|
||||
if (isThirdPartyWithTopLevelWinURI &&
|
||||
StaticPrefs::privacy_trackingprotection_lower_network_priority()) {
|
||||
LowerPriorityHelper(aChannel);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -139,8 +139,8 @@ UrlClassifierFeatureTrackingProtection::ProcessChannel(nsIChannel* aChannel,
|
|||
NS_ENSURE_ARG_POINTER(aChannel);
|
||||
NS_ENSURE_ARG_POINTER(aShouldContinue);
|
||||
|
||||
bool isAllowListed = UrlClassifierCommon::IsAllowListed(
|
||||
aChannel, AntiTrackingCommon::eTrackingProtection);
|
||||
bool isAllowListed =
|
||||
IsAllowListed(aChannel, AntiTrackingCommon::eTrackingProtection);
|
||||
|
||||
// This is a blocking feature.
|
||||
*aShouldContinue = isAllowListed;
|
||||
|
|
|
@ -31,11 +31,9 @@ UNIFIED_SOURCES += [
|
|||
'nsChannelClassifier.cpp',
|
||||
'UrlClassifierCommon.cpp',
|
||||
'UrlClassifierFeatureBase.cpp',
|
||||
'UrlClassifierFeatureCryptominingAnnotation.cpp',
|
||||
'UrlClassifierFeatureCryptominingProtection.cpp',
|
||||
'UrlClassifierFeatureCustomTables.cpp',
|
||||
'UrlClassifierFeatureFactory.cpp',
|
||||
'UrlClassifierFeatureFingerprintingAnnotation.cpp',
|
||||
'UrlClassifierFeatureFingerprintingProtection.cpp',
|
||||
'UrlClassifierFeatureFlash.cpp',
|
||||
'UrlClassifierFeatureLoginReputation.cpp',
|
||||
|
|
|
@ -115,17 +115,7 @@ const FEATURES = [
|
|||
return Services.prefs.getBoolPref("browser.safebrowsing.features.flashBlock.update", this.enabled());
|
||||
},
|
||||
},
|
||||
{ name: "fingerprinting-annotation",
|
||||
list: ["urlclassifier.features.fingerprinting.annotate.blacklistTables",
|
||||
"urlclassifier.features.fingerprinting.annotate.whitelistTables"],
|
||||
enabled() {
|
||||
return Services.prefs.getBoolPref("privacy.trackingprotection.fingerprinting.annotate.enabled", false);
|
||||
},
|
||||
update() {
|
||||
return Services.prefs.getBoolPref("browser.safebrowsing.features.fingerprinting.annotate.update", this.enabled());
|
||||
},
|
||||
},
|
||||
{ name: "fingerprinting-protection",
|
||||
{ name: "fingerprinting",
|
||||
list: ["urlclassifier.features.fingerprinting.blacklistTables",
|
||||
"urlclassifier.features.fingerprinting.whitelistTables"],
|
||||
enabled() {
|
||||
|
@ -135,16 +125,7 @@ const FEATURES = [
|
|||
return Services.prefs.getBoolPref("browser.safebrowsing.features.fingerprinting.update", this.enabled());
|
||||
},
|
||||
},
|
||||
{ name: "cryptomining-annotation",
|
||||
list: ["urlclassifier.features.cryptomining.annotate.blacklistTables",
|
||||
"urlclassifier.features.cryptomining.annotate.whitelistTables"],
|
||||
enabled() {
|
||||
return Services.prefs.getBoolPref("privacy.trackingprotection.annotate.cryptomining.enabled", false);
|
||||
},
|
||||
update() {
|
||||
return Services.prefs.getBoolPref("browser.safebrowsing.features.cryptomining.annotate.update", this.enabled());
|
||||
},
|
||||
{ name: "cryptomining-protection",
|
||||
{ name: "cryptomining",
|
||||
list: ["urlclassifier.features.cryptomining.blacklistTables",
|
||||
"urlclassifier.features.cryptomining.whitelistTables"],
|
||||
enabled() {
|
||||
|
|
|
@ -1,156 +0,0 @@
|
|||
var tests = [
|
||||
// Config is an array with 4 elements:
|
||||
// - annotation blacklist
|
||||
// - annotation whitelist
|
||||
// - tracking blacklist
|
||||
// - tracking whitelist
|
||||
|
||||
// All disabled.
|
||||
{ config: [ false, false, false, false ], loadExpected: true, annotationExpected: false },
|
||||
|
||||
// Just whitelisted.
|
||||
{ config: [ false, false, false, true ], loadExpected: true, annotationExpected: false },
|
||||
|
||||
// Just blacklisted.
|
||||
{ config: [ false, false, true, false ], loadExpected: false, annotationExpected: false },
|
||||
|
||||
// whitelist + blacklist => whitelist wins
|
||||
{ config: [ false, false, true, true ], loadExpected: true, annotationExpected: false },
|
||||
|
||||
// just annotated in whitelist.
|
||||
{ config: [ false, true, false, false ], loadExpected: true, annotationExpected: false },
|
||||
|
||||
// TP and annotation whitelisted.
|
||||
{ config: [ false, true, false, true ], loadExpected: true, annotationExpected: false },
|
||||
|
||||
// Annotation whitelisted, but TP blacklisted.
|
||||
{ config: [ false, true, true, false ], loadExpected: false, annotationExpected: false },
|
||||
|
||||
// Annotation whitelisted. TP blacklisted and whitelisted: whitelist wins.
|
||||
{ config: [ false, true, true, true ], loadExpected: true, annotationExpected: false },
|
||||
|
||||
// Just blacklist annotated.
|
||||
{ config: [ true, false, false, false ], loadExpected: true, annotationExpected: true },
|
||||
|
||||
// annotated but TP whitelisted.
|
||||
{ config: [ true, false, false, true ], loadExpected: true, annotationExpected: true },
|
||||
|
||||
// annotated and blacklisted.
|
||||
{ config: [ true, false, true, false ], loadExpected: false, annotationExpected: false },
|
||||
|
||||
// annotated, TP blacklisted and whitelisted: whitelist wins.
|
||||
{ config: [ true, false, true, true ], loadExpected: true, annotationExpected: true },
|
||||
|
||||
// annotated in white and blacklist.
|
||||
{ config: [ true, true, false, false ], loadExpected: true, annotationExpected: false },
|
||||
|
||||
// annotated in white and blacklist. TP Whiteslited
|
||||
{ config: [ true, true, false, true ], loadExpected: true, annotationExpected: false },
|
||||
|
||||
// everywhere. TP whitelist wins.
|
||||
{ config: [ true, true, true, true ], loadExpected: true, annotationExpected: false },
|
||||
];
|
||||
|
||||
function prefBlacklistValue(value) {
|
||||
return value ? "example.com" : "";
|
||||
}
|
||||
|
||||
function prefWhitelistValue(value) {
|
||||
return value ? "mochi.test" : "";
|
||||
}
|
||||
|
||||
async function runTest(test, expectedFlag, expectedTrackingResource, prefs) {
|
||||
let config = [
|
||||
[ "urlclassifier.trackingAnnotationTable.testEntries", prefBlacklistValue(test.config[0]) ],
|
||||
[ "urlclassifier.features.fingerprinting.annotate.blacklistHosts", prefBlacklistValue(test.config[0]) ],
|
||||
[ "urlclassifier.features.cryptomining.annotate.blacklistHosts", prefBlacklistValue(test.config[0]) ],
|
||||
|
||||
[ "urlclassifier.trackingAnnotationWhitelistTable.testEntries", prefWhitelistValue(test.config[1]) ],
|
||||
[ "urlclassifier.features.fingerprinting.annotate.whitelistHosts", prefWhitelistValue(test.config[1]) ],
|
||||
[ "urlclassifier.features.cryptomining.annotate.whitelistHosts", prefWhitelistValue(test.config[1]) ],
|
||||
|
||||
[ "urlclassifier.trackingTable.testEntries", prefBlacklistValue(test.config[2]) ],
|
||||
[ "urlclassifier.features.fingerprinting.blacklistHosts", prefBlacklistValue(test.config[2]) ],
|
||||
[ "urlclassifier.features.cryptomining.blacklistHosts", prefBlacklistValue(test.config[2]) ],
|
||||
|
||||
[ "urlclassifier.trackingWhitelistTable.testEntries", prefWhitelistValue(test.config[3]) ],
|
||||
[ "urlclassifier.features.fingerprinting.whitelistHosts", prefWhitelistValue(test.config[3]) ],
|
||||
[ "urlclassifier.features.cryptomining.whitelistHosts", prefWhitelistValue(test.config[3]) ],
|
||||
];
|
||||
|
||||
info("Testing: " + config.toSource() + "\n");
|
||||
|
||||
await SpecialPowers.pushPrefEnv({set: config.concat(prefs) });
|
||||
|
||||
// This promise will be resolved when the chromeScript knows if the channel
|
||||
// is annotated or not.
|
||||
let annotationPromise;
|
||||
if (test.loadExpected) {
|
||||
info("We want to have annotation information");
|
||||
annotationPromise = new Promise(resolve => {
|
||||
chromeScript.addMessageListener("last-channel-flags",
|
||||
data => resolve(data),
|
||||
{once: true});
|
||||
});
|
||||
}
|
||||
|
||||
// Let's load an image with a random query string, just 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, "The loading happened correctly");
|
||||
|
||||
if (annotationPromise) {
|
||||
let data = await annotationPromise;
|
||||
is(!!data.classificationFlags, test.annotationExpected, "The annotation happened correctly");
|
||||
if (test.annotationExpected) {
|
||||
is(data.classificationFlags, expectedFlag, "Correct flag");
|
||||
is(data.isTrackingResource, expectedTrackingResource, "Tracking resource flag matches");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var chromeScript;
|
||||
|
||||
function runTests(flag, prefs, trackingResource) {
|
||||
chromeScript = SpecialPowers.loadChromeScript(_ => {
|
||||
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function onExamResp(subject, topic, data) {
|
||||
let channel = subject.QueryInterface(Ci.nsIHttpChannel);
|
||||
if (!channel ||
|
||||
!channel.URI.spec.startsWith("http://example.com/tests/toolkit/components/url-classifier/tests/mochitest/raptor.jpg")) {
|
||||
return;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
sendAsyncMessage("last-channel-flags", {
|
||||
classificationFlags: channel.classificationFlags,
|
||||
isTrackingResource: channel.isTrackingResource,
|
||||
});
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
addMessageListener("done", __ => {
|
||||
Services.obs.removeObserver(onExamResp, "http-on-examine-response");
|
||||
});
|
||||
|
||||
Services.obs.addObserver(onExamResp, "http-on-examine-response");
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
sendAsyncMessage("start-test");
|
||||
});
|
||||
|
||||
chromeScript.addMessageListener("start-test", async _ => {
|
||||
for (let test in tests) {
|
||||
await runTest(tests[test], flag, trackingResource, prefs);
|
||||
}
|
||||
|
||||
chromeScript.sendAsyncMessage("done");
|
||||
SimpleTest.finish();
|
||||
}, {once: true});
|
||||
}
|
|
@ -32,7 +32,6 @@ support-files =
|
|||
gethashFrame.html
|
||||
seek.webm
|
||||
cache.sjs
|
||||
features.js
|
||||
|
||||
[test_classifier.html]
|
||||
skip-if = (os == 'linux' && debug) #Bug 1199778
|
||||
|
@ -47,6 +46,4 @@ skip-if = (verify && debug && (os == 'win' || os == 'mac'))
|
|||
skip-if = verify
|
||||
[test_annotation_vs_TP.html]
|
||||
[test_fingerprinting.html]
|
||||
[test_fingerprinting_annotate.html]
|
||||
[test_cryptomining.html]
|
||||
[test_cryptomining_annotate.html]
|
||||
|
|
|
@ -3,23 +3,150 @@
|
|||
<head>
|
||||
<title>Test the relationship between annotation vs TP</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="features.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
runTests(SpecialPowers.Ci.nsIHttpChannel.CLASSIFIED_TRACKING,
|
||||
[
|
||||
["privacy.trackingprotection.enabled", true],
|
||||
["privacy.trackingprotection.annotate_channels", true],
|
||||
["privacy.trackingprotection.fingerprinting.annotate.enabled", false],
|
||||
["privacy.trackingprotection.fingerprinting.enabled", false],
|
||||
["privacy.trackingprotection.cryptomining.annotate.enabled", false],
|
||||
["privacy.trackingprotection.cryptomining.enabled", false],
|
||||
],
|
||||
true /* a tracking resource */);
|
||||
var tests = [
|
||||
// Config is an array with 4 elements:
|
||||
// - annotation blacklist
|
||||
// - annotation whitelist
|
||||
// - tracking blacklist
|
||||
// - tracking whitelist
|
||||
|
||||
// All disabled.
|
||||
{ config: [ false, false, false, false ], loadExpected: true, annotationExpected: false },
|
||||
|
||||
// Just whitelisted.
|
||||
{ config: [ false, false, false, true ], loadExpected: true, annotationExpected: false },
|
||||
|
||||
// Just blacklisted.
|
||||
{ config: [ false, false, true, false ], loadExpected: false, annotationExpected: false },
|
||||
|
||||
// whitelist + blacklist => whitelist wins
|
||||
{ config: [ false, false, true, true ], loadExpected: true, annotationExpected: false },
|
||||
|
||||
// just annotated in whitelist.
|
||||
{ config: [ false, true, false, false ], loadExpected: true, annotationExpected: false },
|
||||
|
||||
// TP and annotation whitelisted.
|
||||
{ config: [ false, true, false, true ], loadExpected: true, annotationExpected: false },
|
||||
|
||||
// Annotation whitelisted, but TP blacklisted.
|
||||
{ config: [ false, true, true, false ], loadExpected: false, annotationExpected: false },
|
||||
|
||||
// Annotation whitelisted. TP blacklisted and whitelisted: whitelist wins.
|
||||
{ config: [ false, true, true, true ], loadExpected: true, annotationExpected: false },
|
||||
|
||||
// Just blacklist annotated.
|
||||
{ config: [ true, false, false, false ], loadExpected: true, annotationExpected: true },
|
||||
|
||||
// annotated but TP whitelisted.
|
||||
{ config: [ true, false, false, true ], loadExpected: true, annotationExpected: true },
|
||||
|
||||
// annotated and blacklisted.
|
||||
{ config: [ true, false, true, false ], loadExpected: false, annotationExpected: false },
|
||||
|
||||
// annotated, TP blacklisted and whitelisted: whitelist wins.
|
||||
{ config: [ true, false, true, true ], loadExpected: true, annotationExpected: true },
|
||||
|
||||
// annotated in white and blacklist.
|
||||
{ config: [ true, true, false, false ], loadExpected: true, annotationExpected: false },
|
||||
|
||||
// annotated in white and blacklist. TP Whiteslited
|
||||
{ config: [ true, true, false, true ], loadExpected: true, annotationExpected: false },
|
||||
|
||||
// everywhere. TP whitelist wins.
|
||||
{ config: [ true, true, true, true ], loadExpected: true, annotationExpected: false },
|
||||
];
|
||||
|
||||
function prefBlacklistValue(value) {
|
||||
return value ? "example.com" : "";
|
||||
}
|
||||
|
||||
function prefWhitelistValue(value) {
|
||||
return value ? "mochi.test" : "";
|
||||
}
|
||||
|
||||
async function runTest(test) {
|
||||
let config = [
|
||||
[ "urlclassifier.trackingAnnotationTable.testEntries", prefBlacklistValue(test.config[0]) ],
|
||||
[ "urlclassifier.trackingAnnotationWhitelistTable.testEntries", prefWhitelistValue(test.config[1]) ],
|
||||
[ "urlclassifier.trackingTable.testEntries", prefBlacklistValue(test.config[2]) ],
|
||||
[ "urlclassifier.trackingWhitelistTable.testEntries", prefWhitelistValue(test.config[3]) ],
|
||||
];
|
||||
|
||||
info("Testing: " + config.toSource() + "\n");
|
||||
|
||||
// Let's enable TP and annotation.
|
||||
config.push(["privacy.trackingprotection.enabled", true]);
|
||||
config.push(["privacy.trackingprotection.annotate_channels", true]);
|
||||
|
||||
await SpecialPowers.pushPrefEnv({set: config });
|
||||
|
||||
// This promise will be resolved when the chromeScript knows if the channel
|
||||
// is annotated or not.
|
||||
let annotationPromise;
|
||||
if (test.loadExpected) {
|
||||
info("We want to have annotation information");
|
||||
annotationPromise = new Promise(resolve => {
|
||||
chromeScript.addMessageListener("last-channel-status",
|
||||
annotated => resolve(annotated),
|
||||
{once: true});
|
||||
});
|
||||
}
|
||||
|
||||
// Let's load an image with a random query string, just 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, "The loading happened correctly");
|
||||
|
||||
if (annotationPromise) {
|
||||
is(await annotationPromise, test.annotationExpected, "The annotation happened correctly");
|
||||
}
|
||||
}
|
||||
|
||||
var chromeScript = SpecialPowers.loadChromeScript(_ => {
|
||||
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function onExamResp(subject, topic, data) {
|
||||
let channel = subject.QueryInterface(Ci.nsIHttpChannel);
|
||||
if (!channel ||
|
||||
!channel.URI.spec.startsWith("http://example.com/tests/toolkit/components/url-classifier/tests/mochitest/raptor.jpg")) {
|
||||
return;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
sendAsyncMessage("last-channel-status", channel.isTrackingResource);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
addMessageListener("done", __ => {
|
||||
Services.obs.removeObserver(onExamResp, "http-on-examine-response");
|
||||
});
|
||||
|
||||
Services.obs.addObserver(onExamResp, "http-on-examine-response");
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
sendAsyncMessage("start-test");
|
||||
});
|
||||
|
||||
chromeScript.addMessageListener("start-test", async _ => {
|
||||
for (let test in tests) {
|
||||
await runTest(tests[test]);
|
||||
}
|
||||
|
||||
chromeScript.sendAsyncMessage("done");
|
||||
SimpleTest.finish();
|
||||
}, {once: true});
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test the relationship between annotation vs blocking - cryptomining</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="features.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
runTests(SpecialPowers.Ci.nsIHttpChannel.CLASSIFIED_CRYPTOMINING,
|
||||
[
|
||||
["privacy.trackingprotection.enabled", false],
|
||||
["privacy.trackingprotection.annotate_channels", false],
|
||||
["privacy.trackingprotection.fingerprinting.annotate.enabled", false],
|
||||
["privacy.trackingprotection.fingerprinting.enabled", false],
|
||||
["privacy.trackingprotection.cryptomining.annotate.enabled", true],
|
||||
["privacy.trackingprotection.cryptomining.enabled", true],
|
||||
],
|
||||
false /* a tracking resource */);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,27 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test the relationship between annotation vs blocking - fingerprinting</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="features.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
runTests(SpecialPowers.Ci.nsIHttpChannel.CLASSIFIED_FINGERPRINTING,
|
||||
[
|
||||
["privacy.trackingprotection.enabled", false],
|
||||
["privacy.trackingprotection.annotate_channels", false],
|
||||
["privacy.trackingprotection.fingerprinting.annotate.enabled", true],
|
||||
["privacy.trackingprotection.fingerprinting.enabled", true],
|
||||
["privacy.trackingprotection.cryptomining.annotate.enabled", false],
|
||||
["privacy.trackingprotection.cryptomining.enabled", false],
|
||||
],
|
||||
true /* a tracking resource */);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -405,8 +405,7 @@ NS_IMETHODIMP nsExtProtocolChannel::SetClassifierMatchedInfo(
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsExtProtocolChannel::NotifyClassificationFlags(
|
||||
uint32_t aClassificationFlags, bool aIsThirdParty) {
|
||||
NS_IMETHODIMP nsExtProtocolChannel::NotifyTrackingResource(bool aIsThirdParty) {
|
||||
// nothing to do
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче