forked from mirrors/gecko-dev
Bug 1823341 - Make toolkit/components/antitracking buildable outside of a unified build environment r=andi
Depends on D172968 Differential Revision: https://phabricator.services.mozilla.com/D172969
This commit is contained in:
parent
eb997b688d
commit
ca06ea9162
20 changed files with 70 additions and 15 deletions
|
|
@ -12,6 +12,7 @@
|
|||
#include "nsIObserver.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsString.h"
|
||||
|
|
@ -20,6 +21,7 @@
|
|||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "mozilla/MozPromise.h"
|
||||
#include "mozilla/OriginAttributes.h"
|
||||
#include "mozilla/StaticMutex.h"
|
||||
#include "mozilla/ThreadBound.h"
|
||||
#include "mozilla/Variant.h"
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include "nsEffectiveTLDService.h"
|
||||
#include "nsGlobalWindowInner.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsICookieService.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIPermission.h"
|
||||
#include "nsIURI.h"
|
||||
|
|
|
|||
|
|
@ -9,11 +9,15 @@
|
|||
|
||||
#include "mozilla/dom/BrowsingContext.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "mozilla/PermissionManager.h"
|
||||
#include "mozilla/ScopeExit.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsGlobalWindowInner.h"
|
||||
#include "nsICookieJarSettings.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIHttpChannelInternal.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include "nsIEffectiveTLDService.h"
|
||||
#include "nsITrackingDBService.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsTArray.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include "mozilla/StaticPrefs_privacy.h"
|
||||
#include "mozilla/dom/BrowserChild.h"
|
||||
#include "mozilla/dom/BrowsingContext.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/WindowGlobalParent.h"
|
||||
#include "nsIClassifiedChannel.h"
|
||||
|
|
@ -24,6 +25,7 @@
|
|||
#include "mozIThirdPartyUtil.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using mozilla::dom::BrowsingContext;
|
||||
using mozilla::dom::ContentChild;
|
||||
using mozilla::dom::Document;
|
||||
|
|
|
|||
|
|
@ -13,8 +13,10 @@
|
|||
#include "mozilla/Telemetry.h"
|
||||
|
||||
#include "AntiTrackingLog.h"
|
||||
#include "prtime.h"
|
||||
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIPermission.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
|
|
|||
|
|
@ -11,9 +11,11 @@
|
|||
#include "StorageAccessAPIHelper.h"
|
||||
|
||||
#include "mozilla/net/HttpBaseChannel.h"
|
||||
#include "mozilla/net/UrlClassifierCommon.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsICookieJarSettings.h"
|
||||
#include "nsICookieService.h"
|
||||
#include "nsIEffectiveTLDService.h"
|
||||
#include "nsINavHistoryService.h"
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "AntiTrackingLog.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
|
|
|
|||
|
|
@ -7,8 +7,10 @@
|
|||
#ifndef mozilla_PartitioningExceptionList_h
|
||||
#define mozilla_PartitioningExceptionList_h
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIPartitioningExceptionListService.h"
|
||||
#include "nsTArrayForwardDeclare.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsIChannel;
|
||||
class nsIPrincipal;
|
||||
|
|
|
|||
|
|
@ -6,9 +6,13 @@
|
|||
|
||||
#include "RejectForeignAllowList.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsScriptSecurityManager.h"
|
||||
|
||||
#define REJECTFOREIGNALLOWLIST_PREF "privacy.rejectForeign.allowList"_ns
|
||||
#define REJECTFOREIGNALLOWLIST_NAME "RejectForeignAllowList"_ns
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#define mozilla_RejectForeignAllowList_h
|
||||
|
||||
#include "nsIUrlClassifierExceptionListService.h"
|
||||
#include "nsIPrincipal.h"
|
||||
|
||||
class nsIHttpChannel;
|
||||
class nsIURI;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include "nsIObserver.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class SettingsChangeObserver final : public nsIObserver {
|
||||
|
|
|
|||
|
|
@ -6,19 +6,32 @@
|
|||
|
||||
#include "StorageAccess.h"
|
||||
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "mozilla/Components.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
#include "mozilla/net/CookieJarSettings.h"
|
||||
#include "mozilla/PermissionManager.h"
|
||||
#include "mozilla/StaticPrefs_browser.h"
|
||||
#include "mozilla/StaticPrefs_network.h"
|
||||
#include "mozilla/StaticPrefs_privacy.h"
|
||||
#include "mozilla/StorageAccess.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsGlobalWindowInner.h"
|
||||
#include "nsICookiePermission.h"
|
||||
#include "nsICookieService.h"
|
||||
#include "nsICookieJarSettings.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIPermission.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsIClassifiedChannel.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsScriptSecurityManager.h"
|
||||
#include "nsSandboxFlags.h"
|
||||
#include "AntiTrackingUtils.h"
|
||||
#include "AntiTrackingLog.h"
|
||||
#include "ContentBlockingAllowList.h"
|
||||
#include "mozIThirdPartyUtil.h"
|
||||
#include "RejectForeignAllowList.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
|
@ -26,7 +39,7 @@ using mozilla::net::CookieJarSettings;
|
|||
|
||||
// This internal method returns ACCESS_DENY if the access is denied,
|
||||
// ACCESS_DEFAULT if unknown, some other access code if granted.
|
||||
uint32_t CheckCookiePermissionForPrincipal(
|
||||
uint32_t mozilla::detail::CheckCookiePermissionForPrincipal(
|
||||
nsICookieJarSettings* aCookieJarSettings, nsIPrincipal* aPrincipal) {
|
||||
MOZ_ASSERT(aCookieJarSettings);
|
||||
MOZ_ASSERT(aPrincipal);
|
||||
|
|
@ -46,6 +59,7 @@ uint32_t CheckCookiePermissionForPrincipal(
|
|||
return cookiePermission;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Checks if storage for a given principal is permitted by the user's
|
||||
* preferences. If aWindow is non-null, its principal must be passed as
|
||||
|
|
@ -470,7 +484,7 @@ bool ShouldAllowAccessFor(nsPIDOMWindowInner* aWindow, nsIURI* aURI,
|
|||
return false;
|
||||
}
|
||||
|
||||
uint32_t cookiePermission = CheckCookiePermissionForPrincipal(
|
||||
uint32_t cookiePermission = detail::CheckCookiePermissionForPrincipal(
|
||||
document->CookieJarSettings(), document->NodePrincipal());
|
||||
if (cookiePermission != nsICookiePermission::ACCESS_DEFAULT) {
|
||||
LOG(
|
||||
|
|
@ -651,7 +665,7 @@ bool ShouldAllowAccessFor(nsIChannel* aChannel, nsIURI* aURI,
|
|||
}
|
||||
|
||||
uint32_t cookiePermission =
|
||||
CheckCookiePermissionForPrincipal(cookieJarSettings, channelPrincipal);
|
||||
detail::CheckCookiePermissionForPrincipal(cookieJarSettings, channelPrincipal);
|
||||
if (cookiePermission != nsICookiePermission::ACCESS_DEFAULT) {
|
||||
LOG(
|
||||
("CheckCookiePermissionForPrincipal() returned a non-default access "
|
||||
|
|
@ -869,7 +883,7 @@ bool ApproximateAllowAccessForWithoutChannel(
|
|||
return true;
|
||||
}
|
||||
|
||||
uint32_t cookiePermission = CheckCookiePermissionForPrincipal(
|
||||
uint32_t cookiePermission = detail::CheckCookiePermissionForPrincipal(
|
||||
parentDocument->CookieJarSettings(), parentDocument->NodePrincipal());
|
||||
if (cookiePermission != nsICookiePermission::ACCESS_DEFAULT) {
|
||||
LOG(
|
||||
|
|
|
|||
|
|
@ -158,6 +158,11 @@ bool ShouldAllowAccessFor(nsIChannel* aChannel, nsIURI* aURI,
|
|||
bool ShouldAllowAccessFor(nsIPrincipal* aPrincipal,
|
||||
nsICookieJarSettings* aCookieJarSettings);
|
||||
|
||||
namespace detail {
|
||||
uint32_t CheckCookiePermissionForPrincipal(
|
||||
nsICookieJarSettings* aCookieJarSettings, nsIPrincipal* aPrincipal);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_StorageAccess_h
|
||||
|
|
|
|||
|
|
@ -16,10 +16,12 @@
|
|||
#include "mozilla/dom/BrowsingContextGroup.h"
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
#include "mozilla/dom/WindowContext.h"
|
||||
#include "mozilla/dom/WindowGlobalParent.h"
|
||||
#include "mozilla/net/CookieJarSettings.h"
|
||||
#include "mozilla/PermissionManager.h"
|
||||
#include "mozilla/StaticPrefs_network.h"
|
||||
#include "mozilla/StaticPrefs_privacy.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozIThirdPartyUtil.h"
|
||||
|
|
@ -37,6 +39,7 @@
|
|||
#include "nsIWebProgressListener.h"
|
||||
#include "nsScriptSecurityManager.h"
|
||||
#include "RejectForeignAllowList.h"
|
||||
#include "StorageAccess.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
|
@ -450,7 +453,7 @@ StorageAccessAPIHelper::CompleteAllowAccessFor(
|
|||
// we'll return to the content process we need to inform when this
|
||||
// function is done. So we don't need to create an extra IPC for the case.
|
||||
if (aReason != ContentBlockingNotifier::eOpener) {
|
||||
ContentParent* cp = aParentContext->Canonical()->GetContentParent();
|
||||
dom::ContentParent* cp = aParentContext->Canonical()->GetContentParent();
|
||||
Unused << cp->SendOnAllowAccessFor(aParentContext, trackingOrigin,
|
||||
aCookieBehavior, aReason);
|
||||
}
|
||||
|
|
@ -741,7 +744,7 @@ StorageAccessAPIHelper::CheckCookiesPermittedDecidesStorageAccessAPI(
|
|||
nsIPrincipal* aRequestingPrincipal) {
|
||||
MOZ_ASSERT(aCookieJarSettings);
|
||||
MOZ_ASSERT(aRequestingPrincipal);
|
||||
uint32_t cookiePermission = CheckCookiePermissionForPrincipal(
|
||||
uint32_t cookiePermission = detail::CheckCookiePermissionForPrincipal(
|
||||
aCookieJarSettings, aRequestingPrincipal);
|
||||
if (cookiePermission == nsICookiePermission::ACCESS_ALLOW ||
|
||||
cookiePermission == nsICookiePermission::ACCESS_SESSION) {
|
||||
|
|
|
|||
|
|
@ -7,13 +7,19 @@
|
|||
#include "StoragePrincipalHelper.h"
|
||||
|
||||
#include "mozilla/ipc/PBackgroundSharedTypes.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/net/CookieJarSettings.h"
|
||||
#include "mozilla/ScopeExit.h"
|
||||
#include "mozilla/StaticPrefs_privacy.h"
|
||||
#include "mozilla/StorageAccess.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsICookieJarSettings.h"
|
||||
#include "nsICookieService.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIEffectiveTLDService.h"
|
||||
#include "nsIPrivateBrowsingChannel.h"
|
||||
#include "AntiTrackingUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
|
@ -324,7 +330,7 @@ nsresult StoragePrincipalHelper::GetPrincipal(nsPIDOMWindowInner* aWindow,
|
|||
MOZ_ASSERT(aWindow);
|
||||
MOZ_ASSERT(aPrincipal);
|
||||
|
||||
nsCOMPtr<Document> doc = aWindow->GetExtantDoc();
|
||||
nsCOMPtr<dom::Document> doc = aWindow->GetExtantDoc();
|
||||
NS_ENSURE_STATE(doc);
|
||||
|
||||
nsCOMPtr<nsIPrincipal> outPrincipal;
|
||||
|
|
@ -369,7 +375,7 @@ bool StoragePrincipalHelper::ShouldUsePartitionPrincipalForServiceWorker(
|
|||
return false;
|
||||
}
|
||||
|
||||
RefPtr<Document> document = aDocShell->GetExtantDocument();
|
||||
RefPtr<dom::Document> document = aDocShell->GetExtantDocument();
|
||||
|
||||
// If we cannot get the document from the docShell, we turn to get its
|
||||
// parent's document.
|
||||
|
|
@ -390,8 +396,8 @@ bool StoragePrincipalHelper::ShouldUsePartitionPrincipalForServiceWorker(
|
|||
// If there was no document, we create one cookieJarSettings here in order
|
||||
// to get the cookieBehavior. We don't need a real value for RFP because
|
||||
// we are only using this object to check default cookie behavior.
|
||||
cookieJarSettings = CookieJarSettings::Create(
|
||||
CookieJarSettings::eRegular, /* shouldResistFingerpreinting */ false);
|
||||
cookieJarSettings = net::CookieJarSettings::Create(
|
||||
net::CookieJarSettings::eRegular, /* shouldResistFingerpreinting */ false);
|
||||
}
|
||||
|
||||
// We only support partitioned service workers when dFPI is enabled.
|
||||
|
|
@ -483,7 +489,7 @@ bool StoragePrincipalHelper::GetOriginAttributes(
|
|||
|
||||
// static
|
||||
bool StoragePrincipalHelper::GetRegularPrincipalOriginAttributes(
|
||||
Document* aDocument, OriginAttributes& aAttributes) {
|
||||
dom::Document* aDocument, OriginAttributes& aAttributes) {
|
||||
aAttributes = mozilla::OriginAttributes();
|
||||
if (!aDocument) {
|
||||
return false;
|
||||
|
|
@ -536,7 +542,7 @@ bool StoragePrincipalHelper::GetOriginAttributesForNetworkState(
|
|||
|
||||
// static
|
||||
void StoragePrincipalHelper::GetOriginAttributesForNetworkState(
|
||||
Document* aDocument, OriginAttributes& aAttributes) {
|
||||
dom::Document* aDocument, OriginAttributes& aAttributes) {
|
||||
aAttributes = aDocument->NodePrincipal()->OriginAttributesRef();
|
||||
|
||||
if (!StaticPrefs::privacy_partition_network_state()) {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <cstdint>
|
||||
#include "ErrorList.h"
|
||||
#include "nsStringFwd.h"
|
||||
|
||||
/**
|
||||
* StoragePrincipal
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include "TemporaryAccessGrantObserver.h"
|
||||
|
||||
#include "mozilla/PermissionManager.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsHashtablesFwd.h"
|
||||
#include "nsTHashMap.h"
|
||||
#include "nsINamed.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsString.h"
|
||||
#include "PLDHashTable.h"
|
||||
|
|
|
|||
|
|
@ -94,6 +94,4 @@ XPCSHELL_TESTS_MANIFESTS += ["test/xpcshell/xpcshell.ini"]
|
|||
|
||||
TEST_DIRS += ["test/gtest"]
|
||||
|
||||
REQUIRES_UNIFIED_BUILD = True
|
||||
|
||||
SPHINX_TREES["anti-tracking"] = "docs"
|
||||
|
|
|
|||
Loading…
Reference in a new issue