Bug 1447935 - P2. Use fission-compatible third-party checks r=baku

Differential Revision: https://phabricator.services.mozilla.com/D80187
This commit is contained in:
Dimi Lee 2020-07-09 11:32:45 +00:00
Родитель 3f4421f020
Коммит 84e027594f
4 изменённых файлов: 59 добавлений и 74 удалений

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

@ -6,10 +6,10 @@
#include "UrlClassifierFeatureCryptominingProtection.h"
#include "mozilla/AntiTrackingUtils.h"
#include "mozilla/net/UrlClassifierCommon.h"
#include "ChannelClassifierService.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "nsContentUtils.h"
#include "nsNetUtil.h"
namespace mozilla {
@ -87,16 +87,12 @@ UrlClassifierFeatureCryptominingProtection::MaybeCreate(nsIChannel* aChannel) {
return nullptr;
}
nsCOMPtr<nsIURI> chanURI;
nsresult rv = aChannel->GetURI(getter_AddRefs(chanURI));
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
}
bool isThirdParty =
nsContentUtils::IsThirdPartyWindowOrChannel(nullptr, aChannel, chanURI);
bool isThirdParty = AntiTrackingUtils::IsThirdPartyChannel(aChannel);
if (!isThirdParty) {
if (UC_LOG_ENABLED()) {
nsCOMPtr<nsIURI> chanURI;
Unused << aChannel->GetURI(getter_AddRefs(chanURI));
if (chanURI) {
nsCString spec = chanURI->GetSpecOrDefault();
spec.Truncate(
std::min(spec.Length(), UrlClassifierCommon::sMaxSpecLength));
@ -107,7 +103,7 @@ UrlClassifierFeatureCryptominingProtection::MaybeCreate(nsIChannel* aChannel) {
"with uri %s",
aChannel, spec.get()));
}
}
return nullptr;
}

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

@ -6,10 +6,10 @@
#include "UrlClassifierFeatureFingerprintingProtection.h"
#include "mozilla/AntiTrackingUtils.h"
#include "mozilla/net/UrlClassifierCommon.h"
#include "ChannelClassifierService.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "nsContentUtils.h"
#include "nsNetUtil.h"
namespace mozilla {
@ -90,16 +90,12 @@ UrlClassifierFeatureFingerprintingProtection::MaybeCreate(
return nullptr;
}
nsCOMPtr<nsIURI> chanURI;
nsresult rv = aChannel->GetURI(getter_AddRefs(chanURI));
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
}
bool isThirdParty =
nsContentUtils::IsThirdPartyWindowOrChannel(nullptr, aChannel, chanURI);
bool isThirdParty = AntiTrackingUtils::IsThirdPartyChannel(aChannel);
if (!isThirdParty) {
if (UC_LOG_ENABLED()) {
nsCOMPtr<nsIURI> chanURI;
Unused << aChannel->GetURI(getter_AddRefs(chanURI));
if (chanURI) {
nsCString spec = chanURI->GetSpecOrDefault();
spec.Truncate(
std::min(spec.Length(), UrlClassifierCommon::sMaxSpecLength));
@ -110,6 +106,7 @@ UrlClassifierFeatureFingerprintingProtection::MaybeCreate(
"with uri %s",
aChannel, spec.get()));
}
}
return nullptr;
}

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

@ -6,10 +6,10 @@
#include "UrlClassifierFeatureSocialTrackingProtection.h"
#include "mozilla/AntiTrackingUtils.h"
#include "mozilla/net/UrlClassifierCommon.h"
#include "ChannelClassifierService.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "nsContentUtils.h"
#include "nsNetUtil.h"
namespace mozilla {
@ -90,16 +90,12 @@ UrlClassifierFeatureSocialTrackingProtection::MaybeCreate(
return nullptr;
}
nsCOMPtr<nsIURI> chanURI;
nsresult rv = aChannel->GetURI(getter_AddRefs(chanURI));
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
}
bool isThirdParty =
nsContentUtils::IsThirdPartyWindowOrChannel(nullptr, aChannel, chanURI);
bool isThirdParty = AntiTrackingUtils::IsThirdPartyChannel(aChannel);
if (!isThirdParty) {
if (UC_LOG_ENABLED()) {
nsCOMPtr<nsIURI> chanURI;
Unused << aChannel->GetURI(getter_AddRefs(chanURI));
if (chanURI) {
nsCString spec = chanURI->GetSpecOrDefault();
spec.Truncate(
std::min(spec.Length(), UrlClassifierCommon::sMaxSpecLength));
@ -110,7 +106,7 @@ UrlClassifierFeatureSocialTrackingProtection::MaybeCreate(
"with uri %s",
aChannel, spec.get()));
}
}
return nullptr;
}

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

@ -6,9 +6,9 @@
#include "UrlClassifierFeatureTrackingProtection.h"
#include "mozilla/AntiTrackingUtils.h"
#include "mozilla/net/UrlClassifierCommon.h"
#include "ChannelClassifierService.h"
#include "nsContentUtils.h"
#include "nsIHttpChannelInternal.h"
#include "nsILoadContext.h"
#include "nsNetUtil.h"
@ -93,16 +93,12 @@ UrlClassifierFeatureTrackingProtection::MaybeCreate(nsIChannel* aChannel) {
return nullptr;
}
nsCOMPtr<nsIURI> chanURI;
nsresult rv = aChannel->GetURI(getter_AddRefs(chanURI));
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
}
bool isThirdParty =
nsContentUtils::IsThirdPartyWindowOrChannel(nullptr, aChannel, chanURI);
bool isThirdParty = AntiTrackingUtils::IsThirdPartyChannel(aChannel);
if (!isThirdParty) {
if (UC_LOG_ENABLED()) {
nsCOMPtr<nsIURI> chanURI;
Unused << aChannel->GetURI(getter_AddRefs(chanURI));
if (chanURI) {
nsCString spec = chanURI->GetSpecOrDefault();
spec.Truncate(
std::min(spec.Length(), UrlClassifierCommon::sMaxSpecLength));
@ -112,7 +108,7 @@ UrlClassifierFeatureTrackingProtection::MaybeCreate(nsIChannel* aChannel) {
"with uri %s",
aChannel, spec.get()));
}
}
return nullptr;
}