summaryrefslogtreecommitdiff
path: root/netwerk/base/nsChannelClassifier.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'netwerk/base/nsChannelClassifier.cpp')
-rw-r--r--netwerk/base/nsChannelClassifier.cpp81
1 files changed, 1 insertions, 80 deletions
diff --git a/netwerk/base/nsChannelClassifier.cpp b/netwerk/base/nsChannelClassifier.cpp
index 1c23271af7..5df60e9516 100644
--- a/netwerk/base/nsChannelClassifier.cpp
+++ b/netwerk/base/nsChannelClassifier.cpp
@@ -411,8 +411,7 @@ nsChannelClassifier::MarkEntryClassified(nsresult status)
// Should only be called in the parent process.
MOZ_ASSERT(XRE_IsParentProcess());
- // Don't cache tracking classifications because we support allowlisting.
- if (status == NS_ERROR_TRACKING_URI || mIsAllowListed) {
+ if (mIsAllowListed) {
return;
}
@@ -578,83 +577,12 @@ nsChannelClassifier::SetBlockedTrackingContent(nsIChannel *channel)
return NS_OK;
}
-nsresult
-nsChannelClassifier::IsTrackerWhitelisted()
-{
- nsresult rv;
- nsCOMPtr<nsIURIClassifier> uriClassifier =
- do_GetService(NS_URICLASSIFIERSERVICE_CONTRACTID, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsAutoCString tables;
- Preferences::GetCString("urlclassifier.trackingWhitelistTable", &tables);
-
- if (tables.IsEmpty()) {
- LOG(("nsChannelClassifier[%p]:IsTrackerWhitelisted whitelist disabled",
- this));
- return NS_ERROR_TRACKING_URI;
- }
-
- nsCOMPtr<nsIHttpChannelInternal> chan = do_QueryInterface(mChannel, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCOMPtr<nsIURI> topWinURI;
- rv = chan->GetTopWindowURI(getter_AddRefs(topWinURI));
- NS_ENSURE_SUCCESS(rv, rv);
- if (!topWinURI) {
- LOG(("nsChannelClassifier[%p]: No window URI", this));
- return NS_ERROR_TRACKING_URI;
- }
-
- nsCOMPtr<nsIScriptSecurityManager> securityManager =
- do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsIPrincipal> chanPrincipal;
- rv = securityManager->GetChannelURIPrincipal(mChannel,
- getter_AddRefs(chanPrincipal));
- NS_ENSURE_SUCCESS(rv, rv);
-
- // Craft a whitelist URL like "toplevel.page/?resource=third.party.domain"
- nsAutoCString pageHostname, resourceDomain;
- rv = topWinURI->GetHost(pageHostname);
- NS_ENSURE_SUCCESS(rv, rv);
- rv = chanPrincipal->GetBaseDomain(resourceDomain);
- NS_ENSURE_SUCCESS(rv, rv);
- nsAutoCString whitelistEntry = NS_LITERAL_CSTRING("http://") +
- pageHostname + NS_LITERAL_CSTRING("/?resource=") + resourceDomain;
- LOG(("nsChannelClassifier[%p]: Looking for %s in the whitelist",
- this, whitelistEntry.get()));
-
- nsCOMPtr<nsIURI> whitelistURI;
- rv = NS_NewURI(getter_AddRefs(whitelistURI), whitelistEntry);
- NS_ENSURE_SUCCESS(rv, rv);
-
- // Check whether or not the tracker is in the entity whitelist
- nsAutoCString results;
- rv = uriClassifier->ClassifyLocalWithTables(whitelistURI, tables, results);
- NS_ENSURE_SUCCESS(rv, rv);
- if (!results.IsEmpty()) {
- return NS_OK; // found it on the whitelist, must not be blocked
- }
-
- LOG(("nsChannelClassifier[%p]: %s is not in the whitelist",
- this, whitelistEntry.get()));
- return NS_ERROR_TRACKING_URI;
-}
-
NS_IMETHODIMP
nsChannelClassifier::OnClassifyComplete(nsresult aErrorCode)
{
// Should only be called in the parent process.
MOZ_ASSERT(XRE_IsParentProcess());
- if (aErrorCode == NS_ERROR_TRACKING_URI &&
- NS_SUCCEEDED(IsTrackerWhitelisted())) {
- LOG(("nsChannelClassifier[%p]:OnClassifyComplete tracker found "
- "in whitelist so we won't block it", this));
- aErrorCode = NS_OK;
- }
-
if (mSuspendedChannel) {
nsAutoCString errorName;
if (LOG_ENABLED()) {
@@ -673,13 +601,6 @@ nsChannelClassifier::OnClassifyComplete(nsresult aErrorCode)
uri->GetSpecOrDefault().get(), errorName.get()));
}
- // Channel will be cancelled (page element blocked) due to tracking.
- // Do update the security state of the document and fire a security
- // change event.
- if (aErrorCode == NS_ERROR_TRACKING_URI) {
- SetBlockedTrackingContent(mChannel);
- }
-
mChannel->Cancel(aErrorCode);
}
LOG(("nsChannelClassifier[%p]: resuming channel %p from "