mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-24 18:55:30 +00:00
309a23afc3
The mIsTrackingResource flag on nsIHttpChannel was split into two separate flags depending on whether or not the resource is third-party. The correct flag will be set by the channel classifier. Similarly, a new function was introduced, GetIsThirdPartyTrackingResource(), for those consumers (like TP) who only care about third-party trackers. The existing function, GetIsTracking(), will continue to look at both first-party and third-party trackers (the behavior since first party tracking was added to annotations in bug 1476324). The OverrideTrackingResource() function now allows nsHTMLDocument to override both mIsFirstPartyTrackingResource and mIsThirdPartyTrackingResource, but since this function is a little dangerous and only has a single user, I added an assert to make future callers think twice about using it to opt out of tracking annotations. Currently, only the default storage restrictions need to look at first-party trackers so every other consumer has been moved to mIsThirdPartyTrackingResource or GetIsThirdPartyTrackingResource(). This effectively reverts the third-party checks added in bug 1476715 and replaces them with the more complicated check that was added in bug 1108017. It follows the approach that Ehsan initially suggested in bug 1476715. It also reverts the changes in the expected values of the tracking annotation test since these were, in hindsight, a warning about this regression. Depends on D3722 Differential Revision: https://phabricator.services.mozilla.com/D3723 --HG-- extra : moz-landing-system : lando
102 lines
2.5 KiB
C++
102 lines
2.5 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/* vim: set ts=4 sw=4 sts=4 et 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 "SimpleChannelParent.h"
|
|
#include "mozilla/Assertions.h"
|
|
#include "nsNetUtil.h"
|
|
#include "nsIChannel.h"
|
|
|
|
namespace mozilla {
|
|
namespace net {
|
|
|
|
NS_IMPL_ISUPPORTS(SimpleChannelParent, nsIParentChannel, nsIStreamListener)
|
|
|
|
bool
|
|
SimpleChannelParent::Init(const uint32_t &channelId)
|
|
{
|
|
nsCOMPtr<nsIChannel> channel;
|
|
MOZ_ALWAYS_SUCCEEDS(
|
|
NS_LinkRedirectChannels(channelId, this, getter_AddRefs(channel)));
|
|
|
|
return true;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
SimpleChannelParent::SetParentListener(HttpChannelParentListener* aListener)
|
|
{
|
|
// Nothing to do.
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
SimpleChannelParent::NotifyTrackingProtectionDisabled()
|
|
{
|
|
// Nothing to do.
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
SimpleChannelParent::NotifyTrackingResource(bool aIsThirdParty)
|
|
{
|
|
// Nothing to do.
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
SimpleChannelParent::SetClassifierMatchedInfo(const nsACString& aList,
|
|
const nsACString& aProvider,
|
|
const nsACString& aPrefix)
|
|
{
|
|
// nothing to do
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
SimpleChannelParent::Delete()
|
|
{
|
|
// Nothing to do.
|
|
return NS_OK;
|
|
}
|
|
|
|
void
|
|
SimpleChannelParent::ActorDestroy(ActorDestroyReason aWhy)
|
|
{
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
SimpleChannelParent::OnStartRequest(nsIRequest* aRequest,
|
|
nsISupports* aContext)
|
|
{
|
|
// We don't have a way to prevent nsBaseChannel from calling AsyncOpen on
|
|
// the created nsSimpleChannel. We don't have anywhere to send the data in the
|
|
// parent, so abort the binding.
|
|
return NS_BINDING_ABORTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
SimpleChannelParent::OnStopRequest(nsIRequest* aRequest,
|
|
nsISupports* aContext,
|
|
nsresult aStatusCode)
|
|
{
|
|
// See above.
|
|
MOZ_ASSERT(NS_FAILED(aStatusCode));
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
SimpleChannelParent::OnDataAvailable(nsIRequest* aRequest,
|
|
nsISupports* aContext,
|
|
nsIInputStream* aInputStream,
|
|
uint64_t aOffset,
|
|
uint32_t aCount)
|
|
{
|
|
// See above.
|
|
MOZ_CRASH("Should never be called");
|
|
}
|
|
|
|
} // namespace net
|
|
} // namespace mozilla
|