Bug 1620322 - Part 8: Rename AntiTrackingCommon to ContentBlocking; r=baku

Differential Revision: https://phabricator.services.mozilla.com/D65821

--HG--
rename : toolkit/components/antitracking/AntiTrackingCommon.cpp => toolkit/components/antitracking/ContentBlocking.cpp
rename : toolkit/components/antitracking/AntiTrackingCommon.h => toolkit/components/antitracking/ContentBlocking.h
extra : moz-landing-system : lando
This commit is contained in:
Ehsan Akhgari 2020-03-09 10:23:07 +00:00
Родитель 0dd09035a7
Коммит 1195c302a4
40 изменённых файлов: 116 добавлений и 182 удалений

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

@ -19404,7 +19404,6 @@ Gecko_BeginWritingCString
?ShouldEnableClassifier@UrlClassifierCommon@net@mozilla@@SA_NPAVnsIChannel@@@Z
?AddonMayLoad@UrlClassifierCommon@net@mozilla@@SA_NPAVnsIChannel@@PAVnsIURI@@@Z
?GetTopWindowURI@HttpBaseChannel@net@mozilla@@UAG?AW4nsresult@@PAPAVnsIURI@@@Z
?MaybeGetDocumentURIBeingLoaded@AntiTrackingCommon@mozilla@@SA?AU?$already_AddRefed@VnsIURI@@@@PAVnsIChannel@@@Z
?GetTopWindowURI@HttpBaseChannel@net@mozilla@@IAE?AW4nsresult@@PAVnsIURI@@PAPAV5@@Z
XPCOMService_GetThirdPartyUtil
?GetTopWindowForChannel@ThirdPartyUtil@@UAG?AW4nsresult@@PAVnsIChannel@@PAVnsIURI@@PAPAVmozIDOMWindowProxy@@@Z
@ -19532,7 +19531,6 @@ XPCOMService_GetThirdPartyUtil
?IsTrackingClassificationFlag@UrlClassifierCommon@net@mozilla@@SA_NI@Z
?DeQueue@nsHostResolver@@AAEXAAV?$LinkedList@V?$RefPtr@VnsHostRecord@@@@@mozilla@@PAPAVAddrHostRecord@@@Z
?popFirst@?$LinkedList@V?$RefPtr@VnsHostRecord@@@@@mozilla@@QAE?AV?$RefPtr@VnsHostRecord@@@@XZ
?IsFirstPartyStorageAccessGrantedFor@AntiTrackingCommon@mozilla@@SA_NPAVnsIHttpChannel@@PAVnsIURI@@PAI@Z
?GetTopLevelPrincipal@LoadInfo@net@mozilla@@UAEPAVnsIPrincipal@@XZ
?GetIsMainDocumentChannel@HttpBaseChannel@net@mozilla@@UAG?AW4nsresult@@PA_N@Z
?GetAddrInfo@net@mozilla@@YA?AW4nsresult@@ABV?$nsTSubstring@D@@GGPAPAVAddrInfo@12@_N@Z
@ -19548,12 +19546,10 @@ XPCOMService_GetThirdPartyUtil
?extensions_cookiesBehavior_overrideOnTopLevel@StaticPrefs@mozilla@@SA_NXZ
?GetChannelId@HttpBaseChannel@net@mozilla@@UAG?AW4nsresult@@PA_K@Z
??$?0PAV?$nsTArray@V?$function@$$A6AXXZ@std@@@@V?$DefaultDelete@V?$nsTArray@V?$function@$$A6AXXZ@std@@@@@mozilla@@@?$PairHelper@PAV?$nsTArray@V?$function@$$A6AXXZ@std@@@@V?$DefaultDelete@V?$nsTArray@V?$function@$$A6AXXZ@std@@@@@mozilla@@$00$0A@@detail@mozilla@@IAE@$$QAPAV?$nsTArray@V?$function@$$A6AXXZ@std@@@@$$QAV?$DefaultDelete@V?$nsTArray@V?$function@$$A6AXXZ@std@@@@@2@@Z
?OnAntiTrackingSettingsChanged@AntiTrackingCommon@mozilla@@SAXABV?$function@$$A6AXXZ@std@@@Z
?first@?$PairHelper@PAV?$nsTArray@V?$function@$$A6AXXZ@std@@@@V?$DefaultDelete@V?$nsTArray@V?$function@$$A6AXXZ@std@@@@@mozilla@@$00$0A@@detail@mozilla@@IBEABQAV?$nsTArray@V?$function@$$A6AXXZ@std@@@@XZ
??4?$UniquePtr@V?$nsTArray@V?$function@$$A6AXXZ@std@@@@V?$DefaultDelete@V?$nsTArray@V?$function@$$A6AXXZ@std@@@@@mozilla@@@mozilla@@QAEAAV01@$$QAV01@@Z
??$AppendElement@ABV?$function@$$A6AXXZ@std@@UnsTArrayInfallibleAllocator@@@?$nsTArray_Impl@V?$function@$$A6AXXZ@std@@UnsTArrayInfallibleAllocator@@@@IAEPAV?$function@$$A6AXXZ@std@@ABV12@@Z
??$EnsureCapacity@UnsTArrayInfallibleAllocator@@@?$nsTArray_base@UnsTArrayInfallibleAllocator@@U?$nsTArray_CopyWithConstructors@V?$function@$$A6AXXZ@std@@@@@@IAE?AUnsTArrayInfallibleResult@@II@Z
?IsOnContentBlockingAllowList@AntiTrackingCommon@mozilla@@SA?AW4nsresult@@PAVnsIURI@@_NW4ContentBlockingAllowListPurpose@12@AA_N@Z
?TestPermissionOriginNoSuffix@nsPermissionManager@@UAG?AW4nsresult@@ABV?$nsTSubstring@D@@0PAI@Z
?NS_IsSafeTopLevelNav@@YA_NPAVnsIChannel@@@Z
?IsSafeMethod@nsHttpRequestHead@net@mozilla@@QAE_NXZ
@ -26368,7 +26364,6 @@ Gecko_AppendPropertyValuePair
?QueryInterface@imgLoader@@UAG?AW4nsresult@@ABUnsID@@PAPAX@Z
?FindEntryProperties@imgLoader@@UAG?AW4nsresult@@PAVnsIURI@@PAVDocument@dom@mozilla@@PAPAVnsIProperties@@@Z
?IsThirdPartyTrackingResourceWindow@nsContentUtils@@SA_NPAVnsPIDOMWindowInner@@@Z
?MaybeIsFirstPartyStorageAccessGrantedFor@AntiTrackingCommon@mozilla@@SA_NPAVnsPIDOMWindowInner@@PAVnsIURI@@@Z
??$CreateAndResolve@_N@?$MozPromise@H_N$00@mozilla@@SA?AV?$RefPtr@V?$MozPromise@H_N$00@mozilla@@@@$$QA_NPBD@Z
?AdjustPriority@HttpBaseChannel@net@mozilla@@UAG?AW4nsresult@@H@Z
?SetTimingEnabled@imgRequestProxy@@UAG?AW4nsresult@@_N@Z

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

@ -19322,7 +19322,6 @@ Gecko_BeginWritingCString
?ShouldEnableClassifier@UrlClassifierCommon@net@mozilla@@SA_NPEAVnsIChannel@@@Z
?AddonMayLoad@UrlClassifierCommon@net@mozilla@@SA_NPEAVnsIChannel@@PEAVnsIURI@@@Z
?GetTopWindowURI@HttpBaseChannel@net@mozilla@@UEAA?AW4nsresult@@PEAPEAVnsIURI@@@Z
?MaybeGetDocumentURIBeingLoaded@AntiTrackingCommon@mozilla@@SA?AU?$already_AddRefed@VnsIURI@@@@PEAVnsIChannel@@@Z
?GetTopWindowURI@HttpBaseChannel@net@mozilla@@IEAA?AW4nsresult@@PEAVnsIURI@@PEAPEAV5@@Z
XPCOMService_GetThirdPartyUtil
?GetTopWindowForChannel@ThirdPartyUtil@@UEAA?AW4nsresult@@PEAVnsIChannel@@PEAVnsIURI@@PEAPEAVmozIDOMWindowProxy@@@Z
@ -19443,7 +19442,6 @@ XPCOMService_GetThirdPartyUtil
?IsThirdPartyInternal@ThirdPartyUtil@@AEAA?AW4nsresult@@AEBV?$nsTString@D@@PEAVnsIURI@@PEA_N@Z
?IsTrackingResource@HttpBaseChannel@net@mozilla@@UEAA?AW4nsresult@@PEA_N@Z
?IsTrackingClassificationFlag@UrlClassifierCommon@net@mozilla@@SA_NI@Z
?IsFirstPartyStorageAccessGrantedFor@AntiTrackingCommon@mozilla@@SA_NPEAVnsIHttpChannel@@PEAVnsIURI@@PEAI@Z
?GetTopLevelPrincipal@LoadInfo@net@mozilla@@UEAAPEAVnsIPrincipal@@XZ
?GetIsMainDocumentChannel@HttpBaseChannel@net@mozilla@@UEAA?AW4nsresult@@PEA_N@Z
?GetIsContentPrincipal@BasePrincipal@mozilla@@UEAA?AW4nsresult@@PEA_N@Z
@ -19464,12 +19462,10 @@ XPCOMService_GetThirdPartyUtil
?extensions_cookiesBehavior_overrideOnTopLevel@StaticPrefs@mozilla@@SA_NXZ
?GetChannelId@HttpBaseChannel@net@mozilla@@UEAA?AW4nsresult@@PEA_K@Z
??$?0PEAV?$nsTArray@V?$function@$$A6AXXZ@std@@@@V?$DefaultDelete@V?$nsTArray@V?$function@$$A6AXXZ@std@@@@@mozilla@@@?$PairHelper@PEAV?$nsTArray@V?$function@$$A6AXXZ@std@@@@V?$DefaultDelete@V?$nsTArray@V?$function@$$A6AXXZ@std@@@@@mozilla@@$00$0A@@detail@mozilla@@IEAA@$$QEAPEAV?$nsTArray@V?$function@$$A6AXXZ@std@@@@$$QEAV?$DefaultDelete@V?$nsTArray@V?$function@$$A6AXXZ@std@@@@@2@@Z
?OnAntiTrackingSettingsChanged@AntiTrackingCommon@mozilla@@SAXAEBV?$function@$$A6AXXZ@std@@@Z
?first@?$PairHelper@PEAV?$nsTArray@V?$function@$$A6AXXZ@std@@@@V?$DefaultDelete@V?$nsTArray@V?$function@$$A6AXXZ@std@@@@@mozilla@@$00$0A@@detail@mozilla@@IEBAAEBQEAV?$nsTArray@V?$function@$$A6AXXZ@std@@@@XZ
?reset@?$UniquePtr@V?$nsTArray@V?$function@$$A6AXXZ@std@@@@V?$DefaultDelete@V?$nsTArray@V?$function@$$A6AXXZ@std@@@@@mozilla@@@mozilla@@QEAAXPEAV?$nsTArray@V?$function@$$A6AXXZ@std@@@@@Z
??$AppendElement@AEBV?$function@$$A6AXXZ@std@@UnsTArrayInfallibleAllocator@@@?$nsTArray_Impl@V?$function@$$A6AXXZ@std@@UnsTArrayInfallibleAllocator@@@@IEAAPEAV?$function@$$A6AXXZ@std@@AEBV12@@Z
??$EnsureCapacity@UnsTArrayInfallibleAllocator@@@?$nsTArray_base@UnsTArrayInfallibleAllocator@@U?$nsTArray_CopyWithConstructors@V?$function@$$A6AXXZ@std@@@@@@IEAA?AUnsTArrayInfallibleResult@@_K0@Z
?IsOnContentBlockingAllowList@AntiTrackingCommon@mozilla@@SA?AW4nsresult@@PEAVnsIURI@@_NW4ContentBlockingAllowListPurpose@12@AEA_N@Z
?TestPermissionOriginNoSuffix@nsPermissionManager@@UEAA?AW4nsresult@@AEBV?$nsTSubstring@D@@0PEAI@Z
?NS_IsSafeTopLevelNav@@YA_NPEAVnsIChannel@@@Z
?IsSafeMethod@nsHttpRequestHead@net@mozilla@@QEAA_NXZ
@ -26335,7 +26331,6 @@ UnregisterWeakMemoryReporter
?ExplicitSetUploadStreamLength@HttpBaseChannel@net@mozilla@@AEAA?AW4nsresult@@_K_N@Z
??$ReplaceChar@_SX@?$nsTString@_S@@QEAAXPEBD_S@Z
?Set@URLParams@dom@mozilla@@QEAAXAEBV?$nsTSubstring@_S@@0@Z
?NotifyBlockingDecision@AntiTrackingCommon@mozilla@@SAXPEAVnsIChannel@@W4BlockingDecision@12@I@Z
?ConstructorEnabled@ChannelWrapper_Binding@dom@mozilla@@YA_NPEAUJSContext@@V?$Handle@PEAVJSObject@@@JS@@@Z
?CreateInterfaceObjects@ChannelWrapper_Binding@dom@mozilla@@YAXPEAUJSContext@@V?$Handle@PEAVJSObject@@@JS@@AEAVProtoAndIfaceCache@23@_N@Z
?Id@ChannelWrapper@extensions@mozilla@@QEBA_KXZ
@ -26670,7 +26665,6 @@ Gecko_AppendPropertyValuePair
?IsImageInCache@nsContentUtils@@SA_NPEAVnsIURI@@PEAVDocument@dom@mozilla@@@Z
?FindEntryProperties@imgLoader@@UEAA?AW4nsresult@@PEAVnsIURI@@PEAVDocument@dom@mozilla@@PEAPEAVnsIProperties@@@Z
?IsThirdPartyTrackingResourceWindow@nsContentUtils@@SA_NPEAVnsPIDOMWindowInner@@@Z
?MaybeIsFirstPartyStorageAccessGrantedFor@AntiTrackingCommon@mozilla@@SA_NPEAVnsPIDOMWindowInner@@PEAVnsIURI@@@Z
??$CreateAndResolve@_N@?$MozPromise@H_N$00@mozilla@@SA?AV?$RefPtr@V?$MozPromise@H_N$00@mozilla@@@@$$QEA_NPEBD@Z
?AdjustPriority@HttpBaseChannel@net@mozilla@@UEAA?AW4nsresult@@H@Z
?SetTimingEnabled@imgRequestProxy@@UEAA?AW4nsresult@@_N@Z

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

@ -11,11 +11,11 @@
#include "AudioChannelService.h"
#include "mozilla/dom/Document.h"
#include "DocumentInlines.h"
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/AntiTrackingUtils.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/BinarySearch.h"
#include "mozilla/ContentBlocking.h"
#include "mozilla/ContentBlockingAllowList.h"
#include "mozilla/ContentBlockingUserInteraction.h"
#include "mozilla/CSSEnabledState.h"
@ -15066,7 +15066,7 @@ void Document::MaybeAllowStorageForOpenerAfterUserInteraction() {
}
// We don't care when the asynchronous work finishes here.
Unused << AntiTrackingCommon::AddFirstPartyStorageAccessGrantedFor(
Unused << ContentBlocking::AllowAccessFor(
NodePrincipal(), openerInner,
ContentBlockingNotifier::eOpenerAfterUserInteraction);
}
@ -15639,10 +15639,11 @@ already_AddRefed<mozilla::dom::Promise> Document::RequestStorageAccess(
RefPtr<Document> self(this);
auto performFinalChecks = [inner, self]()
-> RefPtr<AntiTrackingCommon::StorageAccessFinalCheckPromise> {
RefPtr<AntiTrackingCommon::StorageAccessFinalCheckPromise::Private> p =
new AntiTrackingCommon::StorageAccessFinalCheckPromise::Private(
auto performFinalChecks =
[inner,
self]() -> RefPtr<ContentBlocking::StorageAccessFinalCheckPromise> {
RefPtr<ContentBlocking::StorageAccessFinalCheckPromise::Private> p =
new ContentBlocking::StorageAccessFinalCheckPromise::Private(
__func__);
RefPtr<StorageAccessPermissionRequest> sapr =
StorageAccessPermissionRequest::Create(
@ -15651,7 +15652,7 @@ already_AddRefed<mozilla::dom::Promise> Document::RequestStorageAccess(
[p] {
Telemetry::AccumulateCategorical(
Telemetry::LABELS_STORAGE_ACCESS_API_UI::Allow);
p->Resolve(AntiTrackingCommon::eAllow, __func__);
p->Resolve(ContentBlocking::eAllow, __func__);
},
// Block
[p] {
@ -15696,10 +15697,10 @@ already_AddRefed<mozilla::dom::Promise> Document::RequestStorageAccess(
MOZ_ASSERT_IF(pr2 != PromptResult::Granted,
pr2 == PromptResult::Denied);
if (pr2 == PromptResult::Granted) {
AntiTrackingCommon::StorageAccessPromptChoices choice =
AntiTrackingCommon::eAllow;
ContentBlocking::StorageAccessPromptChoices choice =
ContentBlocking::eAllow;
if (autoGrant) {
choice = AntiTrackingCommon::eAllowAutoGrant;
choice = ContentBlocking::eAllowAutoGrant;
}
if (!autoGrant) {
p->Resolve(choice, __func__);
@ -15722,7 +15723,7 @@ already_AddRefed<mozilla::dom::Promise> Document::RequestStorageAccess(
return std::move(p);
};
AntiTrackingCommon::AddFirstPartyStorageAccessGrantedFor(
ContentBlocking::AllowAccessFor(
NodePrincipal(), inner, ContentBlockingNotifier::eStorageAccessAPI,
performFinalChecks)
->Then(
@ -16046,11 +16047,11 @@ nsIPrincipal* Document::EffectiveStoragePrincipal() const {
return mActiveStoragePrincipal;
}
// We use the lower-level AntiTrackingCommon API here to ensure this
// We use the lower-level ContentBlocking API here to ensure this
// check doesn't send notifications.
uint32_t rejectedReason = 0;
if (AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
inner, GetDocumentURI(), &rejectedReason)) {
if (ContentBlocking::ShouldAllowAccessFor(inner, GetDocumentURI(),
&rejectedReason)) {
return mActiveStoragePrincipal = NodePrincipal();
}

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

@ -11,7 +11,7 @@
#include "nsIXULAppInfo.h"
#include "nsPluginArray.h"
#include "nsMimeTypeArray.h"
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/ContentBlocking.h"
#include "mozilla/ContentBlockingNotifier.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/BodyExtractor.h"
@ -528,8 +528,8 @@ bool Navigator::CookieEnabled() {
}
uint32_t rejectedReason = 0;
bool granted = AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
mWindow, contentURI, &rejectedReason);
bool granted = ContentBlocking::ShouldAllowAccessFor(mWindow, contentURI,
&rejectedReason);
ContentBlockingNotifier::OnDecision(
mWindow,

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

@ -19,6 +19,7 @@
#include "nsReadableUtils.h"
#include "nsThreadUtils.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/ContentBlocking.h"
#include "mozilla/ContentBlockingAllowList.h"
#include "mozilla/dom/Document.h"
#include "mozilla/Logging.h"
@ -493,8 +494,8 @@ ThirdPartyUtil::AnalyzeChannel(nsIChannel* aChannel, bool aNotify, nsIURI* aURI,
aRequireThirdPartyCheck ? result.contains(ThirdPartyAnalysis::IsForeign)
: true;
if (performStorageChecks &&
AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
aChannel, aURI ? aURI : uri.get(), aRejectedReason)) {
ContentBlocking::ShouldAllowAccessFor(aChannel, aURI ? aURI : uri.get(),
aRejectedReason)) {
result += ThirdPartyAnalysis::IsFirstPartyStorageAccessGranted;
}

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

@ -33,7 +33,6 @@
#include "gfxDrawable.h"
#include "ImageOps.h"
#include "mozAutoDocUpdate.h"
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/net/UrlClassifierCommon.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/Attributes.h"

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

@ -4400,8 +4400,8 @@ Storage* nsGlobalWindowInner::GetSessionStorage(ErrorResult& aError) {
// it may be okay to provide SessionStorage even when we receive a value of
// eDeny.
//
// AntiTrackingCommon::IsFirstPartyStorageAccessGranted will return false
// for 3 main reasons.
// ContentBlocking::ShouldAllowAccessFor will return false for 3 main
// reasons.
//
// 1. Cookies are entirely blocked due to a per-origin permission
// (nsICookiePermission::ACCESS_DENY for the top-level principal or this

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

@ -21,8 +21,8 @@
#include "nsIPermissionManager.h"
#include "nsISecureBrowserUI.h"
#include "nsIWebProgressListener.h"
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/AntiTrackingUtils.h"
#include "mozilla/ContentBlocking.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/BrowserChild.h"
#include "mozilla/dom/BrowsingContextBinding.h"
@ -2482,8 +2482,8 @@ nsresult nsGlobalWindowOuter::SetNewDocument(Document* aDocument,
// permission has been granted already.
// Don't notify in this case, since we would be notifying the user
// needlessly.
mHasStorageAccess = AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
newInnerWindow, uri, nullptr);
mHasStorageAccess =
ContentBlocking::ShouldAllowAccessFor(newInnerWindow, uri, nullptr);
}
return NS_OK;
@ -7184,8 +7184,8 @@ void nsGlobalWindowOuter::MaybeAllowStorageForOpenedWindow(nsIURI* aURI) {
aURI, doc->NodePrincipal()->OriginAttributesRef());
// We don't care when the asynchronous work finishes here.
Unused << AntiTrackingCommon::AddFirstPartyStorageAccessGrantedFor(
principal, inner, ContentBlockingNotifier::eOpener);
Unused << ContentBlocking::AllowAccessFor(principal, inner,
ContentBlockingNotifier::eOpener);
}
//*****************************************************************************

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

@ -13,7 +13,6 @@
#include "nsCOMPtr.h"
#include "nsTArray.h"
#include "mozilla/dom/EventTarget.h"
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/Maybe.h"
#include "mozilla/TaskCategory.h"
#include "js/TypeDecls.h"

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

@ -40,7 +40,7 @@
#include "URIUtils.h"
#include "gfxPlatform.h"
#include "gfxPlatformFontList.h"
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/ContentBlocking.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/BenchmarkStorageParent.h"
#include "mozilla/ContentBlockingUserInteraction.h"
@ -5822,15 +5822,15 @@ ContentParent::RecvFirstPartyStorageAccessGrantedForOrigin(
const Principal& aParentPrincipal, const Principal& aTrackingPrincipal,
const nsCString& aTrackingOrigin, const int& aAllowMode,
FirstPartyStorageAccessGrantedForOriginResolver&& aResolver) {
AntiTrackingCommon::
SaveFirstPartyStorageAccessGrantedForOriginOnParentProcess(
ContentBlocking::SaveAccessForOriginOnParentProcess(
aParentPrincipal, aTrackingPrincipal, aTrackingOrigin, aAllowMode)
->Then(GetCurrentThreadSerialEventTarget(), __func__,
->Then(
GetCurrentThreadSerialEventTarget(), __func__,
[aResolver = std::move(aResolver)](
AntiTrackingCommon::FirstPartyStorageAccessGrantPromise::
ResolveOrRejectValue&& aValue) {
bool success = aValue.IsResolve() &&
NS_SUCCEEDED(aValue.ResolveValue());
ContentBlocking::ParentAccessGrantPromise::ResolveOrRejectValue&&
aValue) {
bool success =
aValue.IsResolve() && NS_SUCCEEDED(aValue.ResolveValue());
aResolver(success);
});
return IPC_OK();

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

@ -18,8 +18,8 @@
#include "nsCharSeparatedTokenizer.h"
#include "ReferrerInfo.h"
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/ContentBlocking.h"
#include "mozilla/net/CookieJarSettings.h"
#include "mozilla/net/HttpBaseChannel.h"
#include "mozilla/dom/Element.h"
@ -205,8 +205,7 @@ ReferrerPolicy ReferrerInfo::GetDefaultReferrerPolicy(nsIHttpChannel* aChannel,
if (aChannel && aURI && cjs->GetRejectThirdPartyTrackers()) {
uint32_t rejectedReason = 0;
thirdPartyTrackerIsolated =
!AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
aChannel, aURI, &rejectedReason);
!ContentBlocking::ShouldAllowAccessFor(aChannel, aURI, &rejectedReason);
// Here we intentionally do not notify about the rejection reason, if any
// in order to avoid this check to have any visible side-effects (e.g. a
// web console report.)

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

@ -25,7 +25,6 @@
#include "js/ContextOptions.h"
#include "js/LocaleSensitive.h"
#include "mozilla/AbstractThread.h"
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/Atomics.h"
#include "mozilla/Attributes.h"

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

@ -7,7 +7,7 @@
#include <utility>
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/ContentBlocking.h"
#include "mozilla/HashFunctions.h"
#include "mozilla/StorageAccess.h"
#include "mozilla/Unused.h"
@ -185,7 +185,7 @@ nsCString ImageCacheKey::GetTopLevelBaseDomain(Document* aDocument,
// this point. The best approach here is to be conservative: if we are sure
// that the permission is granted, let's return 0. Otherwise, let's make a
// unique image cache per the top-level document eTLD+1.
if (!AntiTrackingCommon::MaybeIsFirstPartyStorageAccessGrantedFor(
if (!ContentBlocking::ApproximateAllowAccessForWithoutChannel(
aDocument->GetInnerWindow(), aURI)) {
nsPIDOMWindowOuter* top =
aDocument->GetInnerWindow()->GetInProcessScriptableTop();

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

@ -18,6 +18,7 @@
#include "mozilla/ErrorResult.h"
#include "mozilla/UniquePtr.h"
#include "prtime.h" // PR_Now
#include "mozilla/MozPromise.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/dom/RTCStatsReportBinding.h" // RTCStatsCollection

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

@ -9,7 +9,6 @@
#include "nsNetUtil.h"
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/Atomics.h"
#include "mozilla/Encoding.h"
#include "mozilla/LoadContext.h"

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

@ -5,7 +5,6 @@
#include "mozilla/net/CookieServiceChild.h"
#include "mozilla/net/NeckoChannelParams.h"
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/LoadInfo.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/ClearOnShutdown.h"

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

@ -7,7 +7,7 @@
#include "ClassifierDummyChannel.h"
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/ContentBlocking.h"
#include "mozilla/net/ClassifierDummyChannelChild.h"
#include "mozilla/net/UrlClassifierCommon.h"
#include "mozilla/dom/ContentChild.h"
@ -60,8 +60,7 @@ ClassifierDummyChannel::StorageAllowed(
return eAsyncNeeded;
}
if (AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(httpChannel, uri,
nullptr)) {
if (ContentBlocking::ShouldAllowAccessFor(httpChannel, uri, nullptr)) {
return eStorageGranted;
}

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

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ClassifierDummyChannelChild.h"
#include "mozilla/ContentBlocking.h"
#include "mozilla/ipc/BackgroundUtils.h"
#include "mozilla/ipc/URIUtils.h"
#include "nsIURI.h"
@ -85,8 +86,8 @@ mozilla::ipc::IPCResult ClassifierDummyChannelChild::Recv__delete__(
RefPtr<HttpBaseChannel> httpChannel = do_QueryObject(channel);
httpChannel->AddClassificationFlags(aClassificationFlags, mIsThirdParty);
bool storageGranted = AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
httpChannel, mURI, nullptr);
bool storageGranted =
ContentBlocking::ShouldAllowAccessFor(httpChannel, mURI, nullptr);
mCallback(storageGranted);
return IPC_OK();
}

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

@ -10,7 +10,6 @@
#include "nsHttp.h"
#include "nsICacheEntry.h"
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/ContentChild.h"

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

@ -55,9 +55,9 @@
#include "nsThreadUtils.h"
#include "GeckoProfiler.h"
#include "nsIConsoleService.h"
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/Attributes.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/ContentBlocking.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
@ -4025,8 +4025,7 @@ bool nsHttpChannel::IsIsolated() {
}
mIsIsolated = StaticPrefs::browser_cache_cache_isolation() ||
(IsThirdPartyTrackingResource() &&
!AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
this, mURI, nullptr));
!ContentBlocking::ShouldAllowAccessFor(this, mURI, nullptr));
mHasBeenIsolatedChecked = true;
return mIsIsolated;
}

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

@ -7,8 +7,8 @@
#ifndef mozilla_net_UrlClassifierCommon_h
#define mozilla_net_UrlClassifierCommon_h
#include "mozilla/Logging.h"
#include "nsString.h"
#include "mozilla/AntiTrackingCommon.h"
#include <vector>

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

@ -11,7 +11,6 @@
#include "nsIUrlClassifierSkipListService.h"
#include "nsTArray.h"
#include "nsString.h"
#include "mozilla/AntiTrackingCommon.h"
namespace mozilla {
namespace net {

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

@ -6,7 +6,6 @@
#include "UrlClassifierFeatureCryptominingAnnotation.h"
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/net/UrlClassifierCommon.h"
#include "nsIClassifiedChannel.h"
#include "nsContentUtils.h"

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

@ -6,7 +6,6 @@
#include "UrlClassifierFeatureCryptominingProtection.h"
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/net/UrlClassifierCommon.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "nsContentUtils.h"

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

@ -6,7 +6,6 @@
#include "UrlClassifierFeatureFingerprintingAnnotation.h"
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/net/UrlClassifierCommon.h"
#include "nsIClassifiedChannel.h"
#include "nsContentUtils.h"

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

@ -6,7 +6,6 @@
#include "UrlClassifierFeatureFingerprintingProtection.h"
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/net/UrlClassifierCommon.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "nsContentUtils.h"

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

@ -6,7 +6,6 @@
#include "UrlClassifierFeatureSocialTrackingAnnotation.h"
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/net/UrlClassifierCommon.h"
#include "nsIClassifiedChannel.h"
#include "nsContentUtils.h"

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

@ -6,7 +6,6 @@
#include "UrlClassifierFeatureSocialTrackingProtection.h"
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/net/UrlClassifierCommon.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "nsContentUtils.h"

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

@ -7,7 +7,6 @@
#include "UrlClassifierFeatureTrackingAnnotation.h"
#include "Classifier.h"
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/Logging.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "mozilla/StaticPtr.h"

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

@ -6,7 +6,6 @@
#include "UrlClassifierFeatureTrackingProtection.h"
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/net/UrlClassifierCommon.h"
#include "nsContentUtils.h"
#include "nsIHttpChannelInternal.h"

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

@ -6,7 +6,7 @@
#include "AntiTrackingLog.h"
#include "AntiTrackingRedirectHeuristic.h"
#include "AntiTrackingCommon.h"
#include "ContentBlocking.h"
#include "ContentBlockingAllowList.h"
#include "ContentBlockingUserInteraction.h"
@ -16,6 +16,7 @@
#include "nsContentUtils.h"
#include "nsIChannel.h"
#include "nsIClassifiedChannel.h"
#include "nsICookieService.h"
#include "nsIRedirectHistoryEntry.h"
#include "nsIScriptError.h"
#include "nsIURI.h"
@ -210,13 +211,11 @@ void AntiTrackingRedirectHeuristic(nsIChannel* aOldChannel, nsIURI* aOldURI,
}
// We don't care about this promise because the operation is actually sync.
RefPtr<AntiTrackingCommon::FirstPartyStorageAccessGrantPromise> promise =
AntiTrackingCommon::
SaveFirstPartyStorageAccessGrantedForOriginOnParentProcess(
RefPtr<ContentBlocking::ParentAccessGrantPromise> promise =
ContentBlocking::SaveAccessForOriginOnParentProcess(
redirectedPrincipal, trackingPrincipal, trackingOrigin,
AntiTrackingCommon::StorageAccessPromptChoices::eAllow,
StaticPrefs::
privacy_restrict3rdpartystorage_expiration_redirect());
ContentBlocking::StorageAccessPromptChoices::eAllow,
StaticPrefs::privacy_restrict3rdpartystorage_expiration_redirect());
Unused << promise;
}

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

@ -5,26 +5,14 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "AntiTrackingLog.h"
#include "AntiTrackingCommon.h"
#include "ContentBlocking.h"
#include "AntiTrackingUtils.h"
#include "TemporaryAccessGrantObserver.h"
#include "mozilla/ContentBlockingAllowList.h"
#include "mozilla/ContentBlockingUserInteraction.h"
#include "mozilla/dom/BrowsingContext.h"
#include "mozilla/dom/CanonicalBrowsingContext.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/WindowGlobalParent.h"
#include "mozilla/net/UrlClassifierCommon.h"
#include "mozilla/ipc/MessageChannel.h"
#include "mozilla/AbstractThread.h"
#include "mozilla/HashFunctions.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/Logging.h"
#include "mozilla/MruCache.h"
#include "mozilla/Pair.h"
#include "mozilla/ScopeExit.h"
#include "mozilla/StaticPrefs_extensions.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "mozIThirdPartyUtil.h"
#include "nsContentUtils.h"
@ -32,20 +20,11 @@
#include "nsIClassifiedChannel.h"
#include "nsICookiePermission.h"
#include "nsICookieService.h"
#include "nsIDocShell.h"
#include "nsIHttpChannelInternal.h"
#include "nsIParentChannel.h"
#include "nsIPermission.h"
#include "nsPermissionManager.h"
#include "nsIPrincipal.h"
#include "nsIRedirectHistoryEntry.h"
#include "nsIScriptError.h"
#include "nsIURI.h"
#include "nsIURIFixup.h"
#include "nsIWebProgressListener.h"
#include "nsNetUtil.h"
#include "nsPIDOMWindow.h"
#include "nsPrintfCString.h"
#include "nsPermissionManager.h"
#include "nsScriptSecurityManager.h"
namespace mozilla {
@ -268,11 +247,11 @@ bool CheckAntiTrackingPermission(nsIPrincipal* aPrincipal,
} // namespace
/* static */ RefPtr<AntiTrackingCommon::StorageAccessGrantPromise>
AntiTrackingCommon::AddFirstPartyStorageAccessGrantedFor(
/* static */ RefPtr<ContentBlocking::StorageAccessGrantPromise>
ContentBlocking::AllowAccessFor(
nsIPrincipal* aPrincipal, nsPIDOMWindowInner* aParentWindow,
ContentBlockingNotifier::StorageAccessGrantedReason aReason,
const AntiTrackingCommon::PerformFinalChecks& aPerformFinalChecks) {
const ContentBlocking::PerformFinalChecks& aPerformFinalChecks) {
MOZ_ASSERT(aParentWindow);
switch (aReason) {
@ -488,12 +467,11 @@ AntiTrackingCommon::AddFirstPartyStorageAccessGrantedFor(
if (XRE_IsParentProcess()) {
LOG(("Saving the permission: trackingOrigin=%s", trackingOrigin.get()));
return SaveFirstPartyStorageAccessGrantedForOriginOnParentProcess(
topLevelStoragePrincipal, trackingPrincipal, trackingOrigin,
aAllowMode)
return SaveAccessForOriginOnParentProcess(topLevelStoragePrincipal,
trackingPrincipal,
trackingOrigin, aAllowMode)
->Then(GetCurrentThreadSerialEventTarget(), __func__,
[](FirstPartyStorageAccessGrantPromise::ResolveOrRejectValue&&
aValue) {
[](ParentAccessGrantPromise::ResolveOrRejectValue&& aValue) {
if (aValue.IsResolve()) {
return StorageAccessGrantPromise::CreateAndResolve(
eAllow, __func__);
@ -545,8 +523,8 @@ AntiTrackingCommon::AddFirstPartyStorageAccessGrantedFor(
}
/* static */
RefPtr<mozilla::AntiTrackingCommon::FirstPartyStorageAccessGrantPromise>
AntiTrackingCommon::SaveFirstPartyStorageAccessGrantedForOriginOnParentProcess(
RefPtr<mozilla::ContentBlocking::ParentAccessGrantPromise>
ContentBlocking::SaveAccessForOriginOnParentProcess(
nsIPrincipal* aParentPrincipal, nsIPrincipal* aTrackingPrincipal,
const nsCString& aTrackingOrigin, int aAllowMode,
uint64_t aExpirationTime) {
@ -555,8 +533,7 @@ AntiTrackingCommon::SaveFirstPartyStorageAccessGrantedForOriginOnParentProcess(
if (!aParentPrincipal || !aTrackingPrincipal) {
LOG(("Invalid input arguments passed"));
return FirstPartyStorageAccessGrantPromise::CreateAndReject(false,
__func__);
return ParentAccessGrantPromise::CreateAndReject(false, __func__);
};
LOG_PRIN(("Saving a first-party storage permission on %s for "
@ -567,15 +544,13 @@ AntiTrackingCommon::SaveFirstPartyStorageAccessGrantedForOriginOnParentProcess(
if (NS_WARN_IF(!aParentPrincipal)) {
// The child process is sending something wrong. Let's ignore it.
LOG(("aParentPrincipal is null, bailing out early"));
return FirstPartyStorageAccessGrantPromise::CreateAndReject(false,
__func__);
return ParentAccessGrantPromise::CreateAndReject(false, __func__);
}
nsPermissionManager* permManager = nsPermissionManager::GetInstance();
if (NS_WARN_IF(!permManager)) {
LOG(("Permission manager is null, bailing out early"));
return FirstPartyStorageAccessGrantPromise::CreateAndReject(false,
__func__);
return ParentAccessGrantPromise::CreateAndReject(false, __func__);
}
// Remember that this pref is stored in seconds!
@ -613,11 +588,12 @@ AntiTrackingCommon::SaveFirstPartyStorageAccessGrantedForOriginOnParentProcess(
}
LOG(("Result: %s", NS_SUCCEEDED(rv) ? "success" : "failure"));
return FirstPartyStorageAccessGrantPromise::CreateAndResolve(rv, __func__);
return ParentAccessGrantPromise::CreateAndResolve(rv, __func__);
}
bool AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
nsPIDOMWindowInner* aWindow, nsIURI* aURI, uint32_t* aRejectedReason) {
bool ContentBlocking::ShouldAllowAccessFor(nsPIDOMWindowInner* aWindow,
nsIURI* aURI,
uint32_t* aRejectedReason) {
MOZ_ASSERT(aWindow);
MOZ_ASSERT(aURI);
@ -819,8 +795,8 @@ bool AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
aRejectedReason, blockedReason);
}
bool AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
nsIChannel* aChannel, nsIURI* aURI, uint32_t* aRejectedReason) {
bool ContentBlocking::ShouldAllowAccessFor(nsIChannel* aChannel, nsIURI* aURI,
uint32_t* aRejectedReason) {
MOZ_ASSERT(aURI);
MOZ_ASSERT(aChannel);
@ -1083,7 +1059,7 @@ bool AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
aRejectedReason, blockedReason);
}
bool AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
bool ContentBlocking::ShouldAllowAccessFor(
nsIPrincipal* aPrincipal, nsICookieJarSettings* aCookieJarSettings) {
MOZ_ASSERT(aPrincipal);
MOZ_ASSERT(aCookieJarSettings);
@ -1106,7 +1082,7 @@ bool AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
}
/* static */
bool AntiTrackingCommon::MaybeIsFirstPartyStorageAccessGrantedFor(
bool ContentBlocking::ApproximateAllowAccessForWithoutChannel(
nsPIDOMWindowInner* aFirstPartyWindow, nsIURI* aURI) {
MOZ_ASSERT(aFirstPartyWindow);
MOZ_ASSERT(aURI);

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

@ -25,19 +25,12 @@ namespace mozilla {
class OriginAttributes;
class AntiTrackingCommon final {
class ContentBlocking final {
public:
// Normally we would include PContentParent.h here and use the
// ipc::FirstPartyStorageAccessGrantedForOriginResolver type which maps to
// the same underlying type, but that results in Windows compilation errors,
// so we use the underlying type to avoid the #include here.
typedef std::function<void(const bool&)>
FirstPartyStorageAccessGrantedForOriginResolver;
// This method returns true if the URI has first party storage access when
// loaded inside the passed 3rd party context tracking resource window.
// If the window is first party context, please use
// MaybeIsFirstPartyStorageAccessGrantedFor();
// ApproximateAllowAccessForWithoutChannel();
//
// aRejectedReason could be set to one of these values if passed and if the
// storage permission is not granted:
@ -46,31 +39,29 @@ class AntiTrackingCommon final {
// * nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER
// * nsIWebProgressListener::STATE_COOKIES_BLOCKED_ALL
// * nsIWebProgressListener::STATE_COOKIES_BLOCKED_FOREIGN
static bool IsFirstPartyStorageAccessGrantedFor(
nsPIDOMWindowInner* a3rdPartyTrackingWindow, nsIURI* aURI,
uint32_t* aRejectedReason);
static bool ShouldAllowAccessFor(nsPIDOMWindowInner* a3rdPartyTrackingWindow,
nsIURI* aURI, uint32_t* aRejectedReason);
// Note: you should use IsFirstPartyStorageAccessGrantedFor() passing the
// nsIChannel! Use this method _only_ if the channel is not available.
// For first party window, it's impossible to know if the aURI is a tracking
// resource synchronously, so here we return the best guest: if we are sure
// that the permission is granted for the origin of aURI, this method returns
// true, otherwise false.
static bool MaybeIsFirstPartyStorageAccessGrantedFor(
// Note: you should use ShouldAllowAccessFor() passing the nsIChannel! Use
// this method _only_ if the channel is not available. For first party
// window, it's impossible to know if the aURI is a tracking resource
// synchronously, so here we return the best guest: if we are sure that the
// permission is granted for the origin of aURI, this method returns true,
// otherwise false.
static bool ApproximateAllowAccessForWithoutChannel(
nsPIDOMWindowInner* aFirstPartyWindow, nsIURI* aURI);
// It returns true if the URI has access to the first party storage.
// aChannel can be a 3rd party channel, or not.
// See IsFirstPartyStorageAccessGrantedFor(window) to see the possible values
// of aRejectedReason.
static bool IsFirstPartyStorageAccessGrantedFor(nsIChannel* aChannel,
nsIURI* aURI,
// See ShouldAllowAccessFor(window) to see the possible values of
// aRejectedReason.
static bool ShouldAllowAccessFor(nsIChannel* aChannel, nsIURI* aURI,
uint32_t* aRejectedReason);
// This method checks if the principal has the permission to access to the
// first party storage.
static bool IsFirstPartyStorageAccessGrantedFor(
nsIPrincipal* aPrincipal, nsICookieJarSettings* aCookieJarSettings);
static bool ShouldAllowAccessFor(nsIPrincipal* aPrincipal,
nsICookieJarSettings* aCookieJarSettings);
enum StorageAccessPromptChoices { eAllow, eAllowAutoGrant };
@ -93,16 +84,14 @@ class AntiTrackingCommon final {
typedef std::function<RefPtr<StorageAccessFinalCheckPromise>()>
PerformFinalChecks;
typedef MozPromise<int, bool, true> StorageAccessGrantPromise;
static MOZ_MUST_USE RefPtr<StorageAccessGrantPromise>
AddFirstPartyStorageAccessGrantedFor(
static MOZ_MUST_USE RefPtr<StorageAccessGrantPromise> AllowAccessFor(
nsIPrincipal* aPrincipal, nsPIDOMWindowInner* aParentWindow,
ContentBlockingNotifier::StorageAccessGrantedReason aReason,
const PerformFinalChecks& aPerformFinalChecks = nullptr);
// For IPC only.
typedef MozPromise<nsresult, bool, true> FirstPartyStorageAccessGrantPromise;
static RefPtr<FirstPartyStorageAccessGrantPromise>
SaveFirstPartyStorageAccessGrantedForOriginOnParentProcess(
typedef MozPromise<nsresult, bool, true> ParentAccessGrantPromise;
static RefPtr<ParentAccessGrantPromise> SaveAccessForOriginOnParentProcess(
nsIPrincipal* aPrincipal, nsIPrincipal* aTrackingPrinciapl,
const nsCString& aTrackingOrigin, int aAllowMode,
uint64_t aExpirationTime =

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

@ -43,11 +43,11 @@ class ContentBlockingAllowList final {
// Check().
static ContentBlockingAllowListCache& Cache();
// Utility APIs for AntiTrackingCommon.
// Utility APIs for ContentBlocking.
static bool Check(nsIPrincipal* aTopWinPrincipal, bool aIsPrivateBrowsing);
static bool Check(nsPIDOMWindowInner* aWindow);
friend class AntiTrackingCommon;
friend class ContentBlocking;
};
} // namespace mozilla

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

@ -6,7 +6,6 @@
#include "AntiTrackingLog.h"
#include "ContentBlockingNotifier.h"
#include "AntiTrackingCommon.h"
#include "AntiTrackingUtils.h"
#include "mozilla/AbstractEventQueue.h"

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

@ -6,7 +6,6 @@
#include "AntiTrackingLog.h"
#include "ContentBlockingUserInteraction.h"
#include "AntiTrackingCommon.h"
#include "AntiTrackingUtils.h"
#include "mozilla/dom/ContentChild.h"

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

@ -6,7 +6,7 @@
#include "mozilla/dom/Document.h"
#include "mozilla/net/CookieJarSettings.h"
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/ContentBlocking.h"
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/StaticPrefs_network.h"
#include "mozilla/StaticPrefs_privacy.h"
@ -175,8 +175,7 @@ static bool StorageDisabledByAntiTrackingInternal(
if (aWindow) {
nsIURI* documentURI = aURI ? aURI : aWindow->GetDocumentURI();
return !documentURI ||
!AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
return !documentURI || !ContentBlocking::ShouldAllowAccessFor(
aWindow, documentURI, &aRejectedReason);
}
@ -187,13 +186,12 @@ static bool StorageDisabledByAntiTrackingInternal(
return false;
}
return !AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
aChannel, uri, &aRejectedReason);
return !ContentBlocking::ShouldAllowAccessFor(aChannel, uri,
&aRejectedReason);
}
MOZ_ASSERT(aPrincipal);
return !AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
aPrincipal, aCookieJarSettings);
return !ContentBlocking::ShouldAllowAccessFor(aPrincipal, aCookieJarSettings);
}
namespace mozilla {

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

@ -7,7 +7,7 @@
#include "StoragePrincipalHelper.h"
#include "mozilla/ipc/PBackgroundSharedTypes.h"
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/ContentBlocking.h"
#include "mozilla/ScopeExit.h"
#include "mozilla/StorageAccess.h"
#include "nsContentUtils.h"
@ -32,13 +32,12 @@ bool ChooseOriginAttributes(nsIChannel* aChannel, OriginAttributes& aAttrs) {
}
uint32_t rejectedReason = 0;
if (AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
aChannel, uri, &rejectedReason)) {
if (ContentBlocking::ShouldAllowAccessFor(aChannel, uri, &rejectedReason)) {
return false;
}
// Let's use the storage principal only if we need to partition the cookie
// jar. We use the lower-level AntiTrackingCommon API here to ensure this
// jar. We use the lower-level ContentBlocking API here to ensure this
// check doesn't send notifications.
if (!ShouldPartitionStorage(rejectedReason) ||
!StoragePartitioningEnabled(rejectedReason, cjs)) {

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

@ -5,11 +5,11 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "TemporaryAccessGrantObserver.h"
#include "AntiTrackingCommon.h"
#include "nsIObserverService.h"
#include "nsPermissionManager.h"
#include "nsTHashtable.h"
#include "nsXULAppAPI.h"
using namespace mozilla;

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

@ -31,10 +31,10 @@ XPCOM_MANIFESTS += [
]
EXPORTS.mozilla = [
'AntiTrackingCommon.h',
'AntiTrackingIPCUtils.h',
'AntiTrackingRedirectHeuristic.h',
'AntiTrackingUtils.h',
'ContentBlocking.h',
'ContentBlockingAllowList.h',
'ContentBlockingNotifier.h',
'ContentBlockingUserInteraction.h',
@ -44,9 +44,9 @@ EXPORTS.mozilla = [
]
UNIFIED_SOURCES += [
'AntiTrackingCommon.cpp',
'AntiTrackingRedirectHeuristic.cpp',
'AntiTrackingUtils.cpp',
'ContentBlocking.cpp',
'ContentBlockingAllowList.cpp',
'ContentBlockingNotifier.cpp',
'ContentBlockingUserInteraction.cpp',